threading IOError

Andrew MacIntyre andymac at bullseye.apana.org.au
Tue Dec 13 18:11:28 EST 2005


Gabriel Genellina wrote:
> Hi
> 
> I'm using Python 2.4.2 on Windows 98 SE.
> 
> In a program with several threads, sometimes (I cant determine exactly
> when or why) one thread dies with the following traceback:
> 
> 12/13/05 02:17:47 (WatchDog       ) Unhandled thread exception
> Traceback (most recent call last):
>   File "E:\prog\pop3\TaskScheduler.py", line 60, in run
>     self.finished.wait(self.interval)
>   File "C:\Apps\Python\Lib\threading.py", line 348, in wait
>     self.__cond.wait(timeout)
>   File "C:\Apps\Python\Lib\threading.py", line 218, in wait
>     remaining = endtime - _time()
> IOError: [Errno 2] No such file or directory
> 
> The error appears to be inside the time module, and I can't explain the
> IOError there.
> 
> Maybe this crash is related too: sometimes, the full program crashes
> with an Invalid Page Fault with the following info:
> 
> PYTHONW provocó un error de página no válida en el módulo
> PYTHON24.DLL de 016f:1e0ab51f.
> Registros:
> EAX=1e19d1af CS=016f EIP=1e0ab51f EFLGS=00010206
> EBX=00841f80 SS=0177 ESP=0071e6ec EBP=00000000
> ECX=73962000 DS=0177 ESI=1e06a1b0 FS=1a07
> EDX=1e19d1b0 ES=0177 EDI=00000000 GS=0000
> 
> Any ideas?

Quite some time ago I saw the same sort of issue - inexplicable 
exceptions from apparently benign code.

Tim Peters prognosticated that there was a bug in an extension module,
and indeed that proved to be the case (a 3rd party extension, which
fortunately I had source for and was able to build).

I doubt that any of Python's standard extension modules will be involved
(as they are generally mature and widely used and tested) but you should
look at the source for any others looking for unhandled error returns.
Typically, errno is set but the failure return from the routine setting
errno is ignored or not properly handled.

What then happens is the next time an exception gets propagated through
Python's internals, the errno value gets picked up and is used to
identify the exception (incorrectly).

The invalid page fault may well be because a garbage pointer is handed
to a routine, possibly as a consequence of the mishandled error return.

-------------------------------------------------------------------------
Andrew I MacIntyre                     "These thoughts are mine alone..."
E-mail: andymac at bullseye.apana.org.au  (pref) | Snail: PO Box 370
        andymac at pcug.org.au             (alt) |        Belconnen ACT 2616
Web:    http://www.andymac.org/               |        Australia



More information about the Python-list mailing list