Discussion:
strange Application Verifier error Invalid Handle ...
(too old to reply)
Stan
2008-05-01 00:34:29 UTC
Permalink
Application Verifier is reporting a very strange error: "Invalid handle
exception for current stack trace."

The stack trace is nowhere near our application code. Moreover,
if I launch our GUI App from the command-line, it works. But if I double
click
on the executable in explorer or use a StartMenu shortcut, this error is
reported.

I am running XP SP2. A coworker tried this with a Vista machine, and he does
not see this error.

Could app-verifier be generating an error in a different thread then where
the error
is actually occurring?

App Verifier 3.4.0158

full Application Verifier log:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
- <avrf:logfile xmlns:avrf="Application Verifier">
- <avrf:logSession TimeStarted="2008-04-30 : 15:53:53" PID="4636" Version="2">
- <avrf:logEntry Time="2008-04-30 : 15:53:58" LayerName="Handles"
StopCode="0x300" Severity="Error">
<avrf:message>Invalid handle exception for current stack
trace.</avrf:message>
<avrf:parameter1>c0000008 - Exception code.</avrf:parameter1>
<avrf:parameter2>f79f264 - Exception record. Use .exr to display
it.</avrf:parameter2>
<avrf:parameter3>f79f278 - Context record. Use .cxr to display
it.</avrf:parameter3>
<avrf:parameter4>0 - Not used.</avrf:parameter4>
- <avrf:stackTrace>
<avrf:trace>vfbasics!VfBasicsStopMessage+d1</avrf:trace>
<avrf:trace>vfbasics!AVrfpVectoredExceptionHandler+9b</avrf:trace>
<avrf:trace>ntdll!RtlInitializeSListHead+9dbf</avrf:trace>
<avrf:trace>ntdll!LdrAddRefDll+1c1</avrf:trace>
<avrf:trace>ntdll!KiUserExceptionDispatcher+e</avrf:trace>
<avrf:trace>ntdll!KiFastSystemCallRet+0</avrf:trace>
<avrf:trace>KERNEL32!WriteFile+6f</avrf:trace>
</avrf:stackTrace>
</avrf:logEntry>
</avrf:logSession>
</avrf:logfile>
Dan Mihai [MSFT]
2008-05-01 14:52:33 UTC
Permalink
Looks like the stack trace from the bottom of your message (from the log
file) is truncated. The symbols look a bit suspect but apparently someone
called WriteFile and there was an invalid handle reference while WriteFile
was running. In most cases, the problem is that the handle specified as
parameter to WriteFile was incorrect. The first step is to see who was
trying to write to that file - that's probably the culprit.

I recommend using a debugger rather than the log file to figure this out.
These help topics might help:
1. From appverif.chm:
- Handles Stop Details
- Debugging Handles Errors
2. From debugger.chm
(http://www.microsoft.com/whdc/devtools/debugging/installx86.mspx#a):
- !htrace

Dan
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Post by Stan
Application Verifier is reporting a very strange error: "Invalid handle
exception for current stack trace."
The stack trace is nowhere near our application code. Moreover,
if I launch our GUI App from the command-line, it works. But if I double
click
on the executable in explorer or use a StartMenu shortcut, this error is
reported.
I am running XP SP2. A coworker tried this with a Vista machine, and he does
not see this error.
Could app-verifier be generating an error in a different thread then where
the error
is actually occurring?
App Verifier 3.4.0158
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
- <avrf:logfile xmlns:avrf="Application Verifier">
- <avrf:logSession TimeStarted="2008-04-30 : 15:53:53" PID="4636" Version="2">
- <avrf:logEntry Time="2008-04-30 : 15:53:58" LayerName="Handles"
StopCode="0x300" Severity="Error">
<avrf:message>Invalid handle exception for current stack
trace.</avrf:message>
<avrf:parameter1>c0000008 - Exception code.</avrf:parameter1>
<avrf:parameter2>f79f264 - Exception record. Use .exr to display
it.</avrf:parameter2>
<avrf:parameter3>f79f278 - Context record. Use .cxr to display
it.</avrf:parameter3>
<avrf:parameter4>0 - Not used.</avrf:parameter4>
- <avrf:stackTrace>
<avrf:trace>vfbasics!VfBasicsStopMessage+d1</avrf:trace>
<avrf:trace>vfbasics!AVrfpVectoredExceptionHandler+9b</avrf:trace>
<avrf:trace>ntdll!RtlInitializeSListHead+9dbf</avrf:trace>
<avrf:trace>ntdll!LdrAddRefDll+1c1</avrf:trace>
<avrf:trace>ntdll!KiUserExceptionDispatcher+e</avrf:trace>
<avrf:trace>ntdll!KiFastSystemCallRet+0</avrf:trace>
<avrf:trace>KERNEL32!WriteFile+6f</avrf:trace>
</avrf:stackTrace>
</avrf:logEntry>
</avrf:logSession>
</avrf:logfile>
Stan
2008-05-01 16:22:00 UTC
Permalink
We tracked the issue to the default console appenders of log4net and log4j.
These appenders try to log to console (STDOUT) when the application does not
actually have a console. This makes App Verifier angry.

But, when you launch the windows app from a command prompt, it inherits
the console from the parent and all is well.

thanks,

stan
Post by Dan Mihai [MSFT]
Looks like the stack trace from the bottom of your message (from the log
file) is truncated. The symbols look a bit suspect but apparently someone
called WriteFile and there was an invalid handle reference while WriteFile
was running. In most cases, the problem is that the handle specified as
parameter to WriteFile was incorrect. The first step is to see who was
trying to write to that file - that's probably the culprit.
I recommend using a debugger rather than the log file to figure this out.
- Handles Stop Details
- Debugging Handles Errors
2. From debugger.chm
- !htrace
Dan
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Post by Stan
Application Verifier is reporting a very strange error: "Invalid handle
exception for current stack trace."
The stack trace is nowhere near our application code. Moreover,
if I launch our GUI App from the command-line, it works. But if I double
click
on the executable in explorer or use a StartMenu shortcut, this error is
reported.
I am running XP SP2. A coworker tried this with a Vista machine, and he does
not see this error.
Could app-verifier be generating an error in a different thread then where
the error
is actually occurring?
App Verifier 3.4.0158
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
- <avrf:logfile xmlns:avrf="Application Verifier">
- <avrf:logSession TimeStarted="2008-04-30 : 15:53:53" PID="4636" Version="2">
- <avrf:logEntry Time="2008-04-30 : 15:53:58" LayerName="Handles"
StopCode="0x300" Severity="Error">
<avrf:message>Invalid handle exception for current stack
trace.</avrf:message>
<avrf:parameter1>c0000008 - Exception code.</avrf:parameter1>
<avrf:parameter2>f79f264 - Exception record. Use .exr to display
it.</avrf:parameter2>
<avrf:parameter3>f79f278 - Context record. Use .cxr to display
it.</avrf:parameter3>
<avrf:parameter4>0 - Not used.</avrf:parameter4>
- <avrf:stackTrace>
<avrf:trace>vfbasics!VfBasicsStopMessage+d1</avrf:trace>
<avrf:trace>vfbasics!AVrfpVectoredExceptionHandler+9b</avrf:trace>
<avrf:trace>ntdll!RtlInitializeSListHead+9dbf</avrf:trace>
<avrf:trace>ntdll!LdrAddRefDll+1c1</avrf:trace>
<avrf:trace>ntdll!KiUserExceptionDispatcher+e</avrf:trace>
<avrf:trace>ntdll!KiFastSystemCallRet+0</avrf:trace>
<avrf:trace>KERNEL32!WriteFile+6f</avrf:trace>
</avrf:stackTrace>
</avrf:logEntry>
</avrf:logSession>
</avrf:logfile>
Loading...