PHP 4.0 Bug #6914: persistent socket connection failure
| From: | wbrack at mmm dot com dot hk | Date: | Thu, 28 Sep 2000 02:17:24 +0000 |
| Subject: | PHP 4.0 Bug #6914: persistent socket connection failure | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-33748@lists.php.net to get a copy of this message | ||
From: wbrack@mmm.com.hk
Operating system: Linux 2.2.17
PHP version: 4.0.2
PHP Bug Type: Sockets related
Bug description: persistent socket connection failure
A UNIX socket connection is made using pfsockopen(). On the initial script entry, a message is sent
to our server and the reply is correctly received by the script. On subsequent script entries,
messages to the server are still sent successfully, but upon attempting to reply a SIGPIPE is
received by server, and the php script receives a 0-length reply to its fgets() read.
We traced the problem to ext/standard/file.c, in the routine _file_socket_dtor(). In that routine,
the macro SOCK_FCLOSE is used, which calls php_sock_close() in fsock.c. This routine correctly
handles the persistent socket. However, after that call, _file_socket_dtor() then incorrectly calls
the C routine shutdown(), which is what caused the problem. In fact, php_sock_close() already
completely takes care of the shutdown() (for the non-persistent case), so in any event the
shutdown() call in _file_socket_dtor() is not necessary.