[issue20737] 3.3 _thread lock.acquire() timeout and threading.Event().wait() do not wake for certain values on Windows

2014-05-08 Thread Tim Golden
Tim Golden added the comment: +1 for Kristjan's latest patch. And thanks for working this through, Kristjan: I'd missed the fact that the microseconds conversion could itself overflow even an unsigned long. -- ___ Python tracker

[issue20737] 3.3 _thread lock.acquire() timeout and threading.Event().wait() do not wake for certain values on Windows

2014-05-08 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Thanks. Can you confirm that it resolves the issue? I'll get it checked in once I get the regrtest suite run. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20737

[issue20737] 3.3 _thread lock.acquire() timeout and threading.Event().wait() do not wake for certain values on Windows

2014-05-08 Thread Tim Golden
Tim Golden added the comment: s/Py_LONG_LONG/PY_LONG_LONG/ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20737 ___ ___ Python-bugs-list mailing

[issue20737] 3.3 _thread lock.acquire() timeout and threading.Event().wait() do not wake for certain values on Windows

2014-05-08 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: I see, I wasn't able to compile it yesterday when I did it :) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20737 ___

[issue20737] 3.3 _thread lock.acquire() timeout and threading.Event().wait() do not wake for certain values on Windows

2014-05-08 Thread Tim Golden
Tim Golden added the comment: I can confirm that the attached test.py times out after 2150 seconds (ie 30+ minutes) with your (tweaked) patch applied: python test.py 2150 Running Debug|Win32 interpreter... 2014-05-08 10:33:53.670091 Expected to time out by 2014-05-08 11:09:43.670091 Timed Out

[issue20737] 3.3 _thread lock.acquire() timeout and threading.Event().wait() do not wake for certain values on Windows

2014-05-08 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: nope, let's not do that :) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20737 ___ ___

[issue20737] 3.3 _thread lock.acquire() timeout and threading.Event().wait() do not wake for certain values on Windows

2014-05-08 Thread Roundup Robot
Roundup Robot added the comment: New changeset 80b76c6fad44 by Kristján Valur Jónsson in branch 'default': The PyCOND_TIMEDWAIT must use microseconds for the timeout argument http://hg.python.org/cpython/rev/80b76c6fad44 -- nosy: +python-dev ___

[issue20737] 3.3 _thread lock.acquire() timeout and threading.Event().wait() do not wake for certain values on Windows

2014-05-08 Thread Roundup Robot
Roundup Robot added the comment: New changeset ab5e2b0fba15 by Kristján Valur Jónsson in branch '3.3': The PyCOND_TIMEDWAIT must use microseconds for the timeout argument http://hg.python.org/cpython/rev/ab5e2b0fba15 New changeset 7764bb7f2983 by Kristján Valur Jónsson in branch '3.4': Merging

[issue20737] 3.3 _thread lock.acquire() timeout and threading.Event().wait() do not wake for certain values on Windows

2014-05-08 Thread Kristján Valur Jónsson
Changes by Kristján Valur Jónsson krist...@ccpgames.com: -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20737 ___

[issue20737] 3.3 _thread lock.acquire() timeout and threading.Event().wait() do not wake for certain values on Windows

2014-05-07 Thread Tim Golden
Tim Golden added the comment: The attached patch uses DWORD (essentially: unsigned long) in condvar.h:PyCOND_TIMEDWAIT. Adding Kristjan as it was his code. -- keywords: +patch nosy: +kristjan.jonsson Added file: http://bugs.python.org/file35169/issue20737.condvar.patch

[issue20737] 3.3 _thread lock.acquire() timeout and threading.Event().wait() do not wake for certain values on Windows

2014-05-07 Thread Tim Golden
Changes by Tim Golden m...@timgolden.me.uk: -- stage: - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20737 ___ ___ Python-bugs-list

[issue20737] 3.3 _thread lock.acquire() timeout and threading.Event().wait() do not wake for certain values on Windows

2014-05-07 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: changing long to DWORD doesn't really fix the overflow issue. The fundamental problem is that some of the apis, e.g. WaitForSingleObject have a DWORD maximum. so, we cannot support sleep times longer than some particular time. Microseconds was chosen

[issue20737] 3.3 _thread lock.acquire() timeout and threading.Event().wait() do not wake for certain values on Windows

2014-05-07 Thread Tim Golden
Tim Golden added the comment: Thanks for the feedback, Kristjan. You're obviously correct in that we can't account for timeouts greater than DWORD-size milliseconds and your proposed solution looks reasonable. However, I'd like to close off *this* particular issue which turns on the implicit

[issue20737] 3.3 _thread lock.acquire() timeout and threading.Event().wait() do not wake for certain values on Windows

2014-05-07 Thread R. David Murray
R. David Murray added the comment: An implicit ceiling of 4000 seconds on the timeout? I routinely use timeouts of approximately 24 hours in calls to Event().wait(). What am I misunderstanding? If I'm not misunderstanding, then no, I don't think that change would be acceptable. --

[issue20737] 3.3 _thread lock.acquire() timeout and threading.Event().wait() do not wake for certain values on Windows

2014-05-07 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Tim, how about changing the variable to unsigned long? I'd like the signature of the function to be the same for all platforms. This will change the code and allow waits for up to 4000 seconds. There is still an overflow problem present, though.+

[issue20737] 3.3 _thread lock.acquire() timeout and threading.Event().wait() do not wake for certain values on Windows

2014-05-07 Thread R. David Murray
R. David Murray added the comment: I have production code on Windows using python2.7 that calls Event().wait() with a timeout of approximately 24 hours, and it works just fine. Having that no longer work is, IMO, an unacceptable regression. (I'm ready to move this code to python3 as soon as

[issue20737] 3.3 _thread lock.acquire() timeout and threading.Event().wait() do not wake for certain values on Windows

2014-05-07 Thread Tim Golden
Tim Golden added the comment: Just to be clear: the change *I'm* proposing for this issue has nothing to do with limiting the wait, artificially or otherwise. It's simply undoing an unintended conversion from unsigned to signed and back again, whicih currently causes any wait of more than

[issue20737] 3.3 _thread lock.acquire() timeout and threading.Event().wait() do not wake for certain values on Windows

2014-05-07 Thread Tim Golden
Tim Golden added the comment: Updated patch with unsigned long applied throughout -- Added file: http://bugs.python.org/file35173/issue20737.condvar.2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20737

[issue20737] 3.3 _thread lock.acquire() timeout and threading.Event().wait() do not wake for certain values on Windows

2014-05-07 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Hi there. When I said 4000, that was because of the conversion to microseconds which happens early on. I'm not trying to be difficult here Tim, it's just that you've pointed out a problem and I'd like us to have a comprehensive fix. unsigned long,

[issue20737] 3.3 _thread lock.acquire() timeout and threading.Event().wait() do not wake for certain values on Windows

2014-05-07 Thread R. David Murray
R. David Murray added the comment: I'm adding Mark Dickinson to nosy to see if our math expert has a comment on the arithmetic :) -- nosy: +mark.dickinson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20737

[issue20737] 3.3 _thread lock.acquire() timeout and threading.Event().wait() do not wake for certain values on Windows

2014-05-07 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: (cont.) so, I suggest that we modify the API to use Py_LONG_LONG usec Does that sound reasonable? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20737

[issue20737] 3.3 _thread lock.acquire() timeout and threading.Event().wait() do not wake for certain values on Windows

2014-05-07 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Ah, I saw this code here in thread_nt.h: if ((DWORD) milliseconds != milliseconds) Py_FatalError(Timeout too large for a DWORD, please check PY_TIMEOUT_MAX); the PyCOND_TIMEDWAIT is currently only used by the GIL

[issue20737] 3.3 _thread lock.acquire() timeout and threading.Event().wait() do not wake for certain values on Windows

2014-05-07 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Here is a proposed alternative patch. No additional checks, just a wider Py_LONG_LONG us wide enough to accommodate 32 bits of milliseconds as before. -- Added file: http://bugs.python.org/file35175/condwait.patch

[issue20737] 3.3 _thread lock.acquire() timeout and threading.Event().wait() do not wake for certain values on Windows

2014-05-07 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: fix patch, was using git format -- Added file: http://bugs.python.org/file35176/condwait.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20737

[issue20737] 3.3 _thread lock.acquire() timeout and threading.Event().wait() do not wake for certain values on Windows

2014-05-06 Thread Tim Golden
Tim Golden added the comment: In thread_nt.h:EnterNonRecursiveMutex the millisecond version (here: 2148000) of the seconds you passed in are converted to microseconds (so: 214800). This is then passed to condvar.h:PyCOND_TIMEDWAIT which expects a long, whose 32-bit limit is 2147483647. So

[issue20737] 3.3 _thread lock.acquire() timeout and threading.Event().wait() do not wake for certain values on Windows

2014-02-24 Thread Alex Grönholm
Changes by Alex Grönholm alex.gronholm+pyt...@nextday.fi: -- nosy: +alex.gronholm ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20737 ___ ___

[issue20737] 3.3 _thread lock.acquire() timeout and threading.Event().wait() do not wake for certain values on Windows

2014-02-22 Thread raruler
New submission from raruler: I've tried this with both the 32-bit and 64-bit versions of 3.3.4 on two Windows 7 x64 machines. threading.Event().wait(2148) and a lock obtained from _thread used as lock.acquire(True, 2148) will never return. Anything under 2148 seems to work just fine, but

[issue20737] 3.3 _thread lock.acquire() timeout and threading.Event().wait() do not wake for certain values on Windows

2014-02-22 Thread Antoine Pitrou
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +brian.curtin, tim.golden versions: +Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20737 ___

[issue20737] 3.3 _thread lock.acquire() timeout and threading.Event().wait() do not wake for certain values on Windows

2014-02-22 Thread R. David Murray
Changes by R. David Murray rdmur...@bitdance.com: -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20737 ___ ___