<?xml version="1.0" encoding="UTF-8"?> 
<?xml-stylesheet href="https://dev.horde.org/themes/horde//default/feed-rss.xsl" type="text/xsl"?> 
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> 
 <channel> 
  <title>horde not switching db correctly using horde sql session storage and mysql authentication with persistent connections</title> 
  <pubDate>Thu, 09 Apr 2026 16:01:11 +0000</pubDate> 
  <link>https://bugs.horde.org/ticket/6673</link> 
  <atom:link rel="self" type="application/rss+xml" title="horde not switching db correctly using horde sql session storage and mysql authentication with persistent connections" href="https://bugs.horde.org/ticket/6673/rss" /> 
  <description>horde not switching db correctly using horde sql session storage and mysql authentication with persistent connections</description> 
 
   
   
  <item> 
   <title>auth config is as follows:



$conf[&#039;auth&#039;][&#039;params&#039;][&#039;persi</title> 
   <description>auth config is as follows:



$conf[&#039;auth&#039;][&#039;params&#039;][&#039;persistent&#039;] = false;

$conf[&#039;auth&#039;][&#039;params&#039;][&#039;username&#039;] = &#039;horde&#039;;

$conf[&#039;auth&#039;][&#039;params&#039;][&#039;password&#039;] = &#039;*****&#039;;

$conf[&#039;auth&#039;][&#039;params&#039;][&#039;hostspec&#039;] = &#039;mysql&#039;;

$conf[&#039;auth&#039;][&#039;params&#039;][&#039;port&#039;] = 3306;

$conf[&#039;auth&#039;][&#039;params&#039;][&#039;protocol&#039;] = &#039;tcp&#039;;

$conf[&#039;auth&#039;][&#039;params&#039;][&#039;database&#039;] = &#039;postfix&#039;;

$conf[&#039;auth&#039;][&#039;params&#039;][&#039;charset&#039;] = &#039;iso-8859-1&#039;;

$conf[&#039;auth&#039;][&#039;params&#039;][&#039;phptype&#039;] = &#039;mysql&#039;;

$conf[&#039;auth&#039;][&#039;params&#039;][&#039;driverconfig&#039;] = &#039;custom&#039;;

$conf[&#039;auth&#039;][&#039;params&#039;][&#039;table&#039;] = &#039;mailbox&#039;;

$conf[&#039;auth&#039;][&#039;params&#039;][&#039;username_field&#039;] = &#039;username&#039;;

$conf[&#039;auth&#039;][&#039;params&#039;][&#039;password_field&#039;] = &#039;password&#039;;

$conf[&#039;auth&#039;][&#039;params&#039;][&#039;encryption&#039;] = &#039;crypt-md5&#039;;

$conf[&#039;auth&#039;][&#039;params&#039;][&#039;show_encryption&#039;] = false;

$conf[&#039;auth&#039;][&#039;driver&#039;] = &#039;sql&#039;;



session config:



$conf[&#039;sessionhandler&#039;][&#039;params&#039;][&#039;persistent&#039;] = true;

$conf[&#039;sessionhandler&#039;][&#039;params&#039;][&#039;rowlocking&#039;] = true;

$conf[&#039;sessionhandler&#039;][&#039;params&#039;][&#039;port&#039;] = 3306;

$conf[&#039;sessionhandler&#039;][&#039;params&#039;][&#039;protocol&#039;] = &#039;tcp&#039;;

$conf[&#039;sessionhandler&#039;][&#039;params&#039;][&#039;hostspec&#039;] = &#039;mysql&#039;;

$conf[&#039;sessionhandler&#039;][&#039;params&#039;][&#039;username&#039;] = &#039;horde&#039;;

$conf[&#039;sessionhandler&#039;][&#039;params&#039;][&#039;password&#039;] = &#039;*****&#039;;

$conf[&#039;sessionhandler&#039;][&#039;params&#039;][&#039;database&#039;] = &#039;horde&#039;;

$conf[&#039;sessionhandler&#039;][&#039;type&#039;] = &#039;mysql&#039;;



mysql query log shows:



080501 17:18:12     186 Connect     horde@example.org on 

                    186 Init DB     horde

                    186 Query       START TRANSACTION

                    186 Query       SELECT session_data FROM horde_sessionhandler WHERE session_id = &#039;***************&#039; AND session_lastmodified &gt; 1209657252 FOR UPDATE

                    186 Init DB     postfix

                    186 Init DB     postfix

                    186 Query       SELECT name FROM mailbox WHERE username=&#039;&#039;

                    186 Init DB     postfix

                    186 Init DB     postfix

                    186 Query       SELECT name FROM mailbox WHERE username=&#039;&#039;

                    186 Query       DELETE FROM horde_sessionhandler WHERE session_id = &#039;***************&#039;

                    186 Query       ROLLBACK

                    186 Init DB     postfix

                    186 Init DB     postfix

                    186 Query       SELECT name FROM mailbox WHERE username=&#039;&#039;

                    186 Init DB     postfix

                    186 Init DB     postfix

                    186 Query       SELECT name FROM mailbox WHERE username=&#039;&#039;

                    186 Query       REPLACE INTO horde_sessionhandler (session_id, session_data



login fails with following logged by horde:



horde[22401]: [horde] Error writing session data: INSERT,DELETE command denied to user &#039;horde&#039;@&#039;example.org&#039; for table &#039;horde_sessionhandler&#039; [on line 147 of &quot;/usr/share/horde/lib/Horde/SessionHandler/mysql.php&quot;]



changing to non-persistent db connections fixes the issue</description> 
   <pubDate>Fri, 02 May 2008 08:37:14 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6673#t45092</link> 
  </item> 
   
  <item> 
   <title>Is it even the auth driver causing this? I don&#039;t see a query</title> 
   <description>Is it even the auth driver causing this? I don&#039;t see a query in the auth driver that would result in &quot;SELECT name ...&quot;.



Either way, ugh. We call mysql_select_db when we open the connection (or get back the persistent connection). We could call _open inside _write, or just mysql_select_db, or we could force the use of non-persistent connections. Thoughts?</description> 
   <pubDate>Fri, 02 May 2008 17:26:50 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6673#t45122</link> 
  </item> 
   
  <item> 
   <title>This looks like a bug in DB to me, since it seems to be reus</title> 
   <description>This looks like a bug in DB to me, since it seems to be reusing the mysql handle even though DB::connect is called with different parameters than the current handle (as opened by the sessions handler).</description> 
   <pubDate>Fri, 02 May 2008 17:45:44 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6673#t45132</link> 
  </item> 
   
  <item> 
   <title>The mysql session handler backend uses the mysql_* functions</title> 
   <description>The mysql session handler backend uses the mysql_* functions directly.</description> 
   <pubDate>Fri, 02 May 2008 17:56:55 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6673#t45139</link> 
  </item> 
   
  <item> 
   <title>Yes, but it creates the mysql handle before DB. So DB seems </title> 
   <description>Yes, but it creates the mysql handle before DB. So DB seems to reuse it.</description> 
   <pubDate>Fri, 02 May 2008 20:49:19 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6673#t45150</link> 
  </item> 
   
  <item> 
   <title>We can pass a &#039;new_link&#039; parameter to PEAR::DB&#039;s mysql drive</title> 
   <description>We can pass a &#039;new_link&#039; parameter to PEAR::DB&#039;s mysql driver. Would that help?</description> 
   <pubDate>Fri, 23 May 2008 19:15:00 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6673#t45498</link> 
  </item> 
   
  <item> 
   <title>I&#039;m not sure how that would help, because we would have to a</title> 
   <description>I&#039;m not sure how that would help, because we would have to add this to all DB::connect() calls, and we actually don&#039;t want them open new connections.</description> 
   <pubDate>Mon, 02 Jun 2008 22:25:23 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6673#t45838</link> 
  </item> 
   
  <item> 
   <title>I guess I&#039;m not sure how DB is supposed to know _not_ to reu</title> 
   <description>I guess I&#039;m not sure how DB is supposed to know _not_ to reuse an existing connection without that parameter, though.</description> 
   <pubDate>Mon, 02 Jun 2008 23:55:46 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6673#t45840</link> 
  </item> 
   
  <item> 
   <title>I thought it would check if a mysql connection exists alread</title> 
   <description>I thought it would check if a mysql connection exists already and whether is uses the same database as specified in the DB::connect() call. But that&#039;s probably a bit too much magic. Instead it calls mysql_connect() and uses the new_link parameter for that if specified.



This opens a whole can of worms though, because there could be a lot of other places where we don&#039;t do all database operation sequentially. But we can&#039;t simply request a new link in each SQL driver. That could easily open a dozen connections per request.</description> 
   <pubDate>Fri, 13 Jun 2008 09:03:57 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6673#t46390</link> 
  </item> 
   
  <item> 
   <title>Scratch that, DB *is* selecting the database before each que</title> 
   <description>Scratch that, DB *is* selecting the database before each query (I could have notice that from the many Init DB logs), so that&#039;s what we should do in the session handler too.</description> 
   <pubDate>Fri, 13 Jun 2008 09:08:55 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6673#t46392</link> 
  </item> 
   
  <item> 
   <title>Changes have been made in CVS for this ticket:

http://cvs.h</title> 
   <description>Changes have been made in CVS for this ticket:

http://cvs.horde.org/diff.php/framework/SessionHandler/SessionHandler/mysql.php?r1=1.44&amp;r2=1.45&amp;ty=u
http://cvs.horde.org/diff.php/horde/docs/CHANGES?r1=1.1107&amp;r2=1.1108&amp;ty=u</description> 
   <pubDate>Fri, 13 Jun 2008 21:29:30 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6673#t46440</link> 
  </item> 
   
  <item> 
   <title>Should be set with this commit.</title> 
   <description>Should be set with this commit.</description> 
   <pubDate>Fri, 13 Jun 2008 21:32:50 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6673#t46441</link> 
  </item> 
   
  <item> 
   <title>... and will be Horde 3.2.1.</title> 
   <description>... and will be Horde 3.2.1.</description> 
   <pubDate>Fri, 13 Jun 2008 21:33:04 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6673#t46442</link> 
  </item> 
   
  <item> 
   <title>applied fix and issue is resolved.



Many thanks,



Rob</title> 
   <description>applied fix and issue is resolved.



Many thanks,



Rob</description> 
   <pubDate>Mon, 16 Jun 2008 11:36:40 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6673#t46552</link> 
  </item> 
   
   
 
 </channel> 
</rss> 
