Solved

WaitForSingleObject Errors only in Release mode..

Posted on 2002-07-01
11
371 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
 
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

762 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now