iovisor/bcc

Incorrect calculation of recv throughput in tcptop.py

Open

#5352 aperta il 4 lug 2025

Vedi su GitHub
 (11 commenti) (6 reazioni) (0 assegnatari)C (4051 fork)batch import
bughelp wanted

Metriche repository

Star
 (22.409 star)
Metriche merge PR
 (Merge medio 12g 6h) (12 PR mergiate in 30 g)

Descrizione

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;
     ...
}

Guida contributor