Link to home
Start Free TrialLog in
Avatar of hc11
hc11

asked on

Webserver hangs connecting to SQL2005.

Occasionally our website seems to 'hang'. No pages get returned to the browser.
 
webserver: Win2k3 IIS6 Zend 2.5.2
Db server: MS MSQL 2k5 on another box
 
When this happens the Application Log in event viewer on the webserver has a whole series of errors like this:
 
"Can not connect() to C:\Program Files\Zend\Core\bin\php-cgi.exe - [10060]"

Sometimes the error number is 1460:

"Can not read response from C:\Program Files\Zend\Core\bin\php-cgi.exe - [1460]"

These messages appear several times a second in the log.

Restarting the Web Service fixes the problem for several hours. Then it occurs again.

Any ideas where my problem lies?

Many thanks for any help....
Avatar of Sander Stad
Sander Stad
Flag of Netherlands image

Did you place a firewall on the machine after the installation on the webserver.

You could try the to delete the entry from the following registrykey :
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\ Client\ConnectTo\DSQUERY

See http://support.microsoft.com/default.aspx?kbid=328306
Avatar of cj_1969
This sounds like it might be a memory issue that is causing PHP to hang and not respond.
When this happens see what is running on the server.  If there are PHP processes running try aborting them and then see if the problem clears up.

If this works then it could be that PHP needs to be patched or there is a problem with the code that is running and something is hanging and possibly chewing up memory which eventually hangs the system.
Avatar of hc11
hc11

ASKER

Thanks for your suggestions so far.

I don't believe there has been a firewall added to the machine. But if so surely this wouldn't cause the intermittent connection problem I described?

I just checked the machine while it was is this 'stuck' state. It had exactly the same number of php-cgi.exe threads running as when all is well (16 as set in Zend). They are all using the same amount of memory as they do when successfully serving pages (around 13MB). The processor utilisation of these threads was always at zero though, whereas when serving pages the threads that do the serving will jump from zero up to a few percent each briefly as they do their job.

The uncanny thing about this problem seems to be that while the machine is stuck and not serving pages the CPU load is much lower than when it is.
The only thing going on seems to be the errors adding to the App log.

Both the system and the data partitions have loads of free space.

Can anyone suggest anything else?

many thanks



Avatar of hc11

ASKER

Perhaps I should clarify. When I said:

"I don't believe there has been a firewall added to the machine. But if so surely this wouldn't cause the intermittent connection problem I described?"

I meant: If the firewall was a problem for the connection between the webserver and the db server then surely it would stop ALL connections rather than just some as I am seeing??

Sorry about the confusing double negative in the quoted comment.
Avatar of hc11

ASKER

Well. I have submitted a Zend support ticket since investigation on this forum was fruitless.

My take, this is a code issue.
it may not be a memory leak as opposed to a pice of code that is trying to use more memory than the process can handle.  If this happens then you get a small app that uses all of its memory but needs more so it is constantly doing memory checking to free up anything not in use and slowly (if at all) working on the request.  Now, if the request happens to center around file IO then this could hang the entire environment.  A lot of applications are single threaded when it comes to IO and disk access so if one of the 16 processes hangs while reading a file then as the other processes all get to the point of needing access to a file they will go into a wait state while the pending file access is to be completed ... which it probably never will.  Eventually all the processes will hang.

This can also be intermittent if the memory required by the "hung or slow" process is actually able to complete and then all the rest of the processes will catch up in their requests and everything goes back to normal.
Avatar of hc11

ASKER

Hmmm very interesting comment! Thank very much.
But the question is how to test this?? Increase the memory allocation to my php threads and see if it goes away?
Some code analysis tool?

thanks again


ASKER CERTIFIED SOLUTION
Avatar of cj_1969
cj_1969
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial