[issue19158] BoundedSemaphore.release() subject to races

2013-10-09 Thread Roundup Robot
Roundup Robot added the comment: New changeset 369fabf9b2ba by Tim Peters in branch '3.3': Issue 19158: a rare race in BoundedSemaphore could allow .release() too often. http://hg.python.org/cpython/rev/369fabf9b2ba New changeset 9ddc33174ddf by Tim Peters in branch 'default': Issue 19158: a r

[issue19158] BoundedSemaphore.release() subject to races

2013-10-09 Thread STINNER Victor
STINNER Victor added the comment: You should mention the change in Misc/NEWS. -- ___ Python tracker ___ ___ Python-bugs-list mailing l

[issue19158] BoundedSemaphore.release() subject to races

2013-10-08 Thread Tim Peters
Changes by Tim Peters : -- resolution: -> fixed stage: patch review -> committed/rejected status: open -> closed ___ Python tracker ___ _

[issue19158] BoundedSemaphore.release() subject to races

2013-10-08 Thread Roundup Robot
Roundup Robot added the comment: New changeset e06edc0c7a49 by Tim Peters in branch '3.3': Issue 19158: a rare race in BoundedSemaphore could allow .release() too often. http://hg.python.org/cpython/rev/e06edc0c7a49 New changeset 7c56bf5afee6 by Tim Peters in branch 'default': Issue 19158: a r

[issue19158] BoundedSemaphore.release() subject to races

2013-10-08 Thread Antoine Pitrou
Antoine Pitrou added the comment: (of course, you can go ahead and commit your version) -- ___ Python tracker ___ ___ Python-bugs-list

[issue19158] BoundedSemaphore.release() subject to races

2013-10-08 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Antoine, how strongly do you feel about this? I confess I don't get > it. Copy+paste code duplication doesn't help any of readability, > correctness, or ease of future maintenance, so I guess it's some > micro-efficiency concern. Really?! ;-) Not very stron

[issue19158] BoundedSemaphore.release() subject to races

2013-10-08 Thread Tim Peters
Tim Peters added the comment: Antoine, how strongly do you feel about this? I confess I don't get it. Copy+paste code duplication doesn't help any of readability, correctness, or ease of future maintenance, so I guess it's some micro-efficiency concern. Really?! ;-) Note that the patch doe

[issue19158] BoundedSemaphore.release() subject to races

2013-10-08 Thread Antoine Pitrou
Antoine Pitrou added the comment: Le mardi 08 octobre 2013 à 16:58 +, Tim Peters a écrit : > Tim Peters added the comment: > > This is the "right" way to do it: the subclass wants to extend the > behavior of the base class .release(), not to replace it. Calling the > base class .release()

[issue19158] BoundedSemaphore.release() subject to races

2013-10-08 Thread Tim Peters
Tim Peters added the comment: This is the "right" way to do it: the subclass wants to extend the behavior of the base class .release(), not to replace it. Calling the base class .release() is the natural and obvious way to do that. It's also utterly normal for a lock used by multiple method

[issue19158] BoundedSemaphore.release() subject to races

2013-10-08 Thread Antoine Pitrou
Antoine Pitrou added the comment: The implementation is a bit weird. Why take the lock a second time instead of simply reimplementing the release() method? (it's a 5-liner) By the way, Semaphore.acquire could probably use Condition.wait_for. -- nosy: +pitrou __

[issue19158] BoundedSemaphore.release() subject to races

2013-10-06 Thread Tim Peters
Tim Peters added the comment: New patch makes the test case do what I intended it to do ;-) -- Added file: http://bugs.python.org/file31981/boundsem2.patch ___ Python tracker ___

[issue19158] BoundedSemaphore.release() subject to races

2013-10-06 Thread STINNER Victor
Changes by STINNER Victor : -- nosy: +haypo ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python

[issue19158] BoundedSemaphore.release() subject to races

2013-10-06 Thread Tim Peters
Tim Peters added the comment: Attached patch, which closes the timing hole, and adds a new basic sanity test. -- keywords: +patch stage: needs patch -> patch review Added file: http://bugs.python.org/file31979/boundsem.patch ___ Python tracker

[issue19158] BoundedSemaphore.release() subject to races

2013-10-04 Thread Tim Peters
Tim Peters added the comment: Richard, that's a strange argument ;-) Since, e.g., a BoundedSemaphore(1) is semantically equivalent to a mutex, it's like saying some_mutex.release() usually raises an exception if the mutex isn't held at the time - but maybe it won't. If the docs _say_ it's no

[issue19158] BoundedSemaphore.release() subject to races

2013-10-04 Thread Richard Oudkerk
Richard Oudkerk added the comment: Is BoundedSemaphore really supposed to be "robust" in the face of too many releases, or does it just provide a sanity check? I think that releasing a bounded semaphore too many times is a programmer error, and the exception is just a debugging aid for the pro

[issue19158] BoundedSemaphore.release() subject to races

2013-10-03 Thread Tim Peters
New submission from Tim Peters: I'm sure this flaw exists on more than just the current default branch, but didn't check. BoundedSemaphore.release() doesn't quite do what it thinks it's doing. By eyeball, the code obviously suffers from a small timing hole: multiple threads releasing at the