#485 Session Locks

closed-rejected
nobody
None
5
2011-06-20
2009-11-18
Greg Roach
No

Only one PHP script can run at a time. For example, open two tabs. In the first, run the query

SELECT SLEEP(60);

Now attempt to do something in the second tab. Nothing happens until the first query has completed. This is (almost certainly) caused by session locks. PHP maintains a lock on each session (whether file-based session storage or otherwise). This is to prevent two scripts writing to the session store concurrently.

If a script knows that it has finished writing to the $_SESSION superglobal, it can explicitly release the lock. This will allow other scripts to run in parallel.

It is possible that PMA is setting session variables *after* processing (potentially lengthy) SQL operations. If so, it needs to be refactored to set them earlier in the processing.

The fix for this is to add a call to session_write_close() at a suitable point, early in the processing.

Discussion

  • Herman van Rink

    Herman van Rink - 2009-11-19

    In the navigation frame and several other places session_write_close() is already used.

    Other useful point could probably be found, so if you have any concrete location where you would want this to happen please feel free to specify or post a patch.

     
  • Greg Roach

    Greg Roach - 2009-12-16

    Prevent session locking during lengthy SQL queries.

     
  • Greg Roach

    Greg Roach - 2009-12-16

    Try this. It works for me!

     
  • Marc Delisle

    Marc Delisle - 2009-12-16
    • milestone: 980162 -->
    • labels: 940926 -->
     
  • Marc Delisle

    Marc Delisle - 2009-12-16

    Moved to patches.

     
  • Marc Delisle

    Marc Delisle - 2009-12-16
    • assigned_to: nobody --> lem9
     
  • Marc Delisle

    Marc Delisle - 2009-12-16

    Greg,
    I tried your patch in the QA_3_2 branch (future 3.2.5 version); it applies correctly but does not produce the intended effect.

    How do you run the SELECT SLEEP(60) query ?

     
  • Marc Delisle

    Marc Delisle - 2009-12-16
    • status: open --> pending
     
  • Greg Roach

    Greg Roach - 2009-12-16

    Oops. Remove the ! from the if statement.

    I was playing with debug at the time, so this affected my testing :-(

     
  • Greg Roach

    Greg Roach - 2009-12-16
    • status: pending --> open
     
  • Marc Delisle

    Marc Delisle - 2009-12-17
    • summary: Session Locks --> (ok 3.2.5) Session Locks
    • priority: 5 --> 1
    • status: open --> open-accepted
     
  • Marc Delisle

    Marc Delisle - 2009-12-17

    Merged in subversion, thanks.

     
  • Marc Delisle

    Marc Delisle - 2010-01-10
    • status: open-accepted --> closed-accepted
     
  • Marc Delisle

    Marc Delisle - 2010-04-04
    • priority: 1 --> 5
    • status: closed-accepted --> open-accepted
     
  • Marc Delisle

    Marc Delisle - 2010-04-04
    • summary: (ok 3.2.5) Session Locks --> Session Locks
    • assigned_to: lem9 --> nobody
    • status: open-accepted --> open
     
  • Michal Čihař

    Michal Čihař - 2011-06-06

    As this patch is causing troubles and there has been no progress in last year, I'm closing this issue. The proper solution will have to re-acquire lock at the end of session to save history and other possible changes.

     
  • Michal Čihař

    Michal Čihař - 2011-06-06
    • status: open --> pending-rejected
     
  • SourceForge Robot

    • status: pending-rejected --> closed-rejected
     
  • SourceForge Robot

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks