[Tarantool-patches] [PATCH] test: fix flaky socket test

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Tue Dec 17 03:03:38 MSK 2019


Hi! Thanks for the fixes!

>     [008] -- true
>     [008] +- false
>     [008] ...
>     [008] received_message
>     [008] ---
>     [008] -- null
>     [008] +-
>     [008] ...
>     [008] from == nil -- expected true
>     [008] ---
>     [008] -- true
>     [008] +- false
>     [008] ...
>     [008] from
>     [008] ---
>     [008] -- null
>     [008] +- host: 127.0.0.1
>     [008] + family: AF_INET
>     [008] + port: 59867
>     [008] ...
>     [008] e == errno.EAGAIN -- expected true
>     [008] ---
>     [008] -- true
>     [008] +- false
>     [008] ...
>     [008] -- case: recv, zero datagram, explicit size
>     [008] sendto_zero(sending_socket, '127.0.0.1', receiving_socket_port)
>     =========================================================================
> 
>     So socket.test.lua still is unstable. The command with 64
>     socket.test.lua gives me an error in 100% cases.
> 
> 4. Ok, I guess these are mac os specific issues. I haven't got mac os
> machine access yet, however, I hope to get it soon and fix these problems.
> I still tried to stabilize these cases; if it don't work, I will reconsider them later.
> 

These are UDP issues, not Mac. See my commit with review fixes for details.

>     > 6. If we close socket in the main fiber, we might attempt to use closed
>     > socket in background fiber.
> 
>     And what? We don't care anymore for the background
>     fiber after the socket is not needed anymore. Ok, it will
>     stumble into errors in that fiber, but how does it affect
>     further execution of the test?
> 
> 6. It affects further test execution, as far as it leads
> to the following error:
> 
> |[015] c:receive("*l", "Line: ") [015] --- [015] - null [015] -- closed [015] -- 'Line: Fu' [015] +- Connection reset by peer|
> 
> 

Yeah, I've seen that error. But what I wanted to see here is why
that error happens. Not just what happens. But why.

I did investigation, and found that here:

    wch:put("Fu")
    c:send("354 Please type your message\n")
    sc:close()
    c:receive("*l", "Line: ")

it was possible, that put(), send() and close() finish
before the worker fiber manages to send anything to the
client. I've tried to find a better fix, but all of them
after all are about having a flag in the worker fiber,
so your version is ok.


More information about the Tarantool-patches mailing list