[issue27908] del _limbo[self] KeyError

2016-09-15 Thread Maciej Urbański
Maciej Urbański added the comment: To address @Dima.Tisnek concern I have changed exception message in case thread start process is merely in progress. I kept `self._started` check under a lock so we can avoid more extreme race condition of one thread checking `self._started` right before

[issue27908] del _limbo[self] KeyError

2016-09-13 Thread Dima Tisnek
Dima Tisnek added the comment: Your logic is accurate; _started is in fact separate from _limbo. As such taking a lock for "test-then-set" only would suffice. Now when you bring the other primitive under this lock in one place, it would look cleaner if it was also brought in the other.

[issue27908] del _limbo[self] KeyError

2016-09-13 Thread Brett Cannon
Changes by Brett Cannon : -- nosy: -brett.cannon versions: +Python 3.7 ___ Python tracker ___

[issue27908] del _limbo[self] KeyError

2016-09-13 Thread Brett Cannon
Changes by Brett Cannon : -- components: -Extension Modules ___ Python tracker ___ ___

[issue27908] del _limbo[self] KeyError

2016-09-13 Thread Maciej Urbański
Maciej Urbański added the comment: @Dima.Tisnek, only reason for having both of these conditions together is so I won't have to repeat the same error message in the code at little price of the performance in this edge case (trying to start the same thread multiple times). Unless I'm missing

[issue27908] del _limbo[self] KeyError

2016-09-13 Thread Dima Tisnek
Dima Tisnek added the comment: @rooter, if you go this way, you should also `self._started.set()` with lock held, together with removing thread from `_limbo` -- ___ Python tracker

[issue27908] del _limbo[self] KeyError

2016-09-13 Thread Maciej Urbański
Maciej Urbański added the comment: Successfully reproduced on 2.7.12 and 3.5.2 . Currently there seems to be no protection against starting the same thread twice at the same time. What was checked was only if start operation already finished once. Attached patch makes it so limbo, our

[issue27908] del _limbo[self] KeyError

2016-08-31 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- nosy: +tim.peters ___ Python tracker ___ ___ Python-bugs-list

[issue27908] del _limbo[self] KeyError

2016-08-31 Thread SilentGhost
Changes by SilentGhost : -- components: +Extension Modules nosy: +brett.cannon type: -> behavior ___ Python tracker ___

[issue27908] del _limbo[self] KeyError

2016-08-31 Thread Dima Tisnek
New submission from Dima Tisnek: To reproduce: ``` import threading import time class U(threading.Thread): def run(self): time.sleep(1) if not x.ident: x.start() x = U() for u in [U() for i in range(1)]: u.start() time.sleep(10) ``` Chance to reproduce