6.0.0-beta1
7/18/25

[#10978] Issue viewing sessions when using MySQL/PDO Driver
Summary Issue viewing sessions when using MySQL/PDO Driver
Queue Horde Base
Queue Version 4.0.13
Type Bug
State Resolved
Priority 1. Low
Owners
Requester it (at) wenn (dot) com
Created 02/10/2012 (4907 days ago)
Due
Updated 02/20/2012 (4897 days ago)
Assigned
Resolved 02/10/2012 (4907 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
02/20/2012 01:49:49 PM it (at) wenn (dot) com Comment #9 Reply to this comment

[Show Quoted Text - 18 lines]
It seems to be started in a different file to that you have listed.

SessionHandler/Storage/Stack.php

The read method in that file that i can get a clear time reading that 
shows it locking up.
Ive worked out that there are two storage objects, memcached & sql.
The time seems to be sticking on the Memcached driver.

SessionHandler/Storage/Memcache.php # line 91 - $this->_memcache->lock($id);

02/17/2012 05:57:59 PM Jan Schneider Comment #8 Reply to this comment

[Show Quoted Text - 14 lines]
This shouldn't happen. Can you track it further down into 
SessionHandler/Storage/Sql.php inside the read() method? Is it 
transactionStarted(), beginDbTransaction() or selectValue()?
02/12/2012 03:24:52 PM Git Commit Comment #7 Reply to this comment
Changes have been made in Git (develop):

commit 788a5259f75d697d4bab5cd3c69f7660176a9316
Author: Jan Schneider <jan@horde.org>
Date:   Fri Feb 10 18:51:27 2012 +0100

     [jan] Don't start transaction more than once in SQL driver (Bug #10978).

  .../lib/Horde/SessionHandler/Storage/Sql.php       |    4 +++-
  framework/SessionHandler/package.xml               |    4 ++--
  2 files changed, 5 insertions(+), 3 deletions(-)

http://git.horde.org/horde-git/-/commit/788a5259f75d697d4bab5cd3c69f7660176a9316
02/10/2012 07:22:13 PM it (at) wenn (dot) com Comment #6 Reply to this comment
Without my patch the sessions page takes 9 seconds to open up, with
my patch it takes under 1 second to open up.
It's still the wrong patch. You need to find out where it's spending 
the additional time.
Ive narrowed down the problem.

Horde/SessionHandler.php:177
It will hang on this call though to the DB read call but only if 
userid is equal to the currently logged on userid. This was confimed 
by putting a continue on a loop if id matched session_id;
So maybe it seems that you are still holding a row readlock open on 
the session table of the user.

02/10/2012 06:20:04 PM Jan Schneider Comment #5 Reply to this comment
Without my patch the sessions page takes 9 seconds to open up, with 
my patch it takes under 1 second to open up.
It's still the wrong patch. You need to find out where it's spending 
the additional time.
02/10/2012 06:01:43 PM it (at) wenn (dot) com Comment #4 Reply to this comment
Thanks put putting the patch in the correct place but it seems it does 
not fix the problem very well.

While your patch does stop the error from being created the page load 
time is very very slow.
Without my patch the sessions page takes 9 seconds to open up, with my 
patch it takes under 1 second to open up.

02/10/2012 05:52:39 PM Jan Schneider State ⇒ Resolved
 
02/10/2012 05:52:17 PM Git Commit Comment #3 Reply to this comment
Changes have been made in Git (master):

commit 788a5259f75d697d4bab5cd3c69f7660176a9316
Author: Jan Schneider <jan@horde.org>
Date:   Fri Feb 10 18:51:27 2012 +0100

     [jan] Don't start transaction more than once in SQL driver (Bug #10978).

  .../lib/Horde/SessionHandler/Storage/Sql.php       |    4 +++-
  framework/SessionHandler/package.xml               |    4 ++--
  2 files changed, 5 insertions(+), 3 deletions(-)

http://git.horde.org/horde-git/-/commit/788a5259f75d697d4bab5cd3c69f7660176a9316
02/10/2012 05:44:24 PM Jan Schneider Comment #2
Patch ⇒ No
Priority ⇒ 1. Low
Reply to this comment
Ive attached a patch file to fix. Seems that you are not closing the 
transaction just after you retrieve all the the SessionIDs, 
afterwards you then have to do lots more reads.
This is exactly what's the driver is supposed to do. The transaction 
is commited when writing the session information at the request's end.
02/10/2012 03:15:37 PM it (at) wenn (dot) com Comment #1
Priority ⇒ 3. High
Type ⇒ Bug
Summary ⇒ Issue viewing sessions when using MySQL/PDO Driver
Queue ⇒ Horde Base
Milestone ⇒
Patch ⇒ Yes
New Attachment: horde.patch Download
State ⇒ Unconfirmed
Reply to this comment
When we view the Administrations->Sessions the page comes up with an error.

--horde.log--
2012-02-10T12:58:08+00:00 EMERG: HORDE [horde] There is already an 
active transaction [pid 28447 on line 644 of 
"/home/httpd/live/webmail.wenn.com/htdocs/pear/php/Horde/Db/Adapter/Base.php"]

--weboutput--
A fatal error has occurred
There is already an active transaction
1. Horde_SessionHandler->getSessionsInfo() 
/home/httpd/live/webmail/htdocs/admin/sessions.php:29
2. Horde_SessionHandler->read() 
/home/httpd/live/webmail/htdocs/pear/php/Horde/SessionHandler.php:275
3. Horde_SessionHandler_Storage_Stack->read() 
/home/httpd/live/webmail/htdocs/pear/php/Horde/SessionHandler.php:177
4. Horde_SessionHandler_Storage_Sql->read() 
/home/httpd/live/webmail/htdocs/pear/php/Horde/SessionHandler/Storage/Stack.php:88
5. Horde_Db_Adapter_Base->beginDbTransaction() 
/home/httpd/live/webmail/htdocs/pear/php/Horde/SessionHandler/Storage/Sql.php:91
6. PDO->beginTransaction() 
/home/httpd/live/webmail.wenn.com/htdocs/pear/php/Horde/Db/Adapter/Base.php:644

This error does not happen straight away after you login, it happens 
after you have gone though a few pages.
The issue does not seem to happen if i use the MySQLi driver instead 
of the PDO.

Things to note, we are running horde sessions in MySQL due to having a 
HAproxy LB setup.

Ive attached a patch file to fix. Seems that you are not closing the 
transaction just after you retrieve all the the SessionIDs, afterwards 
you then have to do lots more reads.

Saved Queries