Message299952
The problem is the weakref callback of _module_locks. It seems like the callback is called after a second thread replaced _module_locks[name]
* Thread 1: _get_module_lock('random') sets _module_locks['random'] and registers a weakref callback on the newly created lock
* Thread 1: the lock is destroyed, the weakref callback will be called as soon as possible
* Thread 2: _get_module_lock('random') sees that the weakref is dead and so replaces _module_locks['random'] with a new lock, and registers a new weakref callback on the second lock
* Thread 1: Call the weakref callback removing _module_locks['random'] -- BUG: the callback is called too late, after Thread 2 already sets a new lock
* Thread 2: The lock is destroyed, the second weakref callback will be called as soon as possible
* Thread 2: The second callback is called and fails with KeyError since _module_locks['random'] was already called in the Thread 1 in the meanwhile |
|
Date |
User |
Action |
Args |
2017-08-08 23:40:56 | vstinner | set | recipients:
+ vstinner, brett.cannon, ncoghlan, serhiy.storchaka |
2017-08-08 23:40:56 | vstinner | set | messageid: <1502235656.48.0.208405535066.issue31070@psf.upfronthosting.co.za> |
2017-08-08 23:40:56 | vstinner | link | issue31070 messages |
2017-08-08 23:40:56 | vstinner | create | |
|