Bug #43040 Bytes_sent gives negetive number
Submitted: 20 Feb 2009 2:40 Modified: 25 Feb 2009 2:59
Reporter: Lig Isler-Turmelle Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Logging Severity:S3 (Non-critical)
Version:5.0.60, 5.0, 5.1, 6.0 bzr OS:Linux
Assigned to: CPU Architecture:Any
Triage: Needs Triage: D3 (Medium)

[20 Feb 2009 2:40] Lig Isler-Turmelle
Description:
When closely monitoring the value of Bytes_sent (values taken every 5 seconds) noticed the value suddenly jump up 4GB and then soon after jump *down* 4 GB.  

- At 14:01:38 the total Mb sent in 5 seconds went to 4,342 Mb. The total bytes sent went from 2,503,034,967,866 to 2,507,377,258,205.

- At 14:03:56 the total Mb sent in 5 seconds went to a NEGATIVE number of 4,250 Mb. The total byte sent went from 2,508,255,848,844 to 2,504,005,106,958

Since the value jumps up and down are around 2^32, it may be associated with the fix from http://bugs.mysql.com/bug.php?id=28149, potentially a race condition or similar from the bug fix. 

Script used to see the changes:
mysql -u user -p pwd -h dbserver db -e "show global status;" | grep Bytes >> byteCheck.log
sleep 5
done;

Will upload supporting information files.

How to repeat:
n/a
[21 Feb 2009 9:10] Sveta Smirnova
Thank you for the report.

Verified as described:

./sql/net_serv.cc still contains extern ulong bytes_sent, bytes_received, net_big_packet_count; which is used, for example, by update_statistics
[25 Feb 2009 2:59] Omer Barnir
duplicate of bug#42698
[21 Apr 2010 11:40] Roger Nay
5.1.40-community MySQL Community Server (GPL) seeing the following.

mysql> SHOW GLOBAL STATUS LIKE 'bytes%';
+----------------+-------------+
| Variable_name | Value |
+----------------+-------------+
| Bytes_received | 546901101 |
| Bytes_sent | 67934847996 |
+----------------+-------------+

mysql>
mysql> SHOW GLOBAL STATUS LIKE 'bytes%';
+----------------+-------------+
| Variable_name | Value |
+----------------+-------------+
| Bytes_received | 611449678 |
| Bytes_sent | 65135082657 |
+----------------+-------------+