<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet href="http://bugs.horde.org/themes/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, 21 Aug 2008 19:44:16 -0400</pubDate>
  <link>http://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="http://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['auth']['params']['persi</title>
   <description>auth config is as follows:

$conf['auth']['params']['persistent'] = false;
$conf['auth']['params']['username'] = 'horde';
$conf['auth']['params']['password'] = '*****';
$conf['auth']['params']['hostspec'] = 'mysql';
$conf['auth']['params']['port'] = 3306;
$conf['auth']['params']['protocol'] = 'tcp';
$conf['auth']['params']['database'] = 'postfix';
$conf['auth']['params']['charset'] = 'iso-8859-1';
$conf['auth']['params']['phptype'] = 'mysql';
$conf['auth']['params']['driverconfig'] = 'custom';
$conf['auth']['params']['table'] = 'mailbox';
$conf['auth']['params']['username_field'] = 'username';
$conf['auth']['params']['password_field'] = 'password';
$conf['auth']['params']['encryption'] = 'crypt-md5';
$conf['auth']['params']['show_encryption'] = false;
$conf['auth']['driver'] = 'sql';

session config:

$conf['sessionhandler']['params']['persistent'] = true;
$conf['sessionhandler']['params']['rowlocking'] = true;
$conf['sessionhandler']['params']['port'] = 3306;
$conf['sessionhandler']['params']['protocol'] = 'tcp';
$conf['sessionhandler']['params']['hostspec'] = 'mysql';
$conf['sessionhandler']['params']['username'] = 'horde';
$conf['sessionhandler']['params']['password'] = '*****';
$conf['sessionhandler']['params']['database'] = 'horde';
$conf['sessionhandler']['type'] = 'mysql';

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 = '***************' AND session_lastmodified &gt; 1209657252 FOR UPDATE
                    186 Init DB     postfix
                    186 Init DB     postfix
                    186 Query       SELECT name FROM mailbox WHERE username=''
                    186 Init DB     postfix
                    186 Init DB     postfix
                    186 Query       SELECT name FROM mailbox WHERE username=''
                    186 Query       DELETE FROM horde_sessionhandler WHERE session_id = '***************'
                    186 Query       ROLLBACK
                    186 Init DB     postfix
                    186 Init DB     postfix
                    186 Query       SELECT name FROM mailbox WHERE username=''
                    186 Init DB     postfix
                    186 Init DB     postfix
                    186 Query       SELECT name FROM mailbox WHERE username=''
                    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 'horde'@'example.org' for table 'horde_sessionhandler' [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 04:37:14 -0400</pubDate>
   <link>http://bugs.horde.org/ticket/6673#t45092</link>
  </item>
  <item>
   <title>Is it even the auth driver causing this? I don't see a query</title>
   <description>Is it even the auth driver causing this? I don'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 13:26:50 -0400</pubDate>
   <link>http://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 13:45:44 -0400</pubDate>
   <link>http://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 13:56:55 -0400</pubDate>
   <link>http://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 16:49:19 -0400</pubDate>
   <link>http://bugs.horde.org/ticket/6673#t45150</link>
  </item>
  <item>
   <title>We can pass a 'new_link' parameter to PEAR::DB's mysql drive</title>
   <description>We can pass a 'new_link' parameter to PEAR::DB's mysql driver. Would that help?</description>
   <pubDate>Fri, 23 May 2008 15:15:00 -0400</pubDate>
   <link>http://bugs.horde.org/ticket/6673#t45498</link>
  </item>
  <item>
   <title>I'm not sure how that would help, because we would have to a</title>
   <description>I'm not sure how that would help, because we would have to add this to all DB::connect() calls, and we actually don't want them open new connections.</description>
   <pubDate>Mon, 02 Jun 2008 18:25:23 -0400</pubDate>
   <link>http://bugs.horde.org/ticket/6673#t45838</link>
  </item>
  <item>
   <title>I guess I'm not sure how DB is supposed to know _not_ to reu</title>
   <description>I guess I'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 19:55:46 -0400</pubDate>
   <link>http://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'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't do all database operation sequentially. But we can'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 05:03:57 -0400</pubDate>
   <link>http://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's what we should do in the session handler too.</description>
   <pubDate>Fri, 13 Jun 2008 05:08:55 -0400</pubDate>
   <link>http://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 17:29:30 -0400</pubDate>
   <link>http://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 17:32:50 -0400</pubDate>
   <link>http://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 17:33:04 -0400</pubDate>
   <link>http://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 07:36:40 -0400</pubDate>
   <link>http://bugs.horde.org/ticket/6673#t46552</link>
  </item>
  

 </channel>
</rss>
