quetz-mod_python-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Gallacher <jg.li...@sympatico.ca>
Subject Re: release? FileSession.py
Date Sat, 30 Apr 2005 20:52:21 GMT
Nicolas Lehuen wrote:
> On 4/28/05, Nicolas Lehuen <nicolas.lehuen@gmail.com> wrote:
> 
>>On 4/27/05, dharana <dharana@dharana.net> wrote:
>>
>>>Jim Gallacher wrote:
>>>
>>>>Nicolas Lehuen wrote:
>>>>
>>>>[...]
>>>>
>>>>Attached is my latest and hopefully greatest. :)  This version uses the
>>>>grace_period idea to avoid race and/or deadlock issues and correctly
>>>>register the filesession_cleanup method to run at the end of a request.
>>
>>Thanks, I'll integrate this ASAP tomorrow morning (it's too late for now :).
> 
> 
> OK, this is done.
> 
> 
>>>>In the original code there was a comment (from dharana?) about a random
>>>>EOFError in the do_load method. I have not been able to reproduce this
>>>>error but I left the comment in anyway.
>>>
>>>No, it's not mine. I have yet to see it happen.
>>
>>It was mine. The bug is totally reproducible, on my machine at least.
>>I'll investigate this a little more tomorrow.
> 
> 
> Found it. It turns out that we need to open the session file in binary
> mode for reading and writing.
> 
> I've never really understood why, but on Win32 files can be opened in
> text mode, in which some control characters mean an EOF. If you try to
> write binary data in a text-mode file, and your binary data contains
> an EOF character, then you're out of luck. You have to open the file
> in binary mode, by adding an 'b' to the mode.
> 
> What lead to to find this was that when using the text-friendly
> pickling protocol 0, there was no problem. The bug only appeared when
> using the binary pickling protocol 2.
> 

Ah, yes. One of those cross-platform wrinkles. Glad the fix was simple.

Jim




Mime
View raw message