threading.py Condition wait overflow error

Tim Peters tim.peters at gmail.com
Wed Jan 26 00:10:31 EST 2005


[Mark English]
> Every once in a while since I moved to Python 2.4 I've been seeing the
> following exception in threading.py Condition:
>
>  File "mctest3.py", line 1598, in WaitForMessages
>    self.condResponses.wait(1.0)
>  File "C:\Program Files\Python24\lib\threading.py", line 221, in wait
>    delay = min(delay * 2, remaining, .05)
> OverflowError: long int too large to convert to int
>
> Is there something I'm doing wrong here ? I've looked at my code, and
> glanced at threading.py, and I can't see any obvious errors (multiplying
> a float by 2, using the result of the time.time() call none of which use
> longs as far as I know).
>
> I added some print statements to threading.py and the exception is
> thrown on the first iteration when delay is 0.0005 and remaining is 1.0
> However the code does keep running...

The error is particularly bizarre, since none of min's arguments are
even integers (they're all floats).  The only int in sight is "2".

Which C extension modules (outside of the ones shipped with Python)
are you using?  The most common cause for "impossible exceptions" is
flawed C code in an extension that fails to check a Python C API call
for an error return.  The exception remains set then, but the flawed C
code doesn't tell the interpreter that it failed.  The exception gets
raised at a seemingly random later time then.  This is usually in a
non-core extension just because the core C code is so heavily used
that such problems rarely survive to a final release.

Do you use long (unbounded) ints _anywhere_ in the app that you know of?

> ---------<code>--------------
> Delay: 0.0005 Remaining: 1.0
> Traceback (most recent call last):
>  File "<stdin>", line 1, in ?
>  File "mctest3.py", line 2665, in getLogonResponse
>    respLogon.WaitForMessages()
>  File "mctest3.py", line 1598, in WaitForMessages
>    self.condResponses.wait(1.0)
>  File "C:\Program Files\Python24\lib\threading.py", line 222, in wait
>    delay = min(delay * 2, remaining, .05)
> OverflowError: long int too large to convert to int
> Delay: 0.016 Remaining: 8.07899999619
> Delay: 0.032 Remaining: 8.01600003242
> Delay: 0.05 Remaining: 7.95399999619
> Done
> Message response handler got message <LogonStatus4 object at 0x0167B540>
> ----------</code>-------------
>
> Is this something to do with min ? Converting 1.0 ?

Almost certainly neither, and there have been no other reports of
this.  That's more reason to suspect a non-core extension module.



More information about the Python-list mailing list