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

From: Date: Tue, 17 Feb 2015 17:48:26 +0000
Subject: Bug #69060 [Opn->Fbk]: PHP-CGI.EXE crashes in CLI when call mysqli_close() after a long period
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-190754@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69060&edit=1

 ID:                 69060
 Updated by:         ab@php.net
 Reported by:        julientld at free dot fr
 Summary:            PHP-CGI.EXE crashes in CLI when call mysqli_close()
                     after a long period
-Status:             Open
+Status:             Feedback
 Type:               Bug
 Package:            CGI/CLI related
 Operating System:   Windows Server 2012
 PHP Version:        5.6.5
 Block user comment: N
 Private report:     N

 New Comment:

@julientld, thanks for the report.

I'm not quite convinced yet mysqli is causing that crash. At least from the event log event you
supply - the crash happens in mail().

Actually, as you've also consulted someone who saw the dump, you should be able to reproduce
what you think it is. To do that - open some mysql connection from php and sleep for some short
time, kill the mysql server, wait till php continues to run. This should be doing the same job
disregarding how much time it lasts.

But as you have the dump, i'd also ask you to check whether you could at least provide the
backtrace from there.

Thanks.


Previous Comments:
------------------------------------------------------------------------
[2015-02-16 11:48:01] julientld at free dot fr

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 this bug report at https://bugs.php.net/bug.php?id=69060&edit=1


Thread (15 messages)

« previous php.bugs (#190754) next »