nacos-group / nacos-group/nacos-sdk-python
配置中心,增加add_config_watcher python3.10 监听报TypeError: cannot pickle '_thread.RLock' object 有大佬解决么
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 471
- Forks
- 155
- PR merge metrics
- No merged PRs in 30d
Description
Traceback (most recent call last):
File "/Users/oker/Documents/PyProject/ui-autotest-cases/libs/x_nacos.py", line 80, in
client.add_config_watcher(AB_TEST_CITY_VERSION_CONFIG, NACOS_CONFIG_GROUP, utest_cb) # 这个必须放在main里面完成
File "/Users/oker/Documents/PyProject/ui-autotest-cases/venv/lib/python3.10/site-packages/nacos/commons.py", line 10, in synced_func
return func(*args, **kws)
File "/Users/oker/Documents/PyProject/ui-autotest-cases/venv/lib/python3.10/site-packages/nacos/client.py", line 520, in add_config_watcher
self.add_config_watchers(data_id, group, [cb], content)
File "/Users/oker/Documents/PyProject/ui-autotest-cases/venv/lib/python3.10/site-packages/nacos/commons.py", line 10, in synced_func
return func(*args, **kws)
File "/Users/oker/Documents/PyProject/ui-autotest-cases/venv/lib/python3.10/site-packages/nacos/client.py", line 566, in add_config_watchers
puller.start()
File "/opt/homebrew/Cellar/python@3.10/3.10.6_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/process.py", line 121, in start
self._popen = self._Popen(self)
File "/opt/homebrew/Cellar/python@3.10/3.10.6_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/context.py", line 224, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "/opt/homebrew/Cellar/python@3.10/3.10.6_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/context.py", line 288, in _Popen
return Popen(process_obj)
File "/opt/homebrew/Cellar/python@3.10/3.10.6_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/popen_spawn_posix.py", line 32, in init
super().init(process_obj)
File "/opt/homebrew/Cellar/python@3.10/3.10.6_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/popen_fork.py", line 19, in init
self._launch(process_obj)
File "/opt/homebrew/Cellar/python@3.10/3.10.6_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/popen_spawn_posix.py", line 47, in _launch
reduction.dump(process_obj, fp)
File "/opt/homebrew/Cellar/python@3.10/3.10.6_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/reduction.py", line 60, in dump
ForkingPickler(file, protocol).dump(obj)
TypeError: cannot pickle '_thread.RLock' object
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure from x_nacos.py line 80, then inspect nacos/client.py at add_config_watcher, add_config_watchers, and puller.start(), along with nacos/commons.py. Confirm the Python 3.10 multiprocessing startup path and identify why the watcher process cannot be serialized; done means the watcher starts without the RLock pickle error.
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
- 30/100