iovisor/bcc

Incorrect calculation of recv throughput in tcptop.py

Open

#5.352 geöffnet am 4. Juli 2025

Auf GitHub ansehen
 (11 Kommentare) (6 Reaktionen) (0 zugewiesene Personen)C (4.051 Forks)batch import
bughelp wanted

Repository-Metriken

Stars
 (22.409 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 12T 6h) (12 gemergte PRs in 30 T)

Beschreibung

tcp_cleanup_rbuf is called several times in a loop inside tcp_recvmsg. At the same time, it is passed the accumulated parameter "copied". Thus, the same data is taken into account several times.

int tcp_recvmsg(...) {
     ...
     int copied = 0;
     ...
     do {
         ...
         tcp_cleanup_rbuf(sk, copied);
         ...
         copied += used;
         ...
     } while (len > 0);
     
     tcp_cleanup_rbuf(sk, copied);
     return copied;
     ...
}

Contributor Guide