gevent + python3.7 + ThreadPoolExecutor will block main thread forever while running future.result(). seems like something about _thread.allocate_lock.acquire.
only python3.7 hit that issue
python3.6+ubuntu18.04 + gevent 1.3.4 runs ok
python3.7+ubuntu18.04 + gevent 1.3.4 runs bad
from gevent import monkey
monkey.patch_all()
from concurrent.futures import ThreadPoolExecutor
import requests
pool = ThreadPoolExecutor()
task = pool.submit(requests.get, "http://python.org")
task.add_done_callback(lambda r: print(r.result(), 'done'))
print(task.result())
and then blocking...............
please try #1248
@wwqgtxx thanks very much, close this issue for duplicate.
Sure enough, on 3.7, ThreadPoolExecuter was changed to use queue.SimpleQueue; on 3.6 it uses queue.Queue.
@jamadden thank you for answering, will gevent do that trick in the future versions?
@ClericPy See #1253. I was on the fence about having gevent do that patch (it's never patched queue before) but this example convinced me that it was the right thing.
waiting for the wonderful lib's updating ^-^