Message367317
Hi.
I have a very basic program:
- one multiprocessing SimpleQueue
- one consumer thread
- one loop:
- add one item to the queue
- create a new process with itself add one item to the queue
- wait for the process to end
For some unknown reason, it will hangs after some time.
I know the docs said:
> This means that if you try joining that process you may get a deadlock unless you are sure that all items which have been put on the queue have been consumed. Similarly, if the child process is non-daemonic then the parent process may hang on exit when it tries to join all its non-daemonic children.
That's why I added "time.sleep(1)" inside the process, to make sure all items added by the child process are consumed. You can remove it and the hang will happen faster.
I'm using Python 3.8.2 on Linux. Forcing program to terminate with Ctrl+C (twice):
^CTraceback (most recent call last):
File "bug.py", line 23, in <module>
p.join()
File "/usr/lib/python3.8/multiprocessing/process.py", line 149, in join
res = self._popen.wait(timeout)
File "/usr/lib/python3.8/multiprocessing/popen_fork.py", line 47, in wait
return self.poll(os.WNOHANG if timeout == 0.0 else 0)
File "/usr/lib/python3.8/multiprocessing/popen_fork.py", line 27, in poll
pid, sts = os.waitpid(self.pid, flag)
KeyboardInterrupt
^CError in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/usr/lib/python3.8/multiprocessing/popen_fork.py", line 27, in poll
pid, sts = os.waitpid(self.pid, flag)
KeyboardInterrupt |
|
Date |
User |
Action |
Args |
2020-04-26 16:58:22 | Delgan | set | recipients:
+ Delgan |
2020-04-26 16:58:22 | Delgan | set | messageid: <1587920302.07.0.276002968457.issue40399@roundup.psfhosted.org> |
2020-04-26 16:58:22 | Delgan | link | issue40399 messages |
2020-04-26 16:58:21 | Delgan | create | |
|