Bug Tracker item #2799179, was opened at 2009-05-31 20:51
Message generated for change (Comment added) made by paulcockings
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1126467&aid=2799179&group_id=250683

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Paul Cockings (paulcockings)
Assigned to: Nobody/Anonymous (nobody)
Summary: Automatically reconnect to mysql

Initial Comment:
bug reported by Alexander Prinsier ( aphexer ) - 2009-01-02 22:10
dspam-community # 2482934

When no email has been received for a while, the mysql connection get's
closed by the mysql server because of a timeout.

Dspam should detect this and reconnect automatically.

The current fix is to restart dspam each hour or so, to avoid getting near
the timeout.

The bug is in debian's 3.6.8-9 version, I'm not sure it has been fixed
since.

----------------------------------------------------------------------

Comment By: Paul Cockings (paulcockings)
Date: 2009-05-31 20:52

Message:
Comment Imported:
Date: 2009-01-09 17:44
Sender: aphexer


Thank you!

Alot of patches from gentoo are already merged into the current
repository. When someone verifies this patch is included with those, I can
close this one.

Alexander

----------------------------------------------------------------------

Comment By: Paul Cockings (paulcockings)
Date: 2009-05-31 20:52

Message:
Comment imported:
Date: 2009-01-09 17:37
Sender: steeeeeveee


Hallo Alexander

This issue has been fixed in the Gentoo build. Search the web for
dspam-3.8.0-patches-20080913.tar.gz and the patch is called
patches/23_all_mysql-reconnect.patch

The patch resulted from this message here:
http://forums.gentoo.org/viewtopic-p-4267538.html#4267538

Here the patch:
---cut-here-start---
diff -Nru dspam-3.8.0.orig/doc/mysql_drv.txt dspam-3.8.0/doc/mysql_drv.txt
--- dspam-3.8.0.orig/doc/mysql_drv.txt 2006-05-13 04:12:58.000000000
+0300
+++ dspam-3.8.0/doc/mysql_drv.txt 2007-11-20 23:59:00.000000000
+0200
@@ -127,6 +127,11 @@
MySQLPass changeme
MySQLDb dspam
MySQLCompress true
+MySQLReconnect true
+
+If you are using MySQL >= 5.0.13 and have problems with DSPAM dropping
the
+connection to your MySQL instance, then set MySQLReconnect to true to
allow
+the mysql_drv to try to re-establish stale and/or dead connections.

Or if you'd like to connect via TCP, use the IP address and port of the
MySQL server. DSPAM checks to see if the first character of the HOSTNAME
field
diff -Nru dspam-3.8.0.orig/src/dspam.conf.in dspam-3.8.0/src/dspam.conf.in
--- dspam-3.8.0.orig/src/dspam.conf.in 2007-11-20 23:24:28.000000000
+0200
+++ dspam-3.8.0/src/dspam.conf.in 2007-11-20 23:59:00.000000000
+0200
@@ -304,6 +304,7 @@
#MySQLPass changeme
#MySQLDb dspam
#MySQLCompress true
+#MySQLReconnect true

# If you are using replication for clustering, you can also specify a
separate
# server to perform all writes to.
@@ -314,6 +315,7 @@
#MySQLWritePass changeme
#MySQLWriteDb dspam_write
#MySQLCompress true
+#MySQLReconnect true

# If your replication isn't close to real-time, your retraining might
fail if
# the signature isn't found. One workaround for this is to use the write
@@ -485,6 +487,7 @@
#MySQLPass.DECAlpha changeme
#MySQLDb.DECAlpha dspam
#MySQLCompress.DECAlpha true
+#MySQLReconnect.DECAlpha true
#
#Profile Sun420R
#MySQLServer.Sun420R 10.0.0.2
@@ -493,6 +496,7 @@
#MySQLPass.Sun420R changeme
#MySQLDb.Sun420R dspam
#MySQLCompress.Sun420R false
+#MySQLReconnect.Sun420R true
#
#DefaultProfile DECAlpha

diff -Nru dspam-3.8.0.orig/src/mysql_drv.c dspam-3.8.0/src/mysql_drv.c
--- dspam-3.8.0.orig/src/mysql_drv.c 2006-09-21 21:25:19.000000000
+0300
+++ dspam-3.8.0/src/mysql_drv.c 2007-11-20 23:59:00.000000000 +0200
@@ -2489,6 +2489,16 @@
goto FAILURE;
}

+#if MYSQL_VERSION_ID >= 50013
+ /* enable automatic reconnect for MySQL >= 5.0.13 */
+ snprintf(attrib, sizeof(attrib), "%sReconnect", prefix);
+ if (_ds_match_attribute(CTX->config->attributes, attrib, "true"))
+ {
+ my_bool reconnect = 1;
+ mysql_options(dbh, MYSQL_OPT_RECONNECT, &reconnect);
+ }
+#endif
+
if (hostname[0] == '/')
{
if (!mysql_real_connect (dbh, NULL, user, password, db, 0, hostname,
---cut-here-end---


Kind Regards from Switzerland

Steve


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1126467&aid=2799179&group_id=250683

------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
_______________________________________________
Dspam-devel mailing list
Dspam-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dspam-devel

Reply via email to