ssl:recv/2 has no timeout (no ssl:recv/3)
Maintainers usually reply within 3 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 55/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- erlang
- Domain
- networking
Research direction
Start in libs/estdlib/src/ssl.erl at ssl:recv/2 and its want_read select notification handling; compare the timeout behavior in AtomVM's gen_tcp or socket APIs and OTP's ssl:recv/3. Done means recv/3 accepts a timeout, recv/2 behaves as an infinite-timeout call, and a timed-out receive cancels its select and returns {error, timeout}.
Written by the indexing model from the issue text.
Description
ssl:recv/2 (libs/estdlib/src/ssl.erl) waits on want_read with a bare receive for the select notification:
receive
{'$socket', Socket, select, Ref} -> recv0(...);
{'$socket', Socket, abort, {Ref, closed}} -> {error, closed}
end
If the peer stops sending but the TCP connection isn't closed (NAT drop, cellular link stall, a server that stops mid-stream), the call never returns. OTP has ssl:recv/3 with a Timeout, and gen_tcp/socket in AtomVM already accept timeouts, but ssl exports only recv/2.
We hit this on ESP32 downloading firmware over HTTPS through a 4G modem: the stream stalled and the process sat in ssl:recv/2 until we added an external watchdog that kills it.
Proposal: add recv/3 with Timeout :: timeout() (recv/2 = recv(S, L, infinity)), with an after clause that cancels the select (socket:nif_select_stop/1 or equivalent) and returns {error, timeout}, as OTP does. Happy to send a PR.
- Dominant language
- Erlang
- Stars
- 2.3k
- Forks
- 171
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 20
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from atomvm/AtomVM
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 3 days
-
lwIP sockets: a failed listen or connect leaves the socket lock held, a later close hangs foreverOpen
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 3 days
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
home-assistant/supervisor#7497 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
sipeed/NanoKVM-Go#36 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 6 days
-
issue: bug report
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
pythonnative/pythonnative#125 ·