socket_dist_controller: sends can block the controller and hide a dead peer

Aperta
#2,424 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
47/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
erlang

Direzione di ricerca

Start with libs/estdlib/src/socket_dist_controller.erl, especially the tick handler and send_data_loop, and trace how the controller stores pending data and handles socket notifications. Check OTP distribution's nowait send behavior for context. Done means sends no longer block the controller, pending data resumes on write notification, and a blocked send beyond the tick timeout fails the connection.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

socket_dist_controller (libs/estdlib/src/socket_dist_controller.erl) sends with socket:send/2 from the tick handler and from send_data_loop.

Since #2345, socket:send/2 waits for the socket to be writable again when the send buffer is full. If the peer stops reading (a hung node, a dead link not yet detected by TCP), the controller gen_server blocks in socket:send/2. It also stops handling tick, which is what should detect a dead peer.

OTP's distribution uses nowait sends for this reason: the controller keeps running, and the sender is notified when the socket can be written.

Possible direction: send with a nowait variant (or socket:nif_send/2 and nif_select_write/2 directly) from the controller, keep the unsent rest in the state, resume from the write notification, and treat a blocked send that lasts longer than the tick timeout as a failed connection.

Raised by @bettio in the review of #2345, where a follow-up issue was agreed.

Lingua principale
Erlang
Stelle
2.3k
Fork
171
Merge medio
5g 11h
PR unite (30g)
19

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di atomvm/AtomVM

Tutte le issue di atomvm/AtomVM

Issue simili

Altre issue su Backend & API Design

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.