# PHP socket automatically shuts down after ? hours of idling?

- Thread: https://externals.io/message/45884
- Original archive: https://news-web.php.net/php.internals/45884
- Started by Chris Jiang on 2009-10-28T08:26:55+00:00
- Messages: 6
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #45884 — Chris Jiang — 2009-10-28T08:26:55+00:00

URL: https://externals.io/message/45884#45884

Hi all, here is another question that made me confused. I'm not sure if
it's a bug or what, but I can't find an answer from the search engines.

I've made a chat server using php socket features, and it works pretty
well as I've expected. However, there is a weird thing happening: The
server shuts down automatically after about 3 hours of idling (no
connections).

I've set the php execution time limit to 0, and running this script from
shell in the background of CentOS 5.3. Can't think of any other reason
causing this strange behavior.

Any hint? Thx!

---

## #45926 — Hannes Magnusson — 2009-11-01T18:32:06+00:00

URL: https://externals.io/message/45884#45926 · In reply to: #45884

2009/10/28 Chris Jiang <jiangcat@gmail.com>:
> Hi all, here is another question that made me confused. I'm not sure if
> it's a bug or what, but I can't find an answer from the search engines.
>
> I've made a chat server using php socket features, and it works pretty
> well as I've expected. However, there is a weird thing happening: The
> server shuts down automatically after about 3 hours of idling (no
> connections).

Without any notices/warnings/errors? Do you have a shortish reproduce case?

-Hannes

---

## #45933 — Chris Jiang — 2009-11-02T02:27:11+00:00

URL: https://externals.io/message/45884#45933 · In reply to: #45926

Hi Hannes,

It just shuts down the socket server without any error, warning or 
notice. I'm sorry that I can't provide a case for reproduction, because 
I don't even know where the problem is, and where I should shorten the 
script to. However, there is a strange behavior that might help to 
target the trouble:

1) The socket server runs fine when it starts, as long as there are ppl 
keeping connected to the server.

2) After about 3 hours of idling (I couldn't count the exact time), when 
someone connect to the socket, it still works, for the FIRST connection.

3) Then, the server shuts down.

I tried to log what happend during the operation, but didn't find 
anything useful. :(

Any hint on this?

Thanks!

Chris Jiang


> 2009/10/28 Chris Jiang <jiangcat@gmail.com>:
> > […]
> 
> Without any notices/warnings/errors? Do you have a shortish reproduce case?
> 
> -Hannes

---

## #45935 — mm w — 2009-11-02T02:44:10+00:00

URL: https://externals.io/message/45884#45935 · In reply to: #45933

Hi what is your platform ?2.  Provide  a working, migth be a recent
problem regarding x socket, can you observe and dump your tcp
connexion?


> Hi Hannes,
>
> It just shuts down the socket server without any error, warning or notice. I'm sorry that I can't provide a case for reproduction, because I don't even know where the problem is, and where I should shorten the script to. However, there is a strange behavior that might help to target the trouble:
>
> 1) The socket server runs fine when it starts, as long as there are ppl keeping connected to the server.
>
> 2) After about 3 hours of idling (I couldn't count the exact time), when someone connect to the socket, it still works, for the FIRST connection.
>
> 3) Then, the server shuts down.
>
> I tried to log what happend during the operation, but didn't find anything useful. :(
>
> Any hint on this?
>
> Thanks!
>
> Chris Jiang
>
>
>
> 2009/10/28 Chris Jiang <jiangcat@gmail.com>:
>
> Hi all, here is another question that made me confused. I'm not sure if
> it's a bug or what, but I can't find an answer from the search engines.
>
> I've made a chat server using php socket features, and it works pretty
> well as I've expected. However, there is a weird thing happening: The
> server shuts down automatically after about 3 hours of idling (no
> connections).
>
>
> Without any notices/warnings/errors? Do you have a shortish reproduce case?
>
> -Hannes

---

## #46169 — Chris Jiang — 2009-11-24T08:09:19+00:00

URL: https://externals.io/message/45884#46169 · In reply to: #45935

Hi, sorry for replying late, but my authentication to reply mails to 
php.net newsgroup seems had a problem. I couldn't reply to this mail. 
Weird. :(

My platform is Centos 5.2 with PHP 5.2.8 and Apache 2.2.14. 
Unfortunately, I don't know how to dump the tcp connection info. Any hint?

Thanks!

mm w 写道:
> Hi what is your platform ?2.  Provide  a working, migth be a recent
> problem regarding x socket, can you observe and dump your tcp
> connexion?
> 
> 
> > […]

---

## #46194 — Chris Jiang — 2009-11-26T02:46:58+00:00

URL: https://externals.io/message/45884#46194 · In reply to: #45935

Hi all, after running a strace program, I've found the real issue with 
in it. It was a mysql connection timeout causing the PHP encountering a 
fatal error, and shuts down the server.

Thank you all again for your time and help. :D


> Hi what is your platform ?2.  Provide  a working, migth be a recent
> problem regarding x socket, can you observe and dump your tcp
> connexion?
