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

socket:recv/3 inconsistent behavior on Linux (OTP 26) and on OTP27.1.3 with UDP and timeout #9172

Open
pguyot opened this issue Dec 10, 2024 · 0 comments
Assignees
Labels
bug Issue is reported as a bug team:PS Assigned to OTP team PS

Comments

@pguyot
Copy link
Contributor

pguyot commented Dec 10, 2024

Describe the bug
On Linux, using docker containers, I can see an inconsistent behavior between OTP25, OTP26 and OTP27 and I couldn't find an explanation in OTP27.0 release notes. On macOS, the behavior is inconsistent with OTP27.1.3, which I didn't try on Linux. It may be related to OTP-19328.

socket:recv/3 (not socket:recvfrom/3) with an UDP IPv4 socket, a Length greater than available data and a positive timeout will return {ok, Data} on OTP 25 and OTP 27.0 and OTP 27.1 and {error, {timeout, Data}} on OTP 26. On macOS, OTP 25, OTP 26.2.5.5 and OTP 27.1.2 return {ok, Data}, but OTP 27.1.3 returns {error, {timeout, Data}}.

To Reproduce

podman run -it docker.io/erlang:26

then:

Addr = #{family => inet, addr => {127, 0, 0, 1}, port => 12345},
{ok, Socket1} = socket:open(inet, dgram, udp),
ok = socket:setopt(Socket1, {socket, reuseaddr}, true),
ok = socket:bind(Socket1, Addr),
{ok, Socket2} = socket:open(inet, dgram, udp),
spawn(fun() -> timer:sleep(500), ok = socket:sendto(Socket2, <<"Hello">>, Addr) end),
socket:recv(Socket1, 10, 5000).

Affected versions
OTP26 (tested with 26.0, 26.1 and 26.2.5.2).
OTP27.1.3 (tested on macOS x86 and ARM)

@pguyot pguyot added the bug Issue is reported as a bug label Dec 10, 2024
@IngelaAndin IngelaAndin added the team:PS Assigned to OTP team PS label Dec 11, 2024
@pguyot pguyot changed the title socket:recv/3 inconsistent behavior on Linux with UDP and timeout socket:recv/3 inconsistent behavior on Linux (OTP 26) and on OTP27.1.3 with UDP and timeout Dec 14, 2024
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 team:PS Assigned to OTP team PS
Projects
None yet
Development

No branches or pull requests

3 participants