Skip to content

net: count application bytes in read_bytes for TLS#13282

Open
moonchen wants to merge 1 commit into
apache:masterfrom
moonchen:ssl-net-read-bytes-fix
Open

net: count application bytes in read_bytes for TLS#13282
moonchen wants to merge 1 commit into
apache:masterfrom
moonchen:ssl-net-read-bytes-fix

Conversation

@moonchen

Copy link
Copy Markdown
Contributor

On TLS connections, net.read_bytes was only counting some bytes for the handshake, and none of the incoming ciphertext. This is neither intuitive nor consistent with net.write_bytes.

The fix for now is to make it symmetric with net.write_bytes. Count the plaintext bytes for TLS. This means not counting the handshake bytes.

For a long term fix, I plan to add more comprehensive metrics for TLS.

Copilot AI review requested due to automatic review settings June 16, 2026 14:36
@moonchen moonchen self-assigned this Jun 16, 2026
@moonchen moonchen modified the milestones: 10.2.0, 11.0.0 Jun 16, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adjusts net.read_bytes accounting on TLS connections to count decrypted application payload bytes (plaintext), making it symmetric with net.write_bytes, and updates documentation to reflect the clarified semantics.

Changes:

  • Move net.read_bytes / net.read_bytes_count increments from raw socket reads to post-decryption reads in SSLNetVConnection.
  • Stop counting TLS handshake / record-layer bytes toward net.read_bytes.
  • Document that read_bytes/write_bytes represent application-layer plaintext for TLS connections.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/iocore/net/SSLNetVConnection.cc Shifts read-byte metrics to count decrypted payload instead of raw network bytes for TLS.
doc/admin-guide/monitoring/statistics/core/network-io.en.rst Documents TLS plaintext semantics for read_bytes and write_bytes.

Comment thread src/iocore/net/SSLNetVConnection.cc
Comment thread doc/admin-guide/monitoring/statistics/core/network-io.en.rst
@moonchen

Copy link
Copy Markdown
Contributor Author

[approve ci Clang-Analyzer]

On TLS connections, net.read_bytes was only counting some bytes for the
handshake, and none of the incoming ciphertext.  This is neither intuitive
nor consistent with net.write_bytes.

The fix for now is to make it symmetric with net.write_bytes.  Count the
plaintext bytes for TLS.  This means not counting the handshake bytes.

For a long term fix, I plan to add more comprehensive metrics for TLS.
@moonchen moonchen force-pushed the ssl-net-read-bytes-fix branch from 073804f to 85e94c5 Compare June 16, 2026 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants