IIS + PHP -- Worker Process alert & w3wp.exe crash?

IIS + PHP -- Worker Process alert & w3wp.exe crash?

am 27.11.2007 16:35:35 von turnstyle

Hi all,

I'm trying to set up my first Vista/IIS7 box with PHP5 -- in IIS7 I
mapped the current php5isapi.dll.

I've noticed that if I simply open a PHP page (it works), when the IIS
application pool later recycles (either timed or forced), I get an
"IIS Worker Process has stopped working" alert, and a "Faulting
application w3wp.exe" event in the Event Viewer.

Is there a way to fix that? (Other folks seem to have the same
problem, but I can't seem to find a solution.)

Is *anybody* here running IIS7/PHP without this problem? Alterntively,
do others here have the same problem?

Many thanks, -Scott

Re: IIS + PHP -- Worker Process alert & w3wp.exe crash?

am 27.11.2007 20:38:19 von Le Chaud Lapin

On Nov 27, 9:35 am, turnstyle wrote:
> Hi all,
>
> I'm trying to set up my first Vista/IIS7 box with PHP5 -- in IIS7 I
> mapped the current php5isapi.dll.
>
> I've noticed that if I simply open a PHP page (it works), when the IIS
> application pool later recycles (either timed or forced), I get an
> "IIS Worker Process has stopped working" alert, and a "Faulting
> application w3wp.exe" event in the Event Viewer.
>
> Is there a way to fix that? (Other folks seem to have the same
> problem, but I can't seem to find a solution.)
>
> Is *anybody* here running IIS7/PHP without this problem? Alterntively,
> do others here have the same problem?

I know very little about PHP, but the problem you are describing seems
to be one we've been having for a few months. After a long time (I
guess recycling), a window pops up saying "IIS Worker
Process..yada..". I click it away and move on.

I had one of my people look at it, and he said that it was most likely
a bug somewhere that was not in IIS, but I know nothing more, and and
since neither of is web expert, we decided to punt and let it go.

-Le Chaud Lapin-

Re: IIS + PHP -- Worker Process alert & w3wp.exe crash?

am 28.11.2007 00:31:49 von David Wang

On Nov 27, 7:35 am, turnstyle wrote:
> Hi all,
>
> I'm trying to set up my first Vista/IIS7 box with PHP5 -- in IIS7 I
> mapped the current php5isapi.dll.
>
> I've noticed that if I simply open a PHP page (it works), when the IIS
> application pool later recycles (either timed or forced), I get an
> "IIS Worker Process has stopped working" alert, and a "Faulting
> application w3wp.exe" event in the Event Viewer.
>
> Is there a way to fix that? (Other folks seem to have the same
> problem, but I can't seem to find a solution.)
>
> Is *anybody* here running IIS7/PHP without this problem? Alterntively,
> do others here have the same problem?
>
> Many thanks, -Scott


You fix things like this by having a debugger attached and waiting for
the crash that causes the "Faulting application w3wp.exe" event,
taking a stack backtrace of the culprit, and getting that analyzed and
fixed. Tools like DebugDiag and IIS State from microsoft.com help do
this.

Looking for people that run PHP/IIS7 without this problem or others
with this problem will unfortunately be not useful because this event
can be caused by anything. Your crash may not have anything to do with
anyone else's crash, so looking for others is not useful. The most
useful action is to directly figure out what is crashing and getting
that to the responsible party.

All we know is that it comes from some software you are running on
IIS7. And the debugger method I described earlier is the main way to
figure out WHAT software is crashing (and knowing is half the battle
here).


//David
http://w3-4u.blogspot.com
http://blogs.msdn.com/David.Wang
//

Re: IIS + PHP -- Worker Process alert & w3wp.exe crash?

am 28.11.2007 01:39:49 von turnstyle

It's easily reproducible, I just have to:

1) open any simple test.php page (even will
suffice) -- again, the PHP code processes correctly.

2) open the IIS Manager > Applications Pools > select DefaultAppPool
and click Recycle

As soon as I do that, I get the "IIS Worker Process has stopped
working" alert as well as the "Faulting application w3wp.exe" event in
the Event Viewer.

I'd be grateful for suggestions on how to further debug -- and/or even
for information that this is simply unavoidable with IIS7/PHP. Here's
the full text of a typical Event Viewer record:

Faulting application w3wp.exe, version 7.0.6000.16386, time stamp
0x4549b5f8, faulting module ntdll.dll, version 6.0.6000.16386, time
stamp
0x4549bdc9, exception code 0xc0000374, fault offset 0x000af1c9,
process id
0x4d0, application start time 0x01c831563c169ad0.

Thanks! -Scott

Re: IIS + PHP -- Worker Process alert & w3wp.exe crash?

am 29.11.2007 00:08:41 von turnstyle

Hey David & all, I think I found it...

if I open:
IIS Manager > DefautAppPool > Advanced Settings

and change:
Process Model > Identity

from:
NetworkService

to:
SpecificUser

and enter my credentials in:
Identity SpecificUser Credentials

The problem stops -- what folders/perms do I need to check to use the
default NetworkService as Process Model Identity?

-Scott

Re: IIS + PHP -- Worker Process alert & w3wp.exe crash?

am 29.11.2007 02:11:55 von David Wang

On Nov 28, 3:08 pm, turnstyle wrote:
> Hey David & all, I think I found it...
>
> if I open:
> IIS Manager > DefautAppPool > Advanced Settings
>
> and change:
> Process Model > Identity
>
> from:
> NetworkService
>
> to:
> SpecificUser
>
> and enter my credentials in:
> Identity SpecificUser Credentials
>
> The problem stops -- what folders/perms do I need to check to use the
> default NetworkService as Process Model Identity?
>
> -Scott


You want to use Process Monitor to see what files/registry key is
denying access and causing the crash.

From the sounds of it, PHP is crashing due to permissions issue and
should be reported as a PHP bug.

I'm going to install IIS7 and latests PHP to see if it repros and if
so, get a crash dump and stack backtrace to confirm.


//David
http://w3-4u.blogspot.com
http://blogs.msdn.com/David.Wang
//

Re: IIS + PHP -- Worker Process alert & w3wp.exe crash?

am 29.11.2007 16:02:00 von turnstyle

Hey David, thanks (and thanks for general willingness to act as
mentor).

fwiw, it has been easy to reproduce here -- just Vista, IIS7 + ISAPI,
Windows Update, PHP5.2.5 -- then I just open a PHP page and recycle
the app pool.

I'd be happy to run Process Monitor, but I think I'll need a bit of
guidance (I've never used it before so I just downloaded it, but I
didn't quite know what to do -- with it opened, I opened a PHP page
and recycled the app pool and got the crash, but I didn't know what to
look for in Process Monitor).

So, if you do try it and have trouble reproducing it, just let me know
what to do with Process Monitor and I'll post the results...

-Scott

Re: IIS + PHP -- Worker Process alert & w3wp.exe crash?

am 03.12.2007 23:19:43 von turnstyle

Hi David,

Did you have a chance to repoduce this?

Alternatively, is there anything you can suggest for me to try? (ie,
how might I use Process Manager to identify the troublemaker?)

thanks again, -Scott

Re: IIS + PHP -- Worker Process alert & w3wp.exe crash?

am 04.12.2007 10:44:13 von David Wang

On Dec 3, 2:19 pm, turnstyle wrote:
> Hi David,
>
> Did you have a chance to repoduce this?
>
> Alternatively, is there anything you can suggest for me to try? (ie,
> how might I use Process Manager to identify the troublemaker?)
>
> thanks again, -Scott


I can reproduce this on IIS7 with PHP 5.2.5.

This is a bug in the PHP ISAPI DLL during DLL unload. It is trying to
double-free a piece of memory. When you recycle the Application Pool,
it causes the w3wp.exe to shutdown and unload all ISAPI DLLs, hence
triggering the PHP bug.

The crash happen regardless of the IIS Application Pool identity.

This should just be reported to PHP as a bug.

FYI: Some people ignore "shutdown bugs" such as this, reasoning that
the process is already terminating, so it doesn't matter if it crashes
abnormally or terminates gracefully. Personally, I fix all crashes,
especially mainline crashes like this.


//David
http://w3-4u.blogspot.com
http://blogs.msdn.com/David.Wang
//

Re: IIS + PHP -- Worker Process alert & w3wp.exe crash?

am 04.12.2007 17:23:00 von turnstyle

Hey David, thanks.

However, note that when I change the Process Model > Identity to
SpecificUser, and then enter my credentials, the crash goes away. If I
switch it back to NetworkService, the crashes come back, back to
SpecificUser, and I'm ok again.

(fwiw, I can't really "igonre" the crashes because this is my work dev
box, and I keep getting alerts with each crash -- for that matter,
what good geek can just ignore crashes!?! ;)

btw, an unrelated question: I've noticed that http://machinename URLs
are slow on my Vista box, whereas http://localhost URLs are perfecty
fast. If I disable Windows Firewall http://machinename URLs are then
ok. Any ideas?

Thanks again! -Scott


> I can reproduce this on IIS7 with PHP 5.2.5.
>
> This is a bug in the PHP ISAPI DLL during DLL unload. It is trying to
> double-free a piece of memory. When you recycle the Application Pool,
> it causes the w3wp.exe to shutdown and unload all ISAPI DLLs, hence
> triggering the PHP bug.
>
> The crash happen regardless of the IIS Application Pool identity.
>
> This should just be reported to PHP as a bug.
>
> FYI: Some people ignore "shutdown bugs" such as this, reasoning that
> the process is already terminating, so it doesn't matter if it crashes
> abnormally or terminates gracefully. Personally, I fix all crashes,
> especially mainline crashes like this.
>
> //Davidhttp://w3-4u.blogspot.comhttp://blogs.msdn.com/David. Wang
> //

Re: IIS + PHP -- Worker Process alert & w3wp.exe crash?

am 06.12.2007 21:01:10 von turnstyle

Hi David, did you have a chance to try again with SpecificUser and
admin creds? (as that seemed to work for me)

Re: IIS + PHP -- Worker Process alert & w3wp.exe crash?

am 27.12.2007 17:05:25 von Rog S

Does this solution open up any security holes, or is it a valid solution
to this problem? So far, I haven't seen any fixes for this issue.

Thanks
R



*** Sent via Developersdex http://www.developersdex.com ***

Re: IIS + PHP -- Worker Process alert & w3wp.exe crash?

am 29.12.2007 03:29:31 von David Wang

The bug is in PHP. The proper solution is to file a bug to fix PHP.

I do not consider the solution to change application pool identity
valid because there is no way to validate whether changing the
application pool identity is secure for your specific situation. For
example, if your user identity is system administrator, you just
weakened system security by allowing any potential hacks to run as
local administrator when it was not possible with the original Network
Service identity.

Personally, I don't bother with the workarounds. It's a PHP bug. It's
Open Source. Someone is supposed to take responsibility and get it
fixed, right?...


//David
http://w3-4u.blogspot.com
http://blogs.msdn.com/David.Wang
//



On Dec 27, 8:05=A0am, Rog S wrote:
> Does this solution open up any security holes, or is it a valid solution
> to this problem? =A0So far, I haven't seen any fixes for this issue.
>
> Thanks
> R
>
> *** Sent via Developersdexhttp://www.developersdex.com***