Greetings,
I've searched for CGI::Session problems, found quite a few, but not this particular one.

I've been using CGI::Session with CGI::Application successfully, but now trying to use mysql rather than files to store the data is causing problems.

I'm getting the following error
could not flush: Couldn't acquire lock on id '395c4f3fa5efe60d26082727de8bf6c7'. Lock status:  at Images.cgi line 0

The relevent bits of code are:
use strict; use warnings; use CGI::Session; use DBI; $datasource = 'dbi:mysql:database:hostname'; $user = 'username'; $pass = 'password'; $dbi = DBI->connect($datasource, $user, $pass, { ShowErrorStatement => 1, RaiseError => 1, PrintError => 1, AutoCommit => 0})); $session = new CGI::Session( "driver:MySQL", $sid, {Handle => $dbh} ));
I've tested logging into the database via a console and gaining a lock in the same way as CGI::Session::MySQL is doing select get_lock('unique', 10) and it succeeds ( so does release_lock.)

Does anyone know what's going wrong?

update:
I found this here:
I'm posting this so others may benefit from the clearing up of the confusion...
I was playing with a package to create MySQL tables, and the 'sessions' table created was not precisely as expected by CGI::Session.
- though it doesn't give any suggestions as to how to fix it.
I've dropped the table and recreated it using the exact code given in the CGI::Session docs, to no avail.

In reply to CGI::Session::MySQL lock problem by fireartist

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.