random crash / heap debug with application verifier

Hey, I wrote a program using VS2010 communicating with 2 USB devices and processing the data they send. The program is working, but for some reason it sometimes crash randomly, throwing a USB Read timeout exception.
The USB devices are perfectly working and the test project I wrote using their API is never crashing, so I think it has nothing to do with a USB timeout.

I tried to investigate raise conditions, so I serialized all my threads access to the USB with mutexes, but it didn't solve the problem.

I also tried to investigate memory leaks with CRTDBG functions and corrected a few leaks, but it also didn't solve the problem, and I don't see any leak left.

I'm now trying to investigate heap/stack corruption, but I'm quite a beginner in that. I'm using Application Verifier, and when I activate the "heaps" tests the visual studio debugger is breaking on an access violation. Surprisingly it is breaking in an header file which is not even executed by my program, (written for other usb devices) and I don't understand why it is breaking there. If I set a breakpoint at this place and run the program step by step the breakpoint never get hit so I guess it is not relevant.

The detailed error is:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
First-chance exception at 0x007976a6 in USB.exe: 0xC0000005: Access violation reading location 0x054f0008.


=======================================
VERIFIER STOP 00000002: pid 0xE30: Access violation exception. 

	054F0008 : Invalid address causing the exception
	007976A6 : Code address executing the invalid access
	0012F208 : Exception record
	0012F224 : Context record


=======================================
This verifier stop is not continuable. Process will be terminated 
when you use the `go' debugger command.

=======================================

USB.exe has triggered a breakpoint
AVRF: Noncontinuable verifier stop 00000002 encountered. Terminating process ... 
The thread '_threadstartex' (0x1038) has exited with code -1073741823 (0xc0000001).
The thread '_threadstartex' (0x17fc) has exited with code -1073741823 (0xc0000001).
The thread '_threadstartex' (0xff8) has exited with code -1073741823 (0xc0000001).
The thread 'EsvCmdThreadProc' (0x129c) has exited with code -1073741823 (0xc0000001).
The thread 'Main Thread' (0xd48) has exited with code -1073741823 (0xc0000001).
The thread '_threadstartex' (0x868) has exited with code -1073741823 (0xc0000001).
The program '[3632] USB.exe: Native' has exited with code -1073741823 (0xc0000001). 


I don't post any code at the moment since the program is really big and I don't know where the problem comes from. I would really appreciate any help on this, I've been spending a lot of time to find this bug but unsuccessfully at the moment :/
Last edited on
Topic archived. No new replies allowed.