The CNode member nSendBytes is incremented under the node’s lock cs_vSend. However, RecordBytesSent is not. An RPC thread that acquires the cs_vSend lock puts the message handler thread on hold. While the thread is on hold, getnettotals returns “stale” values or values that don’t add up.
This can be fixed by making cs_vSend a “write lock” for the total bytes sent in connman.