tags:

views:

421

answers:

3

I have run into a situtation where frequently when debugging a ISAPI Dll (TWebModule) running under Apache I get errors. The caption on the error box is "Debugger Fault Notification" and contained in the message is, among other things: "c:\program files\Apache\bin\httpd.exe faulted with message......."

When this happens the cpu window pops up, and I have to hit the "OK" button on the error message. I might have to do this 3 - 5 times before program flow continues.

This is happening on my laptop. I have a desktop with the same exact configuration (as far as I know) and I don't have this problem. Both operating systems are XP. So obviously there is some setting or outdated file somewhere.

Also, I have noticed if first run my website when Apache is not in the debugging envrironment it seems not to have this problem. (i.e. start apache in the services, run my web app, stop the service, and then debug it within the Delphi environment).

Any ideas???

A: 

While it doesn't directly answer the how to debug using Apache, another alternate debugging technique which works well is to use idDebugger (near the bottom of that page). It will allow you to debug ISAPI DLL's directly from the IDE without having to start/stop services. I now never develop ISAPI DLL's without it.

skamradt
Thanks - I will check this out. Incidentally, the way I have been doing it doesn't require met to start and stop the Apache service. I simply include it as a Host application. Under Run -> Parameters I specify the following for Host Applciation: C:\Program Files\Apache Software Foundation\Apache2.2\bin\httpd.exe And under parameters I include this: -X -w -f "C:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd.conf" Thanks - I will check this out.
M Schenkel
A: 

To avoid this and other problems, I've started xxm. It's an alternative to TWebModule, and uses a separate wrapper to run with IIS, but there's also an Apache, FireFox and IE wrapper! It also uses mixed-HTML-Delphi-source and the development-mode wrappers do the parsing and an auto-compile to give a web-script-like environment.

Also the InternetExplorer plugin works great in the debugger (with iexplore.exe as host application).

Stijn Sanders
A: 

Error code 0xC0000008 is Status_Invalid_Handle. That can be thrown by CloseHandle, for example, when you try to close a handle that either was never open or was already closed. The error might not occur when you're running outside the debugger because the API won't throw an exception unless it's being debugged.

If you're getting that exception in code that the debugger doesn't have access to, then the debugger will display the CPU window instead. Look at the call stack to find the place in your code closest to where the exception came from.

It's also possible that it's not occurring in your code at all. Try doing your same debug routine without your module installed. Do you still get errors?

Rob Kennedy
When I inspect the Call Stack I don't see any of my calls; everything seems to be Apache calls (e.g. libhttpd.dll). It is not even getting to my code.How do you "debug routine without your module installed"??? I tried commenting out the LoadModule line in the conf file and run. But the ISAPI filtering is not working (i.e. it is not getting to my handlers).
M Schenkel
Well of course it's not getting to your handlers if you've removed your module. That's the point. You've removed your code, yet you're still debugging the process that was crashing. Does it still crash even without your code?
Rob Kennedy
From the looks of it, it seems that Apache is crashing itself. I never even get to my code (e.g. TWebModule.Create) Like I said, I have another environment setup up with the same source code and all works well. It is just on this one computer I have issues. But it is difficult to place if it is something different with the Apache environment, something outdated on the Delphi, or something else totally unrelated.
M Schenkel