[erlang-questions] OTP 22.1 socket.erl somehow breaks message delivery or scheduler

Björn Gustavsson bjorn@REDACTED
Mon Oct 28 15:22:06 CET 2019


Thanks for reporting this issue.

We have investigated the issue and found that it is a bug in the compiler.

https://bugs.erlang.org/browse/ERL-1076

https://github.com/erlang/otp/pull/2434

/Björn

On Wed, Oct 23, 2019 at 3:53 PM Andreas Schultz
<andreas.schultz@REDACTED> wrote:
>
> Hi,
>
> After converting an application to socket.erl in OTP 22.1, the test suites started to fail with random timeouts. It took me a while to figure out that gen_server:calls arrived multiple seconds late in the server.
>
> I have a demonstration at https://gist.github.com/RoadRunnr/311a7679fff6fbdf367c455b960f1ba8. It implements a simple UDP echo server with socket.erl. The client uses gen_udp to send messages and wait for the response.
> The client also sends Erlang ping message to the server and expects to get a pong answer back. The socket.erl based server is supposed to not block (and as far as I can tell, it does not), it therefore should be able to answer the Erlang ping message all the time.
> There are also some simple busy loop process running to get some load. Without them the problem is not reproducible.
>
> The sample is failing in about 20% off the test runs, when it does the output is something like:
>
> $ ~/stest.escript
> Server Pid <0.78.0>
> Server Addr #{addr => {127,0,0,1},family => inet,port => 38959}
> ping timeout
>            round trip    Clnt/Srvr    Srvr/Clnt     ProcPing
> ...
>       85: ******** ns, ******** ns,    57675 ns,    42332 ns
> ...
>
> The failure happens because a 'ping' message is not see in time by the receive clause in the server process. It seems that either the process is not scheduled for some time (multiple seconds), or the scanning of the mailbox is missing the message.
>
> I have ruled out that the UDP messages are being dropped, otherwise the clients gen_udp:recv would never return.
>
> Does anyone have a clue what might cause this? Or point out where my sample is broken.
>
> Many thanks
> Andreas
>
> --
>
> Andreas Schultz
>
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions



-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB



More information about the erlang-questions mailing list