Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Re: Re: Apache Session problem after update

by perrin (Chancellor)
on Oct 05, 2003 at 04:03 UTC ( [id://296640]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Apache Session problem after update
in thread Apache Session problem after update

Hmmm, CPAN usually only tries to upgrade Perl when you attempt to install a module that has a version in the core libraries later than the version on your system. Maybe you were running a really old Perl with no File::Spec? Not sure.

This version of Perl may have broken binary compatibility with older versions. I'm not certain about that, but if it did you would have to reinstall DBI and DBD::mysql before they will work again. Try that.

  • Comment on Re: Re: Re: Apache Session problem after update

Replies are listed 'Best First'.
Re: Re: Re: Re: Apache Session problem after update
by mkenney (Beadle) on Oct 05, 2003 at 14:05 UTC
    I was running 5.6.1 before, I don't know if it had File::Spec.

    I did have to re-install DBI and DBD::mysql. They appear to be working, I can issue queries, add rows and everything I could do before. Its just when Apache::Session tries that things blow up. I'm tempted to re-install perl????

    Mark
      At this point I would put in some debug statements or run your script in the debugger to find out exactly what is failing.
Re: Re: Re: Re: Apache Session problem after update
by mkenney (Beadle) on Oct 06, 2003 at 05:35 UTC
    The suggestion for debug running has lead me to some wierd results. It ran fine??? I have re-built perl and all modules. I have traced it done to one problem. I'm going to include the code. I'm sure that I'm really understanding the problem, but can tell you all the symptoms.

    On the line:

    $sth->bind_param(1,$session{snmember});

    If I use a hard plug such as:

    $sth->bind_param(1,"*");

    Everything works fine. Otherwise I get no update to the session data and the error message of:

    (in cleanup) Can't call method "prepare_cached" on unblessed reference at /usr/local/lib/perl5/site_perl/5.8.1/Apache/Session/Lock/MySQL.pm line 69 during global destruction.
    (in cleanup) Can't call method "acquire_write_lock" on an undefined value at /usr/local/lib/perl5/site_perl/5.8.1/Apache/Session.pm line 569 during global destruction.

    The query has even run succesfully for both the session handle and the bchoices handle ($dbs and $dbh). It will not update the session data during that crash though. I'm sure I'm missing something with my ugly code that you guys will spot right a way (and probably make me have to fix thousands of line of code I've messed up in the long run :-)

    Thanks again for all the help, I have included the stripped down test code below:

    Mark

    P.S. To test I have been running it once with no params and then the second time cutting and pasting the session_id as provided by the Output into the session_id=. This code has worked with no problems on 5.6.1 for over a year!

    #!/usr/bin/perl -w

    use strict;
    use warnings;
    use CGI ':standard',':html3','-no_xhtml';
    use DBI;
    use Apache::Session::MySQL;

    my ($database,$username,$password)=("dbi:mysql:bchoices:localhost","stdadmin","0i812");
    my $dbh = DBI->connect($database,$username,$password);
    my $dbs = DBI->connect("dbi:mysql:session:localhost",$username,$password);

    my %session;
    my $sess_id = param('session_id');

    tie %session, "Apache::Session::MySQL", $sess_id,
    {
    Handle => $dbs,
    LockHandle => $dbs
    };


    if (param('session_id'))
    {
    my $sth=$dbh->prepare("SELECT COUNT(?) as snemployer FROM member");
    $sth->bind_param(1,$session{snmember});
    $sth->execute();
    my $member=$sth->fetchrow_hashref();
    $sth->finish();
    print "Session Print 2:".$session{snmember}."-".$session{_session_id}."-".$session{test}."-".$member->{snemployer}."\n";
    $session{test}="HI There";
    }
    else
    {
    $session{snmember}="*";
    $session{test}="HI";
    print "Session_ID:".$session{_session_id}."\n";
    }

    print "Session Print 1:".$session{snmember}."\n";

    untie (%session);
      Try replacing your untie at the end with tied(%session)->save(). I think you might be having problems with the new randomization of the order of destruction in Perl 5.8.1.
        That got it working, same error but it does work now. I'm confused that I seem to be writing the most basic of code, and getting ghtese errors? I know it is not great code, ut is it that bad (you can say yes!!).

        Mark

        P.S. THANK_YOU THANK-YOU THANK-YOU!! I thank-you again for the time you have spent helping me!!
        Hi We are facing a similar problem in IIS, but using tied at the end fails the DB updates. COuld you please suggest on this.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://296640]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-04-18 09:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found