Skip to content

Fix mismatched sINT/dINT log field types - #13223

Merged
masaori335 merged 1 commit into
apache:masterfrom
masaori335:cleanup-logging
Jun 8, 2026
Merged

Fix mismatched sINT/dINT log field types#13223
masaori335 merged 1 commit into
apache:masterfrom
masaori335:cleanup-logging

Conversation

@masaori335

Copy link
Copy Markdown
Contributor

Seven boolean/counter fields were declared dINT, but their marshal functions write a single int, and proxy_protocol_version (ppv) was declared dINT while it actually marshals a string. The dINT type wrongly excludes these fields from log filters and aggregates, and the ppv mislabeling misrepresents variable-length string bytes as two fixed ints to any type-driven consumer. Retype the single-int fields as sINT and ppv as STRING so the declared type matches what each marshal function emits.

What happens on mismatch

  • the field can't be used in a filter (dINT rejected)
  • can't be aggregated (requires sINT). So fields like cqssl (is-client-SSL, a clean 0/1) were silently un-filterable

I'm going to introduce a new binary logging format with self description of type, it depends on this fix.

Seven boolean/counter fields were declared dINT, but their marshal
functions write a single int, and proxy_protocol_version (ppv) was
declared dINT while it actually marshals a string. The dINT type
wrongly excludes these fields from log filters and aggregates, and
the ppv mislabeling misrepresents variable-length string bytes as
two fixed ints to any type-driven consumer. Retype the single-int
fields as sINT and ppv as STRING so the declared type matches what
each marshal function emits.
@masaori335 masaori335 added this to the 11.0.0 milestone Jun 2, 2026
@masaori335 masaori335 self-assigned this Jun 2, 2026
Copilot AI review requested due to automatic review settings June 2, 2026 07:53

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

This pull request corrects Apache Traffic Server’s access log field type declarations so they match what the corresponding marshal functions actually emit, which in turn restores expected behavior for type-driven consumers (e.g., filters/aggregates) and prevents incorrect interpretation in typed/binary contexts.

Changes:

  • Retype seven single-int boolean/counter fields from LogField::dINT to LogField::sINT to match their marshal_int() behavior.
  • Retype proxy_protocol_version (ppv) from LogField::dINT to LogField::STRING to match its string marshalling.
  • Add clarifying enum comments for LogField::Type values.

Reviewed changes

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

File Description
src/proxy/logging/Log.cc Updates the affected log field registrations to use sINT/STRING types consistent with their marshal functions.
include/proxy/logging/LogField.h Adds brief documentation comments clarifying the meaning of sINT, dINT, and STRING.

@masaori335

Copy link
Copy Markdown
Contributor Author

[approve ci autest 2of4]

@bneradt bneradt 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.

Looks good. Thanks for fixing.

Is there any way to add compile time or other verification to catch these? Apparently it's an easy mistake for devs to make. We can keep this as a separate PR if you wish, if this is even possible.

@masaori335
masaori335 merged commit e91ce44 into apache:master Jun 8, 2026
15 checks passed
@github-project-automation github-project-automation Bot moved this to For v10.2.0 in ATS v10.2.x Jun 8, 2026
@masaori335

Copy link
Copy Markdown
Contributor Author

Yeh, it's easy to mistake. To find the error, we need to count marshal_int/unmarshal_int function calls, once -> sINT, twice -> dINT.

@github-project-automation github-project-automation Bot moved this to For v10.1.1 in ATS v10.1.x Jun 15, 2026
@cmcfarlen cmcfarlen moved this from For v10.2.0 to Picked v10.2.0 in ATS v10.2.x Jun 16, 2026
@cmcfarlen cmcfarlen modified the milestones: 11.0.0, 10.2.0 Jun 16, 2026
@cmcfarlen

Copy link
Copy Markdown
Contributor

Cherry-picked to 10.2.x

cmcfarlen pushed a commit that referenced this pull request Jun 16, 2026
Seven boolean/counter fields were declared dINT, but their marshal
functions write a single int, and proxy_protocol_version (ppv) was
declared dINT while it actually marshals a string. The dINT type
wrongly excludes these fields from log filters and aggregates, and
the ppv mislabeling misrepresents variable-length string bytes as
two fixed ints to any type-driven consumer. Retype the single-int
fields as sINT and ppv as STRING so the declared type matches what
each marshal function emits.

(cherry picked from commit e91ce44)
@cmcfarlen cmcfarlen moved this from For v10.1.1 to Picked v10.1.1 in ATS v10.1.x Jun 25, 2026
@cmcfarlen cmcfarlen modified the milestones: 10.2.0, 10.1.3 Jun 25, 2026
@cmcfarlen

Copy link
Copy Markdown
Contributor

Cherry-picked to 10.1.x branch

cmcfarlen pushed a commit that referenced this pull request Jun 25, 2026
Seven boolean/counter fields were declared dINT, but their marshal
functions write a single int, and proxy_protocol_version (ppv) was
declared dINT while it actually marshals a string. The dINT type
wrongly excludes these fields from log filters and aggregates, and
the ppv mislabeling misrepresents variable-length string bytes as
two fixed ints to any type-driven consumer. Retype the single-int
fields as sINT and ppv as STRING so the declared type matches what
each marshal function emits.

(cherry picked from commit e91ce44)
masaori335 added a commit that referenced this pull request Jul 7, 2026
The cqssrt (client_req_ssl_resumption_type) log field added in #12404
was silently dropped from master by the 11-Dev integration merge
(#12983, 8415cef). A criss-cross merge resolution removed its
registration in Log.cc and the LogAccess marshal path, while the
supporting HttpUserAgent::get_client_ssl_resumption_type() machinery
survived, leaving that accessor as dead code with no caller.

Re-register the field and re-add the marshal function plus the
TransactionLogData bridge accessor so the orphaned machinery is wired
back into the log system. Declare it as sINT (it marshals a single
int), not the original dINT, matching the type/marshal-framing fix in
#13223.
cmcfarlen pushed a commit to cmcfarlen/trafficserver that referenced this pull request Jul 29, 2026
Seven boolean/counter fields were declared dINT, but their marshal
functions write a single int, and proxy_protocol_version (ppv) was
declared dINT while it actually marshals a string. The dINT type
wrongly excludes these fields from log filters and aggregates, and
the ppv mislabeling misrepresents variable-length string bytes as
two fixed ints to any type-driven consumer. Retype the single-int
fields as sINT and ppv as STRING so the declared type matches what
each marshal function emits.
cmcfarlen pushed a commit to cmcfarlen/trafficserver that referenced this pull request Jul 29, 2026
The cqssrt (client_req_ssl_resumption_type) log field added in apache#12404
was silently dropped from master by the 11-Dev integration merge
(apache#12983, 8415cef). A criss-cross merge resolution removed its
registration in Log.cc and the LogAccess marshal path, while the
supporting HttpUserAgent::get_client_ssl_resumption_type() machinery
survived, leaving that accessor as dead code with no caller.

Re-register the field and re-add the marshal function plus the
TransactionLogData bridge accessor so the orphaned machinery is wired
back into the log system. Declare it as sINT (it marshals a single
int), not the original dINT, matching the type/marshal-framing fix in
apache#13223.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Picked v10.1.1
Status: Picked v10.2.0

Development

Successfully merging this pull request may close these issues.

4 participants