php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20426 php.exe refused to end process: can not close connection to MSSQL
Submitted: 2002-11-14 06:46 UTC Modified: 2003-02-10 19:37 UTC
From: ulysses at mail dot fitan dot com dot tw Assigned:
Status: Closed Package: MSSQL related
PHP Version: 4.30 OS: Windows 2000 Server
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ulysses at mail dot fitan dot com dot tw
New email:
PHP Version: OS:

 

 [2002-11-14 06:46 UTC] ulysses at mail dot fitan dot com dot tw
I'm not sure which category should this note be classified. 
IIS related or MS-SQL related.

I'm using Windows 2000 Professional and MS-SQL 2000 
Developer. 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.

This problem seemed to be fixed after installing SQL Server 
Service Pack 1. But I'm not sure whether will it happen 
again. I hope that it's just a bug in my code. But I can 
not explain why SOME record would work while others won't.

My PHP4.23 is Windows binary installer version, and the 
php_mssql.dll is extracted from PHP4.23 Windows binary ZIP 
version. I did not install other modules.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-11-14 21:29 UTC] ulysses at mail dot fitan dot com dot tw
The problem came back again. Service Pack did not fixed the 
problem. I'll try to reduce all unrelated code, and find 
out where the problem is.
 [2002-11-15 01:15 UTC] ulysses at mail dot fitan dot com dot tw
OK, I fonud the source of this problem. It's not MSSQL 
lock/transaction problem, nor Windows 2000 Server/
Profession issue. It's due to i18n locallization settings. 
You may not be able to reproduce this cause I'm using 
TRADITINOAL CHINESE version of Windows 2000 Server and 
TRADITINOAL CHINESE version of SQL Server 2000.

Thanks for not responding. You may close this topic, cause 
this is a re-producable crash. I'm going to raise another 
topic.
 [2002-11-15 01:36 UTC] ulysses at mail dot fitan dot com dot tw
OK, I fonud the source of this problem. It's not MSSQL 
lock/transaction problem, nor Windows 2000 Server/
Profession issue. It's due to i18n locallization settings. 
You may not be able to reproduce this cause I'm using 
TRADITINOAL CHINESE version of Windows 2000 Server and 
TRADITINOAL CHINESE version of SQL Server 2000.

Thanks for not responding. You may close this topic, cause 
this is a re-producable crash. I'm going to raise another 
topic.
 [2002-11-15 01:36 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip

you don't need to open new reports, you can reclassify them..(and this belongs in mssql)

 [2002-11-26 20:03 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 [2003-01-02 22:23 UTC] ulysses at mail dot fitan dot com dot tw
OK... I've Just installed latest PHP 4.30, and the crashing 
problem is getting WORSE!

Now PHP will crash whenever I just execute "select *" from 
any table that contains two or more datetime/smalldatetime  
columns.

Again, this crashing situation disappears when I switch 
default script of Windows2000 to Japaness. But I can not 
tell my customers to do this. 

Could you nice guys just DISABLE the auto date format 
converting feature ? To us, this is not a feature; it's a 
CURSE!
 [2003-01-02 23:11 UTC] ulysses at mail dot fitan dot com dot tw
For more detailed information:

1. On Trad. Chinese version Windows 2000 with Trad. Chinese 
MSSQL 2000, I will get date format like '2003-01-06 
10:23:00' when I execute "select *" in Quary Analyzer. But 
I will get response like '2003 ?@?? 06 10:23 ?W??' when 
executing the same query with PHP.

2. I've tried to change date/number format settings in 
Windowd Location control panel, not working.

3. I've tried to change database default encoding, not 
working.

4. I've tried to add mssql.datetimeconvert=0 AND 
mssql.datetimeconvert=Off in php.ini, not working.

5. The ONLY way to alter the date-format converting style 
of php_mssql is to change the default language script of 
Windows 2000.

For detailed description of the crashing problem:

1. When executing "select *" from any table that contains 
ONE datetime/smalldatetime format column, PHP will execute 
and output text to browser. But that php.exe process will 
not end, neither calling mssql_close() nor not. You can see 
it in the Task Manager, and it can not be stopper by 
clicking "End Process".

2. When executing "select *" from any table that contains 
TWO OR MORE datetime/smalldatetime format column, PHP will 
crashed upon calling mssql_query. Again, that php.exe 
process will not quit and can not be forced quit using Task 
Manager.

3. By switching Windows 2000 default script to Japaness, 
all this problem disappears.

4. I've tried ALL other data format. None would cause 
crashing like this.

Now I'm 100% sure this IS a date-format converting bug. And 
now I'm just asking for one thing: to disable this 
"feature". Please! I beg you!
 [2003-01-03 00:03 UTC] ulysses at mail dot fitan dot com dot tw
OK... here goes more detail...

Just tried PHP 4.30 ISAPI mode. It still crashed, but now it would response messages like this:

"PHP has encountered an Access Violation at 77FCB032"

And more crashing condition:

In both CGI and ISAPI mode, PHP will crash when executing "select *" from any table that contains ONE, TWO OR MORE datetime/smalldatetime format columns THAT THERE IS ANY OTHER COLUMN BEHIND these datetime columns.

for example:

example_table (
  sn int,
  title varchar(40),
  modifytime datetime
);

Executing "SELECT sn, title, modifytime FROM example_table" will be okay, but executing "SELECT sn, modifytime, title FROM example_table" will crash.
 [2003-01-13 08:44 UTC] meeder at hotmail dot com
I got the same problem on a w2k machine as well i'm using a mysql database. I got as well a smallinteger in my table. If i don't get many hits it survives. But when the hits increase (don't know at which point) PHP crashes

i'm still working on it
 [2003-01-13 22:17 UTC] ulysses at mail dot fitan dot com dot tw
To Nice PHP staff:
It seemed that PHP does not handle SMALLDATETIME format 
well. When I execute this SQL statement:

select GetDate(), CAST(GetDate() as SMALLDATETIME)

I got this:

"Tue 14, Jan 2003, 12:12:42","2003 ?@?? 14 12:13?U??"

with mssql.datetimeconvert=Off and/or with ini_set
('mssql.datetimeconvert',0); 


To meeder:
My MSSQL problem would cause PHP to hang everytime. Just on 
connection would cause system to crash. What is your 
crashing symptom ? 'Too many connection would crash' sounds 
like presistant-connection-spooler-full or CGI-ERROR 
problem.
 [2003-02-10 19:24 UTC] fmk@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 [2003-02-10 19:37 UTC] ulysses at mail dot fitan dot com dot tw
Thank you. I'll try it.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu Aug 18 08:05:46 2022 UTC