This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2016年10月12日 13:03 by vilnis.termanis, last changed 2022年04月11日 14:58 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| manager_pickling.py | vilnis.termanis, 2016年10月12日 13:03 | Script demonstrating problem | ||
| Messages (6) | |||
|---|---|---|---|
| msg278529 - (view) | Author: Vilnis Termanis (vilnis.termanis) * | Date: 2016年10月12日 13:03 | |
Accessing some Manager types (e.g. Lock) through a list, dict or Namespace proxy is not possible if both the mutable container (e.g. list) and contained type instance (e.g. Lock) have been created in the same process.
Symptoms:
In accessing process:
multiprocessing.managers.RemoteError on access, e.g.:
Unserializable message: ('#RETURN', <thread.lock object at 0x7fcf40d31370>)
.. and in underlying manager:
_pickle.PicklingError: Can't pickle <class '_thread.lock'>: attribute lookup lock on _thread failed
The provided test script performs:
0) Initialise SyncManager (via multiprocessing.Manager())
1) Create list proxy through manager
2) Insert another proxied type into the list (e.g. Lock)
3) Try to access type instance from (2) via container created in (1)
Note: When step (2) is run in a child process, everything work as expected. When all steps execute in the same process, one gets the aforementioned exception.
See also:
https://mail.python.org/pipermail/python-list/2009-September/552988.html
|
|||
| msg407085 - (view) | Author: Irit Katriel (iritkatriel) * (Python committer) | Date: 2021年11月26日 19:06 | |
I don't get any errors from the attached script. Is there still a problem here? |
|||
| msg407090 - (view) | Author: Vilnis Termanis (vilnis.termanis) * | Date: 2021年11月26日 20:49 | |
If you un-comment the print_exc() call, you'll see that it still fails - for queue.Queue: Manager failure (for Queue) Traceback (most recent call last): File "fish.py", line 74, in main add_type_in_own_process(mgr, type_name) File "fish.py", line 61, in add_type_in_own_process use_manager(obj, type_name, mgr=mgr) File "fish.py", line 35, in use_manager obj.append(getattr(mgr, type_name)()) File "<string>", line 2, in append File "/usr/lib/python3.8/multiprocessing/managers.py", line 850, in _callmethod raise convert_to_error(kind, result) multiprocessing.managers.RemoteError: --------------------------------------------------------------------------- Traceback (most recent call last): File "/usr/lib/python3.8/multiprocessing/managers.py", line 243, in serve_client request = recv() File "/usr/lib/python3.8/multiprocessing/connection.py", line 251, in recv return _ForkingPickler.loads(buf.getbuffer()) File "/usr/lib/python3.8/multiprocessing/managers.py", line 959, in RebuildProxy return func(token, serializer, incref=incref, **kwds) TypeError: AutoProxy() got an unexpected keyword argument 'manager_owned' --------------------------------------------------------------------------- |
|||
| msg407091 - (view) | Author: Irit Katriel (iritkatriel) * (Python committer) | Date: 2021年11月26日 20:52 | |
Version 3.8 is in security fix only mode. Is this a problem on newer versions? |
|||
| msg407092 - (view) | Author: Vilnis Termanis (vilnis.termanis) * | Date: 2021年11月26日 20:55 | |
Apologies, my mistake - it does indeed work with 3.9 & 3.10. Feel free to close. |
|||
| msg407093 - (view) | Author: Irit Katriel (iritkatriel) * (Python committer) | Date: 2021年11月26日 20:55 | |
Thank you. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:38 | admin | set | github: 72608 |
| 2021年11月26日 20:55:53 | iritkatriel | set | status: pending -> closed messages: + msg407093 stage: resolved |
| 2021年11月26日 20:55:07 | vilnis.termanis | set | status: open -> pending resolution: works for me messages: + msg407092 versions: + Python 3.8 |
| 2021年11月26日 20:52:00 | iritkatriel | set | messages: + msg407091 |
| 2021年11月26日 20:49:43 | vilnis.termanis | set | status: pending -> open resolution: works for me -> (no value) messages: + msg407090 |
| 2021年11月26日 19:06:12 | iritkatriel | set | status: open -> pending nosy: + iritkatriel messages: + msg407085 resolution: works for me |
| 2016年10月13日 21:46:41 | ned.deily | set | nosy:
+ davin |
| 2016年10月12日 13:05:06 | vilnis.termanis | set | type: crash -> behavior |
| 2016年10月12日 13:04:47 | vilnis.termanis | set | type: crash |
| 2016年10月12日 13:03:47 | vilnis.termanis | create | |