[New-bugs-announce] [issue31990] Pickling deadlocks in thread with python -m
Werner Smidt
report at bugs.python.org
Thu Nov 9 05:14:19 EST 2017
New submission from Werner Smidt <werner.smidt at gmail.com>:
Hi there
I recently stumbled on an interesting behaviour. I won't call it an error, because I think it's a mistake I made.
BACKGROUND: I want to spawn threads that handle pickled data. This works really well. However, I would like to execute the python script in question as a module, i.e. python -m mymodule. This is merely for aesthetic purposes.
The attached script has two functions:
1. Pickle/unpickle an instance of a `namedtuple`
2. Pickle/unpickle a string
Each of these functions are run in the main thread and then in subsequent spawned threads.
If I run the script attached with "python testqueuepickle.py", it works fine. I get the data pickled/unpickled in the respective functions and nothing deadlocks and everything is printed to screen. If, however, I run it with the "-m" option (python -m testqueuepickle.py) , the program deadlocks at the pickling of the "namedtuple" instance. The pickling/unpickling of the string appears to be unaffected.
Programming practices aside, what do you think could be the cause of this?
----------
files: testqueuepickle.py
messages: 305953
nosy: Werner Smidt
priority: normal
severity: normal
status: open
title: Pickling deadlocks in thread with python -m
type: behavior
versions: Python 2.7
Added file: https://bugs.python.org/file47255/testqueuepickle.py
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31990>
_______________________________________
More information about the New-bugs-announce
mailing list