Message377314
When debugging race conditions in a multithreaded application with many threads, it's hard to debug when threads have generic names like "Thread-3".
I propose to use the target name in threading.Thread constructor if the name parameter is omitted.
See for example bpo-41739 with "Dangling thread: <Thread(Thread-3, started daemon 4396088817936)>": the "Thread-3" name is not helpful. I suspect that the bug comes from threading.Thread(target=remove_loop, args=(fn, del_count)): with my proposed change, the thread would be called "target=remove_loop", which is more helpful than "Thread".
Fall back on _newname() as usual if target.__name__ attribute does not exist.
Attached PR implements this idea. |
|
Date |
User |
Action |
Args |
2020-09-22 11:47:35 | vstinner | set | recipients:
+ vstinner |
2020-09-22 11:47:35 | vstinner | set | messageid: <1600775255.57.0.261270212449.issue41833@roundup.psfhosted.org> |
2020-09-22 11:47:35 | vstinner | link | issue41833 messages |
2020-09-22 11:47:35 | vstinner | create | |
|