Bug #69060 [NEW]: PHP-CGI.EXE crashes in CLI when call mysqli_close() after a long period

From: Date: Mon, 16 Feb 2015 11:48:02 +0000
Subject: Bug #69060 [NEW]: PHP-CGI.EXE crashes in CLI when call mysqli_close() after a long period
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-190710@lists.php.net to get a copy of this message
From: julientld at free dot fr Operating system: Windows Server 2012 PHP version: 5.6.5 Package: CGI/CLI related Bug Type: Bug Bug description:PHP-CGI.EXE crashes in CLI when call mysqli_close() after a long period Description: ------------ Hello, Server: Windows Server 2012 IIS 8.0 PHP 5.6.5 MySQL 5.6.21 WinCache 1.3.x hMailserver 5.6 I send a newsletter every week to thousands of users with the mail() function. The PHP script runs in CLI mode. It runs about 8 hours long. Timeouts and other settings have been customized for this. All runs well, every body receives the mail. But I observe one error every week in the Windows Event Viewer saying php-cgi.exe has crashed at the end of the newsletter sending. The PHP log file shows a PHP Warning related to the mail() function which returns a 550 Unknown user error. In the SMTP server logs, in effect, I see that one of the last user which receives a mail at this hour (07:51:43) doesn't exists more. But, there are many other 550 errors during the sending and I don't see why this specific 550 error could be the cause. In fact, I think that mail is absolutely not related to this bug. At the end of the script I call the mysqli_close() function to close the MySQL connexion opened 8 hours earlier but the MySQL server has probably killed it for a very long time !!!!!! :) It is a bad conception of this code. I will modify it today to close the connexion before the mail sending where MySQL is no more used. But I just would like to notify you about this abnormal PHP error. I have a dump file for the php-cgi.exe crash. I have shown it to an MS expert which says me : "It appears to be a bug in the zend core, when printing debug messages on shutdown. I haven't got the exact mechanics of the bug, but what appears to have happened is that php_mysqli ran into an error while trying to shutdown. The process was in the middle of mysqli_close(), when it hit an error during a send on a socket. Looks like the php_mysqlnd (internal PHP extension) tries to send a command when shutting down. The extension failed to send, because the socket to the SQL server went away. All of this is fine and normal. However, the printing of the error message failed, due to some problem with memory allocation. Seems weird, and not something that should happen every time. It's an unfortunate side effect of a network failure during mysqli_close()." Test script: --------------- 1) MySQL selection of the recipients 2) In a loop (about 8 hours long): mail("user@domain.com","Subjet","Text","From: mail@domain.com\r\nContent-Type: text/html; charset=iso-8859-1"); 3) mysqli_close() <<<<------ I will now move it between phases 1) and 2) Expected result: ---------------- No errors in log files. Actual result: -------------- * WINDOWS EVENT VIEWER Nom de l’application défaillante php-cgi.exe, version : 5.6.5.0, horodatage : 0x54c04440 Nom du module défaillant : php5.dll, version : 5.6.5.0, horodatage : 0x54c04898 Code d’exception : 0xc0000005 Décalage d’erreur : 0x0004a838 ID du processus défaillant : 0xae8 Heure de début de l’application défaillante : 0x01d04973d362fdb0 Chemin d’accès de l’application défaillante : C:\php\php-cgi.exe Chemin d’accès du module défaillant: C:\php\php5.dll ID de rapport : 441a03a1-b5a8-11e4-9410-90b11c2fa6ed Nom complet du package défaillant : ID de l’application relative au package défaillant : * PHP LOG FILE [16-Feb-2015 07:51:43 Europe/Paris] PHP Warning: mail(): SMTP server response: 550 Unknown user in envoyer.php on line 2 * SMTP LOG FILE "SMTPD" 2660 94856 "2015-02-16 07:51:43.823" "127.0.0.1" "SENT: 550 Unknown user" -- Edit bug report at https://bugs.php.net/bug.php?id=69060&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69060&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69060&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69060&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=69060&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=69060&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=69060&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=69060&r=needscript Try newer version: https://bugs.php.net/fix.php?id=69060&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=69060&r=support Expected behavior: https://bugs.php.net/fix.php?id=69060&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=69060&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=69060&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=69060&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69060&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=69060&r=dst IIS Stability: https://bugs.php.net/fix.php?id=69060&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=69060&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=69060&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=69060&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=69060&r=mysqlcfg

« previous php.bugs (#190710) next »