This is very interesting...and quite unexpected. Would it be possible that fclose fails?

To make the issue clear, and to support my claim that HTTPRL may fail to close a connection in some cases, I copy/paste some comments from php.net, found on fclose and stream_socket_shutdown pages:

In case you have some trouble to properly disconnect some client streams opened with stream_socket_server / stream_select you should give a try to stream_socket_shutdown.

stream_socket_shutdown($clientStream,STREAM_SHUT_RDWR);

Another one:

Just a note to say that if you encounter problem closing some sockets using fclose in a multi client server, you should really give this one a try.

Spent a full day trying to resolve this issue using stream_socket_shutdown($clientStream,STREAM_SHUT_RDWR);
finally do the trick.

Comments

gabor_h’s picture

Status: Active » Closed (works as designed)

I decided to close this, because although the connections are not always closed, this is probably not the fault of HTTPRL. The sockets are opened with stream_socket_client() and php.net says to use fclose, so there is not much HTTPRL can do.

gabor_h’s picture

Issue summary: View changes