Message138768
Oh, I think that I found a deadlock (or something like that):
----------------------------
import concurrent.futures
import faulthandler
import os
import signal
import time
def work(n):
time.sleep(0.1)
def main():
faulthandler.register(signal.SIGUSR1)
print("pid: %s" % os.getpid())
with concurrent.futures.ProcessPoolExecutor() as executor:
for number, prime in executor.map(work, range(100)):
print("shutdown")
executor.shutdown()
print("shutdown--")
if __name__ == '__main__':
main()
----------------------------
Trace:
----------------------------
Thread 0x00007fbfc83bd700:
File "/home/haypo/prog/HG/cpython/Lib/threading.py", line 237 in wait
File "/home/haypo/prog/HG/cpython/Lib/multiprocessing/queues.py", line 252 in _feed
File "/home/haypo/prog/HG/cpython/Lib/threading.py", line 690 in run
File "/home/haypo/prog/HG/cpython/Lib/threading.py", line 737 in _bootstrap_inner
File "/home/haypo/prog/HG/cpython/Lib/threading.py", line 710 in _bootstrap
Thread 0x00007fbfc8bbe700:
File "/home/haypo/prog/HG/cpython/Lib/multiprocessing/queues.py", line 101 in put
File "/home/haypo/prog/HG/cpython/Lib/concurrent/futures/process.py", line 268 in _queue_management_worker
File "/home/haypo/prog/HG/cpython/Lib/threading.py", line 690 in run
File "/home/haypo/prog/HG/cpython/Lib/threading.py", line 737 in _bootstrap_inner
File "/home/haypo/prog/HG/cpython/Lib/threading.py", line 710 in _bootstrap
Current thread 0x00007fbfcc2e3700:
File "/home/haypo/prog/HG/cpython/Lib/threading.py", line 237 in wait
File "/home/haypo/prog/HG/cpython/Lib/threading.py", line 851 in join
File "/home/haypo/prog/HG/cpython/Lib/concurrent/futures/process.py", line 395 in shutdown
File "/home/haypo/prog/HG/cpython/Lib/concurrent/futures/_base.py", line 570 in __exit__
File "y.py", line 17 in main
File "y.py", line 20 in <module>
----------------------------
There are two child processes, but both are zombies (displayed as "<defunct>" by ps). Send SIGUSR1 signal to the frozen process to display the traceback (thanks to faulthandler). |
|
Date |
User |
Action |
Args |
2011-06-21 01:05:35 | vstinner | set | recipients:
+ vstinner, pitrou, neologix |
2011-06-21 01:05:35 | vstinner | set | messageid: <1308618335.51.0.449763650808.issue12364@psf.upfronthosting.co.za> |
2011-06-21 01:05:34 | vstinner | link | issue12364 messages |
2011-06-21 01:05:33 | vstinner | create | |
|