Skip to main content

Module loss_signal

Module loss_signal 

Source
Expand description

A live signal of frame loss that a Session’s owner can read.

FrameLossReport counts and logs loss per window. That is the right shape for a log line and the wrong one for a decision: the window closes every FRAME_LOSS_REPORT_INTERVAL, so a reader would learn about a lost frame up to half a minute after the fact, and a Session whose loss stopped would still look lossy for the rest of the window.

This signal is that reader’s view, and it exists because the Exit has a reason to act on loss within seconds: while it is not reassembling frames, the only replies that reach the Entry are its own SURB-level reports, and one sent every surb_balance_notify_period (15 s by default) puts the Entry’s verdict on a dead relayer twelve to twenty-eight seconds after the kill instead of about eleven. Reporting faster while the Exit is losing frames is what closes that gap, and this is what tells it that it is.

Unlike the log window, the signal is never reset: a loss is remembered until it ages past whatever window an observer asks about.

§Stalls

A loss is known late. A frame is lost when its reassembly times out, frame_timeout after its last segment arrived, and while segments keep arriving the reassembler looks for timed-out frames only once per timeout: three to six seconds at the Exit’s 3 s default before the first loss of a forward path that went dark. The signal therefore also follows the frames as they arrive. Segments of two new frames since a frame last completed or was lost, with none completing for a while, is a forward path that delivers segments but no frames, and that shows within a second (stalled_for). A single frame arriving slowly is not a stall: the next frame starts only once its own segments are all sent. A sender that stops while frames are stalled does not end the stall, since a sender commonly stops exactly because nothing comes back; the frames’ timeouts end it, as a loss.

Structs§

FrameLossSignal
Records frame loss as recent activity, for a reader that has to act on it within seconds.