New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Logging problem on Windows XP #44039
Comments
Traceback (most recent call last):
File "C:\Python\Lib\logging\handlers.py", line 73, in
emit
if self.shouldRollover(record):
File "C:\Python\Lib\logging\handlers.py", line 147,
in shouldRollover
self.stream.seek(0, 2) #due to non-posix-compliant
Windows feature
ValueError: I/O operation on closed file not sure why this file is closed. |
Logged In: YES And I think python crashes on Windows if I try to use logger Unhandled exception at 0x7c901010 in python.exe: 0xC0000005:
|
Logged In: YES Can you provide a test case for either problem? |
Logged In: YES to start application please use: src/py/run.bat You can change http settings in src/conf/development/robot.conf sorry code is quite raw just started. :) |
I have this problem, I'm googling this and finding lots of people having the same problem. I'm running python 2.5 on windows XP and using the rotating file handler. I've disabled the logger in my application so I can continue development. |
Ok, so tsample.zip is a test case for the original problem, right? I can't make it crash (on Linux); what do have to do to make it crash? eloff: this report actually reports two problems (the I/O error, and the crash). As for the traceback problem: this is due to the main thread terminating, and As a work-around, add httpServer.join() at the end of your script. I'll attach a patch that fixes this problem in the Python library. |
I'm seeing the I/O error and crash a lot on Windows and the I/O error on Linux. |
Thanks Martin, I applied the patch. The problem I was having was the IO Error, sorry for being vague. The part I don't understand is I should not have had other threads running (and definately should not have had the logger being used outside the main thread.) Can the problem occur with just one thread? I was running under the debugger in wing, I don't know if that might cause this problem. Anyway if I find out anything else I'll let you know. If you don't hear from me then everything is working great. |
eloff: It may be that there are different problems that all show the symptom; *this* problem reported here can only occur if you are using multiple threads (atleast for the ValueError; haven't looked into the crash at all). Yes, you can run multiple threads, and yes, you can use logging freely. However, you should not let the main thread just "run off". Instead, you should end your main thread with an explicit .join() operation on all threads it has created; those threads themselves should perform explicit .join() operations on all threads they create. That way, you can guarantee orderly shutdown. threading.py tries to do the joining if you don't, but fails (and the approach it uses is inherently error-prone). |
I cannot reproduce the crash with the example given, neither with the released binaries, nor with any of the trunk or release25-maint subversion branches. Therefore, I declare that this report is only about the ValueError; if anybody has a way to provoke a crash in a reproducable way, please submit it as a separate report, along with precise instructions on how to provoke the crash. |
Thanks again for the report. This is now fixed in r53249 and r53250. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: