[Tarantool-patches] [PATCH] coio: handle spurious wakeup correctly

Serge Petrenko sergepetrenko at tarantool.org
Wed Nov 17 10:33:42 MSK 2021

17.11.2021 01:49, Vladislav Shpilevoy пишет:
> Hi! Thanks for the patch!

Thanks for your answer!

> On 16.11.2021 11:17, Serge Petrenko via Tarantool-patches wrote:
>> coio_accept, coio_read, coio_write, coio_writev used to handle spurious
>> wakeups correctly: if the timeout hasn't passed yet, they would simply
>> retry reading (or writing) and fall asleep once again if no data is
>> ready.
>> This behaviour changed in the following patches:
>> 577a640a7fdec986d19101ed04d2afa80e951c78 ("coio: pass fd to
>> coio_accept") and 4f84859dcdd6126b0bdcda810b7f5f58386bdac6 ("Introduce
>> iostream wrapper for socket I/O").
>> Now the functions timeout on the very first spurious wakeup.
>> Fix this, add the appropriate unit tests and a test_iostream
>> implementation for the ease of testing.
> Don't we have the same problem with coio_connect_addr() (used in
> coio_connect_timeout())?
Not really. Neither coio_connect_addr() nor coio_connect_timeout() retry
the connection. So even the previous version would throw an error after
a spurious wakeup. Just the error would be different.
Before the change it would throw SocketError, not TimedOut, but I don't 
this matters much. Does it?

By the change I mean (2db0741b) "coio: return fd from coio_connect".

Serge Petrenko

More information about the Tarantool-patches mailing list