Inlets don't detect a silently dead (half-open) data connection

Aperta
#326 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@ethsanders ci sta già lavorando.

Dal 21/11/2026.

  • #346 di @ethsanders — aperta

Valutazione

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

Direzione di ricerca

Start with inlet_connection::watchdog_thread and try_recover to see why a resolvable UID skips reconnection, then check data_receiver and cancellable_streambuf for the blocking read with no timeout. Confirm the half-open case by blocking outlet-to-inlet TCP traffic for longer than WatchdogTimeThreshold and seeing whether pull_sample resumes. Done means the inlet recovers after the path returns, and the chosen approach (keep-alive, watchdog reconnect, or both) is agreed with maintainers first.

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

Descrizione

bug

Found by reading the code while documenting connection recovery (#324); not reproduced yet.

Problem. When the network path to an outlet disappears without a TCP FIN/RST (Wi-Fi drop, cable pulled, host suspended, a NAT/firewall forgetting the connection), the inlet's data connection becomes half-open:

  • liblsl does not enable TCP keep-alive on data connections (no keep_alive socket option anywhere in src/), and the inlet's blocking reads (data_receiver, via cancellable_streambuf) have no timeout.
  • The watchdog (inlet_connection::watchdog_thread, after WatchdogTimeThreshold without data) calls try_recover, which returns early if the stream's current UID can still be resolved.

So if the outlet process keeps running and becomes visible again (e.g. the Wi-Fi link comes back but the old TCP connection is dead), the UID is found, the watchdog does nothing, and the inlet stays blocked on the dead socket, with pull_sample returning no data indefinitely. With recover=false there is no watchdog at all.

Possible fixes (to discuss): enable TCP keep-alive with short intervals on data sockets; and/or let the watchdog reconnect (not only re-resolve) when no data arrived for WatchdogTimeThreshold on a regular-rate stream even though the UID is still visible.

To confirm: an outlet on machine A, inlet on machine B; block A↔B TCP traffic (e.g. firewall drop rule) for longer than WatchdogTimeThreshold, then unblock; check whether the inlet resumes.

Lingua principale
C++
Stelle
184
Fork
94
Merge medio
1g 14h
PR unite (30g)
6

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

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 sccn/liblsl

Tutte le issue di sccn/liblsl

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.