#315669 libcgi-session-perl: Session file not being written for driver:File; serializer:Storable

#315669#5
Date:
2005-06-24 15:49:15 UTC
From:
To:
No session file is being written for my sessions when using the Storable
driver. The following is the session initialisation:

$session = CGI::Session->new("driver:File;serializer:Storable",
$self->query, {Directory=>"/tmp"});

Where $self->query is a valid CGI object.

Many empty /tmp/cgisess_* files get created. Things work fine with the
Default serializer (except being able to save objects in the session,
which is what I want to do).

If I change /usr/share/perl5/CGI/Session/Serialize/Storable.pm to be:

sub freeze {
    my ($self, $data) = @_;

    warn "freezing($data)";
    my $frozen = Storable::freeze($data);
    warn "frozen";
    return $frozen;
}

The first warning is displayed, but not the second:
freezing(HASH(0x10fdaec0)) at /usr/share/perl5/CGI/Session/Serialize/Storable.pm line 14 during global destruction.

Seems to be something with Storable::freeze, but testing Storable::freeze separately works fine.

#315669#16
Date:
2008-05-22 03:35:01 UTC
From:
To:
Hi,

while trying to isolate the described bug, I found that what was
happening is that Storable is causing Perl to segfault. I don't know
why aren't you seeing it, but I can consistently reproduce it as
described in http://bugs.debian.org/482355

With this short snippet I can make it fail:

perl -e 'use CGI; use CGI::Session; my $cgi = new CGI(); our $session
=  CGI::Session->new("driver:file;serializer:storable", $cgi,
{Directory=>"/tmp"});'

I'd suggest, as a workaround, to force your CGI::Session object to be
destroyed before the program ends. Also, as documented, you should be
calling flush() explictly. So this should solve your problem by now:

$session->flush();
undef $session;


Cheers, Tincho.

#315669#19
Date:
2008-05-22 03:35:01 UTC
From:
To:
Hi,

while trying to isolate the described bug, I found that what was
happening is that Storable is causing Perl to segfault. I don't know
why aren't you seeing it, but I can consistently reproduce it as
described in http://bugs.debian.org/482355

With this short snippet I can make it fail:

perl -e 'use CGI; use CGI::Session; my $cgi = new CGI(); our $session
=  CGI::Session->new("driver:file;serializer:storable", $cgi,
{Directory=>"/tmp"});'

I'd suggest, as a workaround, to force your CGI::Session object to be
destroyed before the program ends. Also, as documented, you should be
calling flush() explictly. So this should solve your problem by now:

$session->flush();
undef $session;


Cheers, Tincho.

#315669#24
Date:
2010-12-18 23:37:51 UTC
From:
To:
I notice that a 4.43 o CGI::Session has been released. That should get
into Debian in due course. Reviewing the Debian bug list I noticed this:

"Session file not being written for driver:File; serializer:Storable"
(http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=315669)

That appears to be related to #482355
"Storable.pm segfaults when called during global destruction"

And from my brief reading of the bug reports this seems to be related to
design/backwards compatibility issues
in both CGI::Session and Storable. Can I conclude from that, that the
best thing to do with #315669
would be to mark it "wontfix" and to suggest that people bother by the
bug try Data::Session (which would of course will need to be packaged)?



cgiapp-request@lists.erlbaum.net wrote: