PyCharm Professional 调试器在使用 Google App Engine 时存在一个问题。调试由我的代码手动启动的线程时,断点不起作用。这会影响调试在which uses或2.7 backport
上运行的代码的能力(GAE 现在正式支持)dev_appserver
threading.Thread
concurrent.futures.ThreadPoolExecutor
PyCharm 2017.2 和 2017.3.4 均出现此问题。在 Ubuntu Linux 上的 GAE SDK 1.9.66 上观察到。
这是一个重现代码 - 从任何请求处理程序调用它。
from concurrent.futures import ThreadPoolExecutor, wait
from threading import Thread
def worker():
logging.info("Worker") # set breakpoint here
time.sleep(3)
def call_this(): # call this from your request handler
tpe = ThreadPoolExecutor(max_workers=5)
futures = [tpe.submit(worker) for i in range(10)]
wait(futures)
threads = [Thread(worker) for i in range(10)]
for t in threads: t.start()
for t in threads: t.join()