WaitForSingleObject Errors only in Release mode..

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".
Who is Participating?
jhanceConnect With a Mentor Commented:
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.
>>Debug works great, but in release, it fails

This usually points to uninitialized varibles (esp. pointers) - can you post some code?
is this line inside some class member function ? invalid pointers somewhere ? post the code .
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Roshan DavisCommented:
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..

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
ChizlAuthor Commented:
Hummm   Can't change it to 50..   How do I close it out?
ChizlAuthor Commented:
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..
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
>>Please give the points to jhance, becasue he needs them the most.

What kind of a comment is this?
ChizlAuthor Commented:
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..
>>What kind of a comment is this?
A bit of levity, to brighten an otherwise dull day.  No harm done, I hope?
-- Dan
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.