I'm using Windows 2000 Professional and MS-SQL 2000 Developer, PHP is installed using 4.23 installer version, and php_mssql.dll is extracted from PHP4.23 ZIP version. Recently I switched to Windows 2000 Server. It should be 100% compatiable, but my applications now have DEADLOCK-like problems.
I have one code that handles data display from SQL (when using GET) and data update (when using POST). When user POST something, this code will executing UPDATE SQL commmand and output <meta http-equiv="refresh"> HTML to redirect to it self (using GET,) so that the user would see the change.
That code works properly on Windows 2000 Professional. But now PHP would crash sometimes (NOT ALWAYS!) when the browser re-enter the page after executing UPDATE.
I've traced my application using lots of echo() and flush (), it DID successfully execute to the last command, but browser refused to close TCP/IP connection. I checked the server status with task manager, the php.exe hangs there for 10 minutes, and I can not stop that process by using task manager, IIS reboot or stop SQL Service. The Only effective way to stop the process is to power-off server.
This crash condition only happens when I read one row from SQL server that is just updated (and committed). For example, If I have three rows that have SN=1,2,3 as primary key, and I updated row SN=2, then PHP will crash when reading the row SN=2 immediately, but it would be OK to read rows that SN=1 or 3 at the same time. This should not be the cache problem, cause I changed client to read the page, and I changed the filename of that PHP code.
It appear to me that SQL server did not release row-level lock after commit transactions and close connection. When other processes try to read this row, SQL Server whould not close the connection properly, and php.exe could not end the process.