php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37483 PHP5TS.DLL causes w3svc crash and application pool termination
Submitted: 2006-05-17 20:05 UTC Modified: 2006-07-22 15:55 UTC
Votes:66
Avg. Score:4.8 ± 0.6
Reproduced:64 of 64 (100.0%)
Same Version:60 (93.8%)
Same OS:61 (95.3%)
From: jneill at gamedaytv dot com Assigned:
Status: Not a bug Package: IIS related
PHP Version: 5.1.4 OS: Windows 2003 SP 1
Private report: No CVE-ID: None
 [2006-05-17 20:05 UTC] jneill at gamedaytv dot com
Description:
------------
We have been successfully using PHP 5.1.2 for several months in our server environment.

Only upgrading PHP to 5.1.4, with no other software upgrades, has resulted in frequent w3svc crashes and subsequent application pool terminations.

The system log includes such errors as:

---
A process serving application pool 'Site1' terminated unexpectedly. The process id was '5796'. The process exit code was '0xc0000005'.

A process serving application pool 'Site2' terminated unexpectedly. The process id was '5212'. The process exit code was '0xffffffff'.

A process serving application pool 'DefaultAppPool' terminated unexpectedly. The process id was '5824'. The process exit code was '0xc0000005'.
---

We have run the IIS Diagnostics Debug Diagnostics Tool on these crashes, which has resulted in the following report for each crash:

---
Type of Analysis Performed   Crash Analysis 
Machine Name   S76217 
Operating System   Windows Server 2003 Service Pack 1 
Number Of Processors   2 
Process ID   4736 
Process Image   c:\WINNT\system32\inetsrv\w3wp.exe 
System Up-Time   0 day(s) 04:18:05 
Process Up-Time   0 day(s) 00:31:08 

Thread 16 - System ID 2612
Entry point   msvcrt!_endthread+3b 
Create time   5/16/2006 5:31:43 PM 
Time spent in user mode   0 Days 0:0:0.0 
Time spent in kernel mode   0 Days 0:0:0.0 

Function     Arg 1     Arg 2     Arg 3   Source 
<Unloaded_php5ts.dll>+265c80     02a28890     00000000     00000000    
msvcrt!_endthread+ab     029e7580     00000000     00000000    
kernel32!BaseThreadStart+34     77bcb35a     029e7580     00000000    

In w3wp__PID__4736__Date__05_16_2006__Time_05_31_45PM__95__Second_Chance_Exception_C0000005.dmp an access violation exception (0xC0000005) occured on thread 16 when another module attempted to call the following unloaded module: php5ts.dll.

---










Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-17 20:27 UTC] tony2001@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.


 [2006-05-18 17:40 UTC] jneill at gamedaytv dot com
I do not understand these instructions:

"When PHP crashes, click Cancel to debug the process. Now MSVC starts up in Debug View. If you don't already see the call stack, go into the View menu and choose Debug Windows &#8594; Call Stack."

When PHP crashes, we do not see a dialogue box with Cancel as an option, and MSVC does not start up. All that happens is that we get an error in the System Event Log that says something like:

---
A process serving application pool 'Site12' terminated unexpectedly. The process id was '3392'. The process exit code was '0xc0000005'.
---

So how do I run the debugger?
 [2006-05-19 16:04 UTC] julien dot jacques at fingerprint dot fr
I have exactly the same problem.

Since i am on a production server, i can't install MSVC6. (it seems to be replace with MSvisual express2005, which require to remove all sql server prior to 2005. And i can't remove it on production.)
I try to add the .pdb to the DebugDiag symbol path but the file doesn't match the dll. 

Is this because the debug pack is for php5.2.x?
Do i have to install php5.2.x-dev?
Where can i find the debug pack for php5.1.4?

I would be happy to help, but i don't know how to produce the backtrace you require.
 [2006-05-24 22:12 UTC] tony2001@php.net
Please try using this CVS snapshot:

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


 [2006-05-29 09:22 UTC] andrej at seznam dot org
I came up with exact the same crash analysis, even with the latest PHP snapshot 5.2.0-dev dated May 28 2006 00:17:10:

---
Operating System   Windows Server 2003 Service Pack 1 
Number Of Processors   2 
Process ID   8060 
Process Image   c:\WINDOWS\system32\inetsrv\w3wp.exe 
System Up-Time   46 day(s) 02:14:04 
Process Up-Time   0 day(s) 00:22:07 

Thread 15 - System ID 7536
Entry point   msvcrt!_endthread+3b 
Create time   29.5.2006 0:13:40 
Time spent in user mode   0 Days 0:0:0.0 
Time spent in kernel mode   0 Days 0:0:0.0 

Function     Arg 1     Arg 2     Arg 3   Source 
<Unloaded_php5ts.dll>+268810     01626ce0     00000000     00000000    
msvcrt!_endthread+ab     0270aa78     00000000     00000000    
kernel32!BaseThreadStart+34     77bcb35a     0270aa78     00000000    

an access violation exception (0xC0000005) occured on thread 15 when another module attempted to call the following UNLOADED module: php5ts.dll.
---

It is weird, that at the moment of crash sometimes there is NO ACTIVITY (= noone is browsing the page).
On the other hand, w3swc.exe process consumes too much CPU time, compared to my observations from some time ago, when WebAppPools did not crash.
The observed WebAppPool is isolated, I mean, only 1 web uses this pool.
 [2006-05-30 16:37 UTC] jneill at gamedaytv dot com
We tested the 5.2 snap on two of our Windows 2003 SP1 servers, and the aforementioned crashes occur with more frequency than with PHP 5.1.4 on the same servers.
 [2006-05-30 17:59 UTC] bruno dot delbono at gmail dot com
I too can replicate it on both the 5.2-devel (the current) and 5.1.4. This is becoming a very irritating problems as w3wp.exe keeps crashing. 

Windows 2003 SP1 running IIS 6 with PHP ISAPI. 

Faulting application w3wp.exe, version 6.0.3790.1830, faulting module unknown, version 0.0.0.0, fault address 0x01b05c80.

WARNING - DebugDiag was not able to locate debug symbols for php5ts.dll, so the information below may be incomplete.





In w3wp__PID__4176__Date__05_25_2006__Time_09_57_31AM__495__Second_Chance_Exception_C0000005.dmp an access violation exception (0xC0000005) occured on thread 18 when another module attempted to call the following unloaded module: php5ts.dll.

w3wp__PID__4176__Date__05_25_2006__Time_09_57_31AM__495__Second_Chance_Exception_C0000005.dmp
Type of Analysis Performed   Crash Analysis 
Machine Name   DRAGOS 
Operating System   Windows Server 2003 Service Pack 1 
Number Of Processors   2 
Process ID   4176 
Process Image   c:\WINDOWS\system32\inetsrv\w3wp.exe 
System Up-Time   1 day(s) 06:47:17 
Process Up-Time   0 day(s) 01:19:11 


Thread 18 - System ID 2008
Entry point   msvcrt!_endthread+3b 
Create time   5/25/2006 9:57:30 AM 
Time spent in user mode   0 Days 0:0:0.0 
Time spent in kernel mode   0 Days 0:0:0.0 






Function     Arg 1     Arg 2     Arg 3   Source 
<Unloaded_php5ts.dll>+265c80     02e8a940     00000000     00000000    
msvcrt!_endthread+ab     02db8bf8     00000000     00000000    
kernel32!BaseThreadStart+34     77bcb35a     02db8bf8     00000000    






In w3wp__PID__4176__Date__05_25_2006__Time_09_57_31AM__495__Second_Chance_Exception_C0000005.dmp an access violation exception (0xC0000005) occured on thread 18 when another module attempted to call the following unloaded module: php5ts.dll.
 [2006-06-10 11:31 UTC] hayden dot kirk at mobilepc dot co dot nz
I have the same error on Windows 2003 SP1 and Windows 2003 SBS SP1.
 [2006-06-12 20:07 UTC] mike at normi dot net
Can confirm this on Windows 2003 SP1, ISAPI extension is as unstable as hell since 5.1.4.
 [2006-06-17 11:47 UTC] gravityworksllc at hotmail dot com
I just installed mysql.5.0.22 and the w3wp errors stopped even though I am using php 5.1.4.  Very strange...  But it works and it works well.  Also using MYSql Admin 1.1 ( latest revision )  Installed php 5.1.4 then MYSql 5.0.22 and then SQLAdmin 1.1.  No more errors from w3wp.exe and anything.. Clean as a whistle...

Kind regards, 
Mynd
 [2006-06-19 13:23 UTC] tony2001@php.net
Please try using this CVS snapshot:

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


 [2006-06-19 21:44 UTC] jneill at gamedaytv dot com
The crashes continue even with this latest snapshot.
 [2006-06-20 16:26 UTC] gravityworksllc at hotmail dot com
I spoke too soon about version 5 5 and 1.1admin.  The crashes still occur.  Man we need this fixed.   My logs are getting killed with errors and warnings all day.. 

Hope you can get to the bottom of this soon.. I know you are trying.. 

Kind regards, 
Mynd
http://www.myndpollution.com
 [2006-06-20 16:33 UTC] tony2001@php.net
I have serious doubts that we can fix something we can't reproduce and nobody can provide a piece of useful information.
 [2006-06-20 17:27 UTC] zbowden at vt dot edu
Tony, what information do you need that would be useful?
It looks to me (and I'm definately not a gd or windbg expert) that the php5ts module is just unloading itself too soon. AFAIK, you won't be able to get a meaningful backtrace (like I'm sure you're accustomed to seeing) when the module has been unloaded. I looked over the msdn site quite a bit trying to correlate some change that was made from 5.1.2 - 5.1.3 (and beyond) that relates to unloading but couldn't really find anything. 

When you're trying to repro the problem do you have any extensions enabled?
 [2006-06-20 18:48 UTC] jneill at gamedaytv dot com
Tony, I understand the predicament you are in as far as not being able to reproduce the issue. However, you have 21 votes, 19 reported reproductions of the issue, and several written accounts of this problem; this tends to indicate that there is indeed a problem that needs to be fixed, and the problem was introduced by changes that occurred from 5.1.2 to 5.1.4.

I cannot generate any of the backtraces you require other than giving you the errors I have already reported.

I can tell you that we only use PHP for the following on our webservers:

1. Running PHP forums, Invision Power Board (www.invisionpower.com), which utilize MS SQL 2005 databases.

2. Running a program called Flashloaded bannerRotator (www.flashloaded.com) which utilizes a mySQL database.

3. Running test PHP scripts.

On each of the sites that we run PHP on, the errors are generated. It does not appear that using MySQL or MSSQL or no database affects the frequency of PHP crashes.

Is it possible for someone to procure a Windows 2003 SP1 box and run PHP with similar forum or banner management software to see if they can replicate the issue?
 [2006-06-21 09:29 UTC] rusty at gmx dot de
Same problem here.
OS: Win2003SP1
PHP: 5.1.4
MySQL: 4.1.20

PHP-Applications running: Typo3, EQDKP, Wordpress...
 [2006-06-21 13:15 UTC] fcomparini at tvninteractivo dot cl
I have the same problem on 4 machines behind a load balancer (Windows 2003, IIS, PHP 5.1.4, MySQL 5.0.15). I was using PHP 5.0.5 and no problems, but after upgrading I keep having this w3wp.exe crashing problem. I downgrade to 5.0.5 and the problem disappear, although the site run slow on heavy load.

I can't install debugging applications because these are my production servers.....
 [2006-06-22 02:31 UTC] pauldain at hotmail dot com
Having the exact same issue. I'll add that the same behavior occurs on Windows XP Pro/IIS 5.1. In fact it is somewhat easier to reproduce. Restart IIS, and the error dialog will be thrown every time.
 [2006-06-22 09:37 UTC] flekj at atlas dot cz
Same problem using PHP 5.1.4 and 5.1.3.... We had to downgrade back to 5.1.2. There were no other changes made in configuration, only new binaries copied to PHP directory. 

OS: Windows Server 2003 SP1 with latest system updates
IIS6 with ASP.NET v1.1.4322, Active server Pages and PHP5 ISAPI extensions allowed
PHP versions mentioned above
 [2006-06-28 11:15 UTC] gauthier at datas dot com
Same problem here with Windows Server 2003 SP1, IIS 6, .NET 1.1 , PHP 5.1.4 (tested also 5.1.3 & 5.2.0-dev) using ISAPI: start WWW Publishing Service then load any PHP page (w/ phpinfo() directive for example) then stop WWW Publishing Service -> the error is thrown. Had to downgrade to PHP 5.1.2 to make the error go away...
 [2006-06-28 15:13 UTC] admin at dhosting dot co dot uk
Same issue 
Win 2003 SP1
PHP 5.1.4
MySQL 5.0.22
Reproduced on 5 servers, production and test environment, new installs etc

Only way to resolve is to revert back to 5.1.2

Any news on a fix yet?
 [2006-06-28 15:34 UTC] tony2001@php.net
Please don't add any comments to this report if you have nothing to say except for "me too".
 [2006-06-30 06:50 UTC] danielm at deekora dot tv
I suspect the reason it occurs when no one is using the web site is because the warning appears when the application pool is recycled.

After disabling automatic pool recycling the warning has not appeared.

to replicate the problem:
> Open a php site that uses the isapi module

> run the following script
======================================
'Recycle all application pools on server strComputer 
strComputer = "your server name in here"
Set objWMIService = GetObject("winmgmts:{authenticationLevel=pktPrivacy}\\" & strComputer & "\root\microsoftiisv2")

Set colItems = objWMIService.ExecQuery("Select * From IIsApplicationPool")

For Each objItem in colItems
    objItem.Recycle
Next

wscript.echo "Done!"
======================================

> Check iis logs
 [2006-07-12 18:29 UTC] ferrante at aracnet dot com
These are related issues in the bug database that seem to be describing the same problem:

Bug #36853 Worker process crashes after application pool recycle
Bug #33373 IIS worker Process continually restarts
Bug #37575 Faulting application w3wp.exe
Bug #35263 Crash during IIS Restart

We have the situation where the access violation appears when the process is restarted. We followed the advice above to minimize error messages by putting the PHP app into its own application pool and not letting the app pool get recycled. However, on iisreset or stop/restart of the application pool, the access violation is generated, even on the snapshot code as recent as php5.2-win32-200607120630.

Data Execution Prevention (DEP) was implicated in Bug #36853 and on one of our servers we were able to mask the error by added an DEP exception for the w3wp.exe executible. However on another server this did not work.

Bug #36853 also mentions changing the dynamic extensions load order around, but in our case it did not seem to help since we are able to reproduce the problem with PHP installed, no dynamic extensions enabled, with a simple echo("hello world"); php file. If the app pool is recycled or iisreset occurs, the php5ts.dll will generate an exception on unload.

Bug #36853 also mentions that recompiling php from source with a Visual Studio 2005 can fix the issue also. We have not yet tried that step.

Hopefully this information helps to resolve the issue. Thanks.
 [2006-07-12 18:36 UTC] ferrante at aracnet dot com
I am a software developer and would be happy to provide any additional information or collect any other diagnostics that would help resolve this issue, including providing access to a machine on which the problem occurs that has tools such as WinDbg and the IIS "Debug Diagnostics Tool" installed.

Please let me know how I can help out, and thanks for all your efforts.
 [2006-07-12 21:49 UTC] iburguer at hotmail dot com
Hi. I have the same issue here (development box, Windows XP Pro/sp2). I have a Dr. Watson dump and log. Where should I send those files?  

Regards,
Ignacio
 [2006-07-13 06:16 UTC] iburguer at hotmail dot com
Hi. It's quite hard to get a backtrace, because both php5isapi.dll and php5ts.dll have been unloaded when the exception raises. So I ran windbg, attached it to inetinfo.exe, run a test case, then stopped the IIS service.
I noticed that php5ts.dll leaves some structures allocated in the Thread Local Storage (which is not good, and may lead to this problem).
Anyway, after the exception occured, I reloaded the dll in the debugger, and so I got this backtrace:

ChildEBP RetAddr  
11f4f90c 00403368 ntdll!DbgBreakPoint
11f4fadc 00406843 vrfcore!VerifierStopMessageEx+0x3d3 [d:\avrf\x86fre\base\avrf\avrf30\vrfcore\sdk.cpp @ 471]
11f4fb04 003b2139 vrfcore!VfCoreRedirectedStopMessage+0x86 [d:\avrf\x86fre\base\avrf\avrf30\vrfcore\stopredirect.cpp @ 103]
11f4fb34 003a8f19 vfbasics!VfBasicsStopMessage+0x1c9 [d:\avrf\x86fre\base\avrf\avrf30\providers\basics\basics.cpp @ 1045]
11f4fb98 003a8658 vfbasics!AVrfpCheckFirstChanceException+0x139 [d:\avrf\x86fre\base\avrf\avrf30\providers\basics\support.c @ 966]
11f4fba8 7c942dcf vfbasics!AVrfpVectoredExceptionHandler+0x18 [d:\avrf\x86fre\base\avrf\avrf30\providers\basics\support.c @ 313]
11f4fbc8 7c9377da ntdll!RtlCallVectoredExceptionHandlers+0x48
11f4fc40 7c90eafa ntdll!RtlDispatchException+0x19
11f4fc40 07a25c90 ntdll!KiUserExceptionDispatcher+0xe
11f4ff40 77c3a243 php5ts!xmlGetGlobalState+0xd0
11f4ff74 003a4e8f msvcrt!_endthread+0xaf
11f4ffb4 7c80b50b vfbasics!AVrfpStandardThreadFunction+0x6f [d:\avrf\x86fre\base\avrf\avrf30\providers\basics\thread.c @ 553]
11f4ffec 00000000 kernel32!BaseThreadStart+0x37

Note: I'm also using Microsoft's Application Verifier. That's how I found out about the TLS issue, and also is responsible for those vrfcore and vfbasics functions that appear in the stack.

If you need further information, I'd be glad to help.
 [2006-07-13 07:23 UTC] iburguer at hotmail dot com
One last thing. I removed php5isapi.dll from IISAPI filters (but left it to handle the .php mapping in the "application settings" tab of the resource properties in IIS).
The problem seems to be solved. I can run now phpinfo(), then stop the w3svc service and nothing crashes.
I have no idea if I'm missing something having removed iisapi filter.


Greetings,
Ignacio Burgue?o
 [2006-07-17 02:15 UTC] lascjr at bol dot com dot br
I have same problem, i has version 5.1.4, i have read and use this instructions (http://bugs.php.net/bugs-generating-backtrace-win32.php, i have tested with Last Snap 5.2 http://snaps.php.net/win32/php5.2-win32-200607162230.zip and http://snaps.php.net/win32/php5.2-dbgpack-win32-latest.zip) but the Debug don?t work, i have installed MSVC6, when PHP crashes the system show:

---------------------------
w3wp.exe - Application Error
---------------------------
The instruction at "0x0c107dc8" referenced memory at "0x0c107dc8". The memory could not be "read".

Click on OK to terminate the program
Click on CANCEL to debug the program
---------------------------
OK   Cancel   
---------------------------

I click at Cancel button to debug the process, but i only received the new Msgbox with:

---------------------------
w3wp.exe - Application Error
---------------------------
The instruction at "0x0c107dc8" referenced memory at "0x0c107dc8". The memory could not be "read".

Click on OK to terminate the program
---------------------------
OK   
---------------------------


I am not totally sure, but only downgrade to 5.0.3 solves my problem, 5.0.4 or newer are the same problem.

I use Windows Server 2003 Web Edition SP1, full patched, i only use extensions php_mysql and php_mbstring

PHP Bug Team, please create the ambient for test, it?s very simple, backtrace really don?t show nothing expect i related.
 [2006-07-22 15:55 UTC] sniper@php.net
We are aware of PHP's problems with stability under IIS and are working 
to rectify the problem. Unfortunatly your bug report does not contain any
extra useful information and we already have enough bug reports open about
this issue. If you can provide more detailed information such as a 
reproducable crash or a backtrace please do so and reopen this bug. 
Otherwise please keep trying new releases as we are working to resolve 
the problems on this platform
 
Thanks for your interest in PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 12:01:27 2024 UTC