Solved

WaitForSingleObject Errors only in Release mode..

Posted on 2002-07-01
11
374 Views
Last Modified: 2008-03-06
I have a Winsock application using Overlapped I/O.  I have looked and I have all the same libs and includes for release that I have for debug, but when starting up our application in release mode, it crashes on:
WaitForSingleObject(RxEvent, INFINITE);

There are no compile errors or warnings.   Debug works great, but in release, it fails..   Anyone have this issue before?

Actual Error:
The instruction at "0x0a646574" referenced memory at "0x0a646574".  The memory could not be "read".
0
Comment
Question by:Chizl
  • 3
  • 3
  • 2
  • +3
11 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 7123314
>>Debug works great, but in release, it fails

This usually points to uninitialized varibles (esp. pointers) - can you post some code?
0
 
LVL 22

Expert Comment

by:ambience
ID: 7123601
is this line inside some class member function ? invalid pointers somewhere ? post the code .
0
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 7123736
You are doing an asynchronous reading.
I don't know, may be becoz of some problems in handling the IO Completion callback handling.

Please Quote some code.

Becoz of non-blocking operation (overlapped IO), you have to use some callback for IO completion..

Roshmon
0
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
LVL 49

Expert Comment

by:DanRollins
ID: 7123743
It is unlikely that that particular line is causing that particular error:  It does not reference memory directly.  The RxEvent value may be wrong, but it is a handle.  Be sure to initialize it to zero then ASSERT if it is 0 before calling WaitForSingleObject.  Then the problem will surely be visible in debug build.

Are you certain that the problem is with that line of code?  I ask becasue in Release mode, one normally does not get information as to the line of code that causes the problem.

One tip:
You can make a Release Build that contains symbols.  Then you can place breakpoints and excute it.  When you get a GPF, the call stack may have some meaningful information.

-- Dan
0
 
LVL 32

Accepted Solution

by:
jhance earned 400 total points
ID: 7124469
RxEvent refers to an invalid handle, perhaps it's NULL.  Did you forget to initialize it?  What is its value before calling WaitForSingleObject?  A good place for an ASSERT would be here.
0
 
LVL 4

Author Comment

by:Chizl
ID: 7125397
Hummm   Can't change it to 50..   How do I close it out?
0
 
LVL 4

Author Comment

by:Chizl
ID: 7125399
Thanx all,

I don't know what the problem was, but it worked about 3 months ago and not much of anything had changed since then, so I just rolled back my versioning for that cpp and it works now..   I can't post the code, because every function relies on the other function, so I would end up posting the whole CPP, which is very large.    It has call backs and link lists for the multi messages from one socket, and link lists for the multi sockets, etc..   as you can tell this is a very complex application and a lot here, so posting a snippet would only hinder the problem..

I have it working now, but appreciate everyone's effort..  Wish I could give you all some points just for the effort..

I changed the points to 50 and accept the first comment, just to close this out.

Again thanx all..
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7125515
You must post to Community Support in order to get a Moderator to make changes to this question such as you desire.  Please give the points to jhance, becasue he needs them the most.

It is unusual for a user to request to lower the point value of a question.  More commonly, you would just request a refund.  Say that you solved it yourself and that you don't want to thank the experts who helped you, so please refund the points.  Be sure to post the QID of this question.

-- Dan
0
 
LVL 32

Expert Comment

by:jhance
ID: 7125598
>>Please give the points to jhance, becasue he needs them the most.

What kind of a comment is this?
0
 
LVL 4

Author Comment

by:Chizl
ID: 7125814
Haha..  Dan..  I have been on this website before it was a website..  I understand the points, and noone here actually helped me, but I don't care who gets the points.  I know people get piss off if they think they deserved the points more than the person that gets the points.  I was just trying to be fair and the only way to do that was not to give them to anyone since I fixed it on my own.

If everyone says give them to jhance, then I will, not a problem..  I don't ask enough questions to use all my points ever anyway..
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7125898
>>What kind of a comment is this?
A bit of levity, to brighten an otherwise dull day.  No harm done, I hope?
-- Dan
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question