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

Andreas Schultz andreas.schultz@REDACTED
Tue Oct 29 09:14:29 CET 2019

Am Di., 29. Okt. 2019 um 07:07 Uhr schrieb Björn Gustavsson <

> On Mon, Oct 28, 2019 at 4:39 PM Andreas Schultz <
> andreas.schultz@REDACTED> wrote:
>> Am Mo., 28. Okt. 2019 um 15:22 Uhr schrieb Björn Gustavsson <
>> bjorn@REDACTED>:
>>> Thanks for reporting this issue.
>>> We have investigated the issue and found that it is a bug in the
>>> compiler.
>> wow. I have to say I'm a bit scared of OTP 22.x at the moment because of
>> all the "bugs in the compiler" changes lately.
>> Did the rewrite of the compiler in 22.0 cause all this or was it present
>> before and just went unnoticed?
> It is a new bug in OTP 22. This particular
> bug was in the new optimization pass for
> optimizing receives.
> There are more details in our blog, but the short
> story is that we had reached a dead end in the
> compiler and that it was very time consuming
> and error prone to add new optimizations to
> the compiler.

I'm sure that over time all the benefits of the new compiler architecture
are well worth the price.
But for OTP 22.x it has led to a few, but highly frustrating problems. Even
the few incorrect code generation bugs have led to very hard to understand
problems for the users.

I'm not sure that scope and impact of this bug here is even fully

My demonstration code used a bare receive, but the code that actually
triggered it used a plain gen_server. The result of the bug was that
gen_sever:calls seemed to arrive extremely late (multiple seconds).
It would therefore seem that the incorrect code was present in main receive
loop of gen_server (and probably also gen_statem and gen_event). This would
mean almost all Erlang applications on OTP 22.x could be affected.

The effects might go unnoticed in many tests cases in other projects, until
it causes unexplainable failures.

Since all this was introduced in OTP 22, the sensible suggestion for
everyone seem to be test OTP 22.x as well as they can, but to stay away
from it for production use.

Most of the reported compiler bugs in OTP 22
> was of the kind that causes the compiler to crash.
> Those bugs are annoying but basically harmless in
> that they can't subtly change the meaning of your
> program. Unfortunately, a few bugs were of the kind
> that the compiler generated incorrect code.
> Moving forward, the new compiler architecture
> will give us a solid ground for further improvements
> of the compiler.

I'm sure it will and I'm sure the current pain is well worth it.


> /Björn
> --
> Björn Gustavsson, Erlang/OTP, Ericsson AB
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20191029/6fb18054/attachment.htm>

More information about the erlang-questions mailing list