Subject: Re: [boost] asio loopback behavior, windows vs. linux
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2010-06-07 20:07:13


AMDG

Adam Crain wrote:
> I have constructed a test that talks to an echo server across the loopback.
>
> The test steps are:
>
> 1) Open the socket using run_one(), verifying it is open
> 2) Start an async read
> 3) Start an async write
> 4) Call run_one, then verify the write succeeds
> 5) Call run_one, then verify that the data you write is received
> 6) Goto step 2 some number of times since the behavior is
> non-determinsitic
>
> One windows, this seems to consistently fail within the first 100
> iterations, because on occasional you get the read callback with echoed data
> before the write success comes back!!!!
>
> <snip>
>
> 1) This can actually happen with Windows loopback + thread scheduling
> and my assumption that write callbacks will always occur before response
> data is invalid.
>

Yes. This assumption is invalid. The order in which the callbacks
are executed is unspecified.

In Christ,
Steven Watanabe