[python-win32] ReadEventLog doesn't return, CPU usage increases

Mark Hammond mhammond at skippinet.com.au
Fri Mar 3 01:25:40 CET 2006


> The problem is that after the script has run from some time (usually
several
> hours), the call to ReadEventLog seems to hang and the CPU usage increases
> dramatically (from nil to 30-50%).  The script does not exit this stage,
> and has to be broken manually with Ctrl-C.

There is the possibility of an infinite loop in the python implementation of
ReadEventLog should the API function not behave as expected.

In summary, this function handles a case when the evtlog record is large,
when Windows tells us the buffer is too small and also tells us the size
necessary.  We have no protection in the code for Windows continually
returning this value without actually increasing the size necessary.

If you don't have a C compiler available, I could send you an instrumented
.pyd file that dumped to stdout each time this loop executed.  It would
generate *lots* of noise, but would demonstrate if the problem is that loop,
or inside Windows itself.  If the latter, then I'm afraid I have no advice.

Mark



More information about the Python-win32 mailing list