Subject: | Apache::Session::Store::File does not flush buffers which can lead to corrupt sessions |
We are getting errors like "Session could not be unserialized at
/usr/local/stow/perl-5.8.8/lib/perl5/site_perl/5.8.8/Apache/Session/Serialize/Storable.pm
line 28" when two processes accessed the same session.
What was happening is that the second process was reading a partial
49152 byte file when the first process had written a 53307 byte
serialized file. Once the first process finished, the file would be its
full size. I am guessing that the 48K is a buffer size and that some of
the serialized value is buffered in the first process.
Adding a flush after the print fixes the problem. I used the IO::Handle
flush() method. It would also work to enable autoflush() on the handle.