Bug #15836 Updated: Bug #11162 pfsockopen closes connection after script finishes !

2002-03-03 Thread strange

 ID:   15836
 Updated by:   [EMAIL PROTECTED]
 Reported By:  [EMAIL PROTECTED]
 Status:   Open
 Bug Type: Documentation problem
 Operating System: FreeBSD
 PHP Version:  4.1.1
 New Comment:

I think this locate the problem and try to test it as soon as
possible.

http://marc.theaimsgroup.com/?l=php-dev&m=100842297427750&w=2

[2000-09-27 22:17:24] [EMAIL PROTECTED]

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.


Previous Comments:


[2002-03-03 03:35:38] [EMAIL PROTECTED]

I know, that p* functions opens 1 connection per process.
But in any case p* functions should not close this connection, but hold
it opened in hashed table for next time, same script will be executed
on this apache process, isnt it ? Unfortunately this doen not happend
;( PHP really closes the socket right after script end ;(

And in tests apache was configured like:
MinSpareServers 1 
MaxSpareServers 1 
StartServers 1
MaxClients 1  

That means that only 2 apache processes are in memory, (parent and a
child) and only one of them handles php scripts. But all tests faied,
as i talk. any pfsockopen connections are closed after end of script ;(



[2002-03-02 13:44:13] [EMAIL PROTECTED]

[EMAIL PROTECTED]
29-Jan-2001 03:26

OK, WRT to the p* functions opening a new connection when one already
exists. It is my understanting that (under Apache anyways) this is on
a
per-process basis. If you do a 'ps auxw|grep httpd' on your server you
will see more than one process. What p* does is make a p-connection on
one
of those processes only, the one that actually handles your request.
Chances are that when you hit the page again it will be answered by a
different process. I'm guessing if you keep hitting reload you'll get
around to the original process again and there will be no error message
or
second connection open. Anyhow, this is true of all p* functions; they
open not one connection per server, but one connection per server
_process_.

Hope this explains something (it's from the manual at
http://www.php.net/manual/en/function.pfsockopen.php)
I'm keeping this open as a doc problem though, cause the documentation
is very skimmy.

Derick



[2002-03-02 13:39:56] [EMAIL PROTECTED]

The problem still exists!

Connection, opened by pfsockopen(), is closing when the script is
   finishes. (tested by just simple netcat -l and by multithreaded
java
   chat server)

   PHP Version 4.1.1
   Apache/1.3.20
   FreeBSD 4.5-STABLE




-- 
Edit this bug report at http://bugs.php.net/?id=15836&edit=1




Bug #15836 Updated: Bug #11162 pfsockopen closes connection after script finishes !

2002-03-03 Thread strange

 ID:   15836
 Updated by:   [EMAIL PROTECTED]
 Reported By:  [EMAIL PROTECTED]
 Status:   Open
 Bug Type: Documentation problem
 Operating System: FreeBSD
 PHP Version:  4.1.1
 New Comment:

I know, that p* functions opens 1 connection per process.
But in any case p* functions should not close this connection, but hold
it opened in hashed table for next time, same script will be executed
on this apache process, isnt it ? Unfortunately this doen not happend
;( PHP really closes the socket right after script end ;(

And in tests apache was configured like:
MinSpareServers 1 
MaxSpareServers 1 
StartServers 1
MaxClients 1  

That means that only 2 apache processes are in memory, (parent and a
child) and only one of them handles php scripts. But all tests faied,
as i talk. any pfsockopen connections are closed after end of script ;(


Previous Comments:


[2002-03-02 13:44:13] [EMAIL PROTECTED]

[EMAIL PROTECTED]
29-Jan-2001 03:26

OK, WRT to the p* functions opening a new connection when one already
exists. It is my understanting that (under Apache anyways) this is on
a
per-process basis. If you do a 'ps auxw|grep httpd' on your server you
will see more than one process. What p* does is make a p-connection on
one
of those processes only, the one that actually handles your request.
Chances are that when you hit the page again it will be answered by a
different process. I'm guessing if you keep hitting reload you'll get
around to the original process again and there will be no error message
or
second connection open. Anyhow, this is true of all p* functions; they
open not one connection per server, but one connection per server
_process_.

Hope this explains something (it's from the manual at
http://www.php.net/manual/en/function.pfsockopen.php)
I'm keeping this open as a doc problem though, cause the documentation
is very skimmy.

Derick



[2002-03-02 13:39:56] [EMAIL PROTECTED]

The problem still exists!

Connection, opened by pfsockopen(), is closing when the script is
   finishes. (tested by just simple netcat -l and by multithreaded
java
   chat server)

   PHP Version 4.1.1
   Apache/1.3.20
   FreeBSD 4.5-STABLE




-- 
Edit this bug report at http://bugs.php.net/?id=15836&edit=1




Bug #11162 Updated: pfsockopen closes connection after script finishes

2002-02-14 Thread strange

 ID:   11162
 Updated by:   [EMAIL PROTECTED]
-Reported By:  [EMAIL PROTECTED]
+Reported By:  [EMAIL PROTECTED]
 Status:   Closed
 Bug Type: Sockets related
 Operating System: FreeBSD
 PHP Version:  4.0.4
 New Comment:

The problem still exists!
Connection, opened by pfsockopen(), is closing when the script is
finishes. (tested by just simple netcat -l and by multithreaded java
chat server)

PHP Version 4.1.1
Apache/1.3.20
FreeBSD 4.5-STABLE


Previous Comments:


[2001-12-13 06:25:08] [EMAIL PROTECTED]

No feedback. Closing.



[2001-11-21 12:03:03] [EMAIL PROTECTED]

Can try with latest RC and see if the problem still exists

http://www.php.net/~zeev/php-4.1.0RC3.tar.gz

Feedback.



[2001-05-29 01:18:39] [EMAIL PROTECTED]

When using pfsockopen() it closes the connection as soon as the script
finishes. According to the manual, the connection should remain open. I
have had a few people write their own script to test this on their
machine to make sure it wasn't my machine, or my code, and both of them
also produced the same result. So I beleive this is either a bug with
pfsockopen() or with the online documents.




-- 
Edit this bug report at http://bugs.php.net/?id=11162&edit=1