Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERL-1076: Unsafe receive optimization causes bug in socket.erl #4036

Closed
OTP-Maintainer opened this issue Oct 28, 2019 · 3 comments
Closed

ERL-1076: Unsafe receive optimization causes bug in socket.erl #4036

OTP-Maintainer opened this issue Oct 28, 2019 · 3 comments
Assignees
Labels
bug Issue is reported as a bug priority:medium team:VM Assigned to OTP team VM

Comments

@OTP-Maintainer
Copy link

Original reporter: bjorn
Affected version: OTP-22.1
Component: compiler
Migrated from: https://bugs.erlang.org/browse/ERL-1076


The compiler does an unsafe optimization of the code of the following lines in {{socket}}:

https://github.com/erlang/otp/blob/f3e3ceb55/erts/preloaded/src/socket.erl#L2207-L2239

The compiler will apply the optimization that avoids scanning the entire message. In this function, the optimization is unsafe because the receive marker will be set, but the function can return without entering the {{receive}}.

This optimization causes the bug in {{socket}} described by this email to Erlang Questions:

http://erlang.org/pipermail/erlang-questions/2019-October/098591.html

@OTP-Maintainer
Copy link
Author

bjorn said:

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

@OTP-Maintainer
Copy link
Author

bjorn said:

There is another bug in the run-time system. Here are the details:

http://erlang.org/pipermail/erlang-questions/2019-October/098660.html

@OTP-Maintainer
Copy link
Author

g-andrade said:

As a nitpick, I would suggest editing the link to the code excerpt in the description and refer to a specific commit[*], so that it doesn't risk pointing to a different piece of code in the future (it's currently pointing to `master`.)

(I've shot myself in the foot more than once with this sort of thing.)

[*]: https://github.com/erlang/otp/blob/f3e3ceb55/erts/preloaded/src/socket.erl#L2207-L2239

@OTP-Maintainer OTP-Maintainer added bug Issue is reported as a bug team:VM Assigned to OTP team VM priority:medium labels Feb 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is reported as a bug priority:medium team:VM Assigned to OTP team VM
Projects
None yet
Development

No branches or pull requests

2 participants