Does anybody know under which circumstances reading from a Named Pipe
may return an ERROR_ALREADY_EXISTS (183) error?
In our case, the pipe has been used successfully for some time, and
then GetOverlappedResult() returns this error.
The sequence is:
ReadFile (...); // overlapped IO, call succeeds with
ERROR_IO_PENDING
WaitForSingleObject (...) // waiting for the event associated with the
overlapped IO
GetOverlappedResult (...) // Returns ERROR_ALREADY_EXISTS
There is only a single thread accessing the named pipe. It's partner
is still alive. Until now it only occurs on some computers of a
customer of ours, but we have not been able to find out what makes
these machines different. Googling did not return relevant results.
TIA,
Jeroen
I assume you mean GetOverlappedResult returns non-zero and then
GetLastError returns ERROR_ALREADY_EXISTS, right? If you're not 100%
sure, make sure.
And you are 100% sure the overlapped object is from the ReadFile
operation? And the handle you passed to GetOverlappedResult is the
handle to the pipe?
In all other cases (at least that I know of), ERROR_ALREADY_EXISTS is
actually a success indication. So most likely, the operating has
actually succeeded.
DS
Argh. Please disregard. It appears that something was resetting
GetLastError() in between the calls.
> I assume you mean GetOverlappedResult returns non-zero and then
> GetLastError returns ERROR_ALREADY_EXISTS, right? If you're not 100%
> sure, make sure.
I apologize for wasting your time. It appears that another call (.Net
marshalling) reset GetLastError() in between the calls.
Thanks anyway!
> I apologize for wasting your time. It appears that another call (.Net
> marshalling) reset GetLastError() in between the calls.
> Thanks anyway!
No problem. I learned a few things myself while researching your
answer.
That's a surprisingly common mistake. That's why the first thing I
said is to 100% make sure you were really seeing what you thought you
were seeing.
Glad you got it sorted out.
DS