nacos-group / nacos-group/nacos-sdk-python

macOS big sur python3.9 使用 add_config_watcher 函数 TypeError: cannot pickle '_thread.RLock' object

Open
#45 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
471
Forks
155
PR merge metrics
No merged PRs in 30d

Description

if name == "main":
client.add_config_watcher(data_id, group, test_cb)
import time
time.sleep(3000)

Traceback (most recent call last):
File "/Users/lzh/micro_service/PythonStart/nacos_test/main.py", line 29, in
client.add_config_watcher(data_id, group, test_cb)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/nacos/commons.py", line 10, in synced_func
return func(*args, **kws)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/nacos/client.py", line 519, in add_config_watcher
self.add_config_watchers(data_id, group, [cb], content)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/nacos/commons.py", line 10, in synced_func
return func(*args, **kws)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/nacos/client.py", line 565, in add_config_watchers
puller.start()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/process.py", line 121, in start
self._popen = self._Popen(self)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/context.py", line 224, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/context.py", line 284, in _Popen
return Popen(process_obj)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/popen_spawn_posix.py", line 32, in init
super().init(process_obj)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/popen_fork.py", line 19, in init
self._launch(process_obj)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/popen_spawn_posix.py", line 47, in _launch
reduction.dump(process_obj, fp)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/reduction.py", line 60, in dump
ForkingPickler(file, protocol).dump(obj)
TypeError: cannot pickle '_thread.RLock' object

Process finished with exit code 1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with nacos/client.py at add_config_watchers and the puller.start() call shown in the traceback. Reproduce the watcher setup on macOS Big Sur with Python 3.9, then identify which process data triggers the RLock pickling error; done means add_config_watcher starts without this TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.