Debugged Process will not Terminate under Win2K 
Author Message
 Debugged Process will not Terminate under Win2K

I can not understand this problem so I am posting here to see if anyone else has
encountered it. This is a real headache for us since we frequently end up
rebooting after each fault we get in the de{*filter*}.

The synopsis: Terminating our application under the de{*filter*} causes a zombie
process that can not be killed and lingers for about 5 minutes.

When we debug a program under VC++ 6 and Windows 2K the process does not
terminate cleanly when you use the "Stop debugging" command to terminate the
debugged program. I have distilled this to a very small console mode application.
I just took all the defaults from the wizard for a "hello world" console mode
program and then added the multimedia calls that seem to cause the problem.

If I run this program and catch the fault under the de{*filter*} and then I use
the "stop debugging" command the application will terminate visually but task
manager shows that the application keeps running for about 5 minutes. You can not
attach to the process and you can not kill it via any means (kill command, task
manager etc). I suspect this effects other multimedia calls as well as midiInOpen
(). We have had the same problem with mciSendCmd().

#include "stdafx.h"
#include <windows.h>

#include <mmsystem.h>

int main(int argc, char* argv[])
{
        printf("Hello World!\n");

        HMIDIIN m_hMidiIn;
        DWORD dwRtn, dwNumDevs;

        DWORD dwInID = 0; // use first MIDI IN
        dwNumDevs = midiInGetNumDevs();
        if (dwNumDevs)
                dwRtn = midiInOpen(&m_hMidiIn, dwInID, 0, 0, CALLBACK_NULL);

        int *x = 0; // cause a fault
        *x = 0;

        return 0;

Quote:
}



Sun, 29 Jun 2003 06:24:53 GMT  
 Debugged Process will not Terminate under Win2K
I believe this is a bug in VC++ de{*filter*}; When ever you stop debugging while
the debuggee is stoppped (say after a break or hitting a bp or in your case
an AV), the de{*filter*} fails to cleanup properly.

Workarounds
0. Stop debugging while the debuggee is running
1. Doing a "go" (F5) and then Stop debugging (won't work for you since you
are at an unhandled AV)

The VS7 beta1 de{*filter*} doesn't have this issue


I can not understand this problem so I am posting here to see if anyone else
has
encountered it. This is a real headache for us since we frequently end up
rebooting after each fault we get in the de{*filter*}.

The synopsis: Terminating our application under the de{*filter*} causes a zombie
process that can not be killed and lingers for about 5 minutes.

When we debug a program under VC++ 6 and Windows 2K the process does not
terminate cleanly when you use the "Stop debugging" command to terminate the
debugged program. I have distilled this to a very small console mode
application.
I just took all the defaults from the wizard for a "hello world" console
mode
program and then added the multimedia calls that seem to cause the problem.

If I run this program and catch the fault under the de{*filter*} and then I use
the "stop debugging" command the application will terminate visually but
task
manager shows that the application keeps running for about 5 minutes. You
can not
attach to the process and you can not kill it via any means (kill command,
task
manager etc). I suspect this effects other multimedia calls as well as
midiInOpen
(). We have had the same problem with mciSendCmd().

#include "stdafx.h"
#include <windows.h>

#include <mmsystem.h>

int main(int argc, char* argv[])
{
printf("Hello World!\n");

        HMIDIIN m_hMidiIn;
DWORD dwRtn, dwNumDevs;

DWORD dwInID = 0; // use first MIDI IN
dwNumDevs = midiInGetNumDevs();
if (dwNumDevs)
dwRtn = midiInOpen(&m_hMidiIn, dwInID, 0, 0, CALLBACK_NULL);

int *x = 0; // cause a fault
*x = 0;

return 0;

Quote:
}



Sun, 29 Jun 2003 13:51:53 GMT  
 Debugged Process will not Terminate under Win2K
On NT, anyway, if a device driver has a pending IRP, and the process that opened
the device driver (the MIDI device driver in this case, opened by the call to
midiInOpen) attempts to terminate, the device driver must cancel the pending
IRPs, otherwise, the process will not terminate until the I/O manager has decided
that the IRPs have been{*filter*} around long enough. This timeout period is 5
minutes, so I suspect this might be the cause of the behaviour you are seeing.
Quote:
-----Original Message-----

I can not understand this problem so I am posting here to see if anyone else has
encountered it. This is a real headache for us since we frequently end up
rebooting after each fault we get in the de{*filter*}.

The synopsis: Terminating our application under the de{*filter*} causes a zombie
process that can not be killed and lingers for about 5 minutes.

When we debug a program under VC++ 6 and Windows 2K the process does not
terminate cleanly when you use the "Stop debugging" command to terminate the
debugged program. I have distilled this to a very small console mode application.
I just took all the defaults from the wizard for a "hello world" console mode
program and then added the multimedia calls that seem to cause the problem.

If I run this program and catch the fault under the de{*filter*} and then I use
the "stop debugging" command the application will terminate visually but task
manager shows that the application keeps running for about 5 minutes. You can not
attach to the process and you can not kill it via any means (kill command, task
manager etc). I suspect this effects other multimedia calls as well as midiInOpen
(). We have had the same problem with mciSendCmd().

#include "stdafx.h"
#include <windows.h>

#include <mmsystem.h>

int main(int argc, char* argv[])
{
        printf("Hello World!\n");

        HMIDIIN m_hMidiIn;
        DWORD dwRtn, dwNumDevs;

        DWORD dwInID = 0; // use first MIDI IN
        dwNumDevs = midiInGetNumDevs();
        if (dwNumDevs)
                dwRtn = midiInOpen(&m_hMidiIn, dwInID, 0, 0, CALLBACK_NULL);

        int *x = 0; // cause a fault
        *x = 0;

        return 0;
}
.



Mon, 30 Jun 2003 02:44:46 GMT  
 Debugged Process will not Terminate under Win2K

It is interesting that we have never seen this behaviour under NT, only 2000. It
may be that some of the 2000 multimedia drivers do not cancel the queued IRPs.
Hmmm.

Scot Crispin

Quote:
-----Original Message-----

On NT, anyway, if a device driver has a pending IRP, and the process that opened
the device driver (the MIDI device driver in this case, opened by the call to
midiInOpen) attempts to terminate, the device driver must cancel the pending
IRPs, otherwise, the process will not terminate until the I/O manager has decided
that the IRPs have been{*filter*} around long enough. This timeout period is 5
minutes, so I suspect this might be the cause of the behaviour you are seeing.



Mon, 30 Jun 2003 03:09:50 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. TerminateProcess not terminating process

2. WM_NCDESTROY not sent on process terminate?

3. Debugging ISAPI Extension on Win2K--not working?!?

4. Worker threads terminate gracefully under debug version, but not under release

5. How to debug a process launched by current process

6. attach to process in win2k broken

7. attach to process in win2k broken

8. vc++ 5.0; win2k - cant attach to process

9. Hiding Task and Process in WinNT And Win2K

10. Win2K logout process

11. Debigging non-debug process and debug DLL

12. Debugging child process, Startup .EXE for debugging DLL

 

 
Powered by phpBB® Forum Software