Prev: Deadly embrace between SetUnhandledExceptionFilter() and threadrundown(???) in Server 2003
Next: To check POP3 mailbox from Visual C++ app
From: Jeroen ter Hofstede on 22 Jan 2010 06:07 Hi all, 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
From: David Schwartz on 22 Jan 2010 09:16 On Jan 22, 3:07 am, Jeroen ter Hofstede <jeroen.ter.hofst...(a)wanadoo.nl> wrote: > Hi all, > > 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 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
From: Jeroen ter Hofstede on 22 Jan 2010 09:22 On 22 jan, 12:07, Jeroen ter Hofstede <jeroen.ter.hofst...(a)wanadoo.nl> wrote: > Hi all, > > Does anybody know under which circumstances reading from a Named Pipe > may return an ERROR_ALREADY_EXISTS (183) error? Argh. Please disregard. It appears that something was resetting GetLastError() in between the calls.
From: Jeroen ter Hofstede on 22 Jan 2010 09:26 On 22 jan, 15:16, David Schwartz <dav...(a)webmaster.com> wrote: > 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!
From: David Schwartz on 22 Jan 2010 11:57
On Jan 22, 6:26 am, Jeroen ter Hofstede <jeroen.ter.hofst...(a)gmail.com> wrote: > 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 |