2 Votes Vote

Apache/PHP processes hanging while interacting with MySQL

Posted by topdog 170 days ago Questions| apache mysql php All

Hi all,

We're seeing some strange behaviour and we're not sure if it's a problem with apache, php, mysql or the OS, so over to the big brains of stackoverflow!

We have Apache and mod_php talking to a mysql5 server. Sometimes, a process will choose to hang, trying to read from a file descriptor.

Firing up strace one on of them (all hanging processes showed the same results) gave this :

[root@prweb133v ~]# strace -p 8450
Process 8450 attached - interrupt to quit
read(57,  <unfinished ...>

So what was it trying to read?

[root@prweb133v ~]# lsof -p 8450
...
...
httpd   8450 apache   57u  IPv4    5546599             TCP
prweb133v.local:36615->hadat.local:mysql (ESTABLISHED)

That's our mysql server! Ok, so maybe it was trying to read the results of a query, I thought. Checking the processlist on the mysql server, the connection was established but in a state of SLEEP.

Hmmmm.

So then I checked netstat to see who was trying to send/receive what.

On the webserver :

[root@prweb133v ~]# netstat -t -n -a | grep 36615
tcp        0      5 172.23.179.6:36615          172.23.179.67:3306         
ESTABLISHED 

and on the mysql server there was an established connection but 0 in the send or receive queues.

Any idea what these mysterious 5 bytes could be, or why they randomly don't get the the mysql server?

Cheers!

Mike

Discuss Bury


Who Voted for this Question