Re: [Cgi-session-user] session data not being saved till flushed.
Brought to you by:
sherzodr
From: Mark S. <ma...@su...> - 2006-02-13 01:31:26
|
On Sat, Feb 11, 2006 at 11:30:47PM -0500, James.Q.L wrote: > HI, > > I am using C::S 4.03 and the session data is not saved unless i call flush(). The doc claims > otherwise, "Normally it will be called for you just before the program terminates, or session > object goes out of scope, so you should never have to flush() on your own." Hello James, There are now several bug reports filed about related behavior, including one I filed myself just a few days ago: http://rt.cpan.org/Public/Bug/Display.html?id=17541 This much is clear: - For some people flush() used to happen automatically with 3.95, but quit working with 4.00 (and still isn't fixed in 4.03). - It's possible for third party modules to break the automatic flush() behavior, which I've confirmed myself. This can happen by creating a circular reference, so that the DESTROY method isn't invoked as expected. My proposal to address the situation is quit relying on flush() happen automatically, and recommend that people use an explicit flush() instead, which works reliably for everyone. That's what I'm doing. Actually, since I use CGI::Application, I just call flush() in teardown() and forget about it the rest of the time. This currently does have some overhead because it means that a session ma created at that moment so that flush() can be called on it! New functionality may be added to the Session plugin to address that. I have commit and release access for the CGI::Session project, but I wanted to get feedback from other people on the issue before proceeding. I know these flush() issues can be frustrating and time consuming to trackdown, so I'd like to address it soon. Mark |