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 with UDP and timeout #9172

Open
pguyot opened this issue Dec 10, 2024 · 0 comments
Open

socket:recv/3 inconsistent behavior on Linux with UDP and timeout #9172

pguyot opened this issue Dec 10, 2024 · 0 comments
Labels
bug Issue is reported as a bug

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 explaination in OTP27.0 release notes.

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 OTP25 and OTP27 and {error, {timeout, Data}} on OTP26. On macOS, all three versions return {ok, 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).

@pguyot pguyot added the bug Issue is reported as a bug label Dec 10, 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
Projects
None yet
Development

No branches or pull requests

1 participant