[issue14406] Race condition in concurrent.futures

2012-08-20 Thread Ralf Schmitt

Changes by Ralf Schmitt python-b...@systemexit.de:


--
nosy: +schmir

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14406
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14406] Race condition in concurrent.futures

2012-08-20 Thread Ralf Schmitt

Ralf Schmitt added the comment:

I think having a lock here is unnecessary. The following code should work:

def _decrement_pending_calls(self):
if self.num_pending_calls == len(self.finished_futures):
 self.event.set()

(well, maybe the method should also be renamed then)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14406
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14406] Race condition in concurrent.futures

2012-03-31 Thread Matt Joiner

Matt Joiner anacro...@gmail.com added the comment:

Patch with a test included. Being a nondeterministic bug, please adjust the 
thread count, or timing as necessary, the parameters in the patch are as low as 
I can get them and still reasonably reproduce the bug (linux 3.2, i386).

There's a few complications in testing this. Firstly timeouts cannot be used, 
because at the end of the timeout, all the futures are checked to categorize 
them into done and not done. Except for taking the entire duration of the 
timeout given to return, the bug is masked in this case.

Secondly, it can't be known how long a wait *should* take, so failing after 
some duration and assuming a stall due to the race decrementing 
num_pending_calls would be a guess dependent on the capabilities of the system.

If a timeout needs to be added (and fired from an outside thread for reasons 
given above), please let me know, and direct me to an example of this kind of 
testing elsewhere in the stdlib, so I can do this idiomatically.

Without applying the patch, the test case provided will (usually) hang 
indefinitely.

--
Added file: 
http://bugs.python.org/file25078/concurrent.futures._AllCompletedWaiter.num_pending_calls-race-test.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14406
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14406] Race condition in concurrent.futures

2012-03-31 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset 0312db5265d0 by Antoine Pitrou in branch '3.2':
Issue #14406: Fix a race condition when using 
`concurrent.futures.wait(return_when=ALL_COMPLETED)`.
http://hg.python.org/cpython/rev/0312db5265d0

New changeset 2c1432552213 by Antoine Pitrou in branch 'default':
Issue #14406: Fix a race condition when using 
`concurrent.futures.wait(return_when=ALL_COMPLETED)`.
http://hg.python.org/cpython/rev/2c1432552213

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14406
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14406] Race condition in concurrent.futures

2012-03-31 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

The patch looks fine, I've committed it. Thanks!

--
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14406
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14406] Race condition in concurrent.futures

2012-03-29 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Could your patch also include a proper test case in 
Lib/test/test_concurrent_futures.py ?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14406
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14406] Race condition in concurrent.futures

2012-03-29 Thread Matt Joiner

Matt Joiner anacro...@gmail.com added the comment:

I'll add this shortly.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14406
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14406] Race condition in concurrent.futures

2012-03-25 Thread Matt Joiner

New submission from Matt Joiner anacro...@gmail.com:

There's a race condition in concurrent.futures in _AllCompletedWaiter, which 
affects wait(return_when=ALL_COMPLETED).

The attached test will go into an infinite wait.

--
components: Library (Lib)
files: concurrent.futures._AllCompletedWaiter-race-condition-test.py
messages: 156764
nosy: anacrolix
priority: normal
severity: normal
status: open
title: Race condition in concurrent.futures
type: behavior
versions: Python 3.2, Python 3.3
Added file: 
http://bugs.python.org/file25019/concurrent.futures._AllCompletedWaiter-race-condition-test.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14406
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14406] Race condition in concurrent.futures

2012-03-25 Thread Matt Joiner

Matt Joiner anacro...@gmail.com added the comment:

Patch attached.

--
keywords: +patch
Added file: 
http://bugs.python.org/file25020/concurrent.futures._AllCompletedWaiter-race-condition.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14406
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14406] Race condition in concurrent.futures

2012-03-25 Thread Matt Joiner

Changes by Matt Joiner anacro...@gmail.com:


--
nosy: +bquinlan, loewis, pitrou, rosslagerwall

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14406
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com