View Issue Details

IDProjectCategoryView StatusLast Update
0015552phpList 3 applicationBatch Processingpublic21-06-18 13:05
Reporterroadster31 Assigned To 
Status resolvedResolutionno change required 
PlatformLAMPOSDon't k now 
Product Version2.10.12 
Target Versionnext major 
Summary0015552: mySQL Database link maybe lost if mail->send() takes some time
DescriptionmySQL database connection is lost when PhpListMailer->send() call takes time.
Steps To ReproducePut a timeout greater than the max lifetime of your mySQL connection just before parent::Send(); in class.phplistmailer.php
Additional InformationSending the mail (using PhpListMailer->send() method) may take some time. Depending on mySQL configuration, the mySQL link maybe closed during mail sending.

When the mail is finally sent, the database link is broken, and the DB could no longer be updated. The result is often a "stalled" massage queue, and some minor inconsistencies in phplist DB.

My solution: close the DB connection juste before parent::Send(); Here is a quick fix for mysql only:

    // close DB connection

    $res = parent::Send();

    // Reconnect to DB
    global $database_host, $database_user, $database_password, $database_name;

    $db = mysql_connect($database_host, $database_user, $database_password, true); // true is important, as it forces a reconnection

    if ($db)
        $lnk = mysql_select_db($database_name, $db);

        if (! $lnk)
            die("mysql_select_db failed: ".mysql_error());

    if(!$res) {

The loop around user IDs should be modified in processqueue.php, as Sql_fetch_row($userids) will fail if db connection is refreshed.

  $arrids = array();
  while ($userdata = Sql_fetch_row($userids)) {
        $arrids[] = $userdata;

  // Will failed if DB connection is refreshed
  // while ($userdata = Sql_fetch_row($userids)) {
  foreach($arrids as $userdata) {

My 2 cents.
TagsNo tags attached.


related to 0008905 resolveduser1822 Database error 2006 while doing query MySQL server has gone 



06-06-13 02:26

administrator   ~0052102

you can set a low SMTP_TIMEOUT