Add ERR_TUN_ACTIVE_TIMEOUT squid code for tunnel timeouts#12786
Add ERR_TUN_ACTIVE_TIMEOUT squid code for tunnel timeouts#12786bryancall merged 4 commits intoapache:masterfrom
Conversation
Add new SquidLogCode to identify when CONNECT tunnels time out due to active timeout. This makes tunnel timeouts visible in access logs via the crc (cache result code) field. Previously, tunnel timeouts were not distinguishable in logs - users could only see them in DEBUG logs. Now the access log will show crc=ERR_TUN_ACTIVE_TIMEOUT for timed-out tunnels. Includes autotest to verify the squid code is logged correctly.
There was a problem hiding this comment.
Pull request overview
This PR adds a new squid log code ERR_TUN_ACTIVE_TIMEOUT to identify when CONNECT tunnels time out due to active timeout, making these events visible in access logs via the crc (cache result code) field.
Key Changes:
- Add
ERR_TUN_ACTIVE_TIMEOUT = 'T'enum value for tunnel active timeouts - Set the squid code in SSL tunnel handlers when
VC_EVENT_ACTIVE_TIMEOUToccurs - Include comprehensive test coverage to verify the logging behavior
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| include/proxy/hdrs/HTTP.h | Adds new ERR_TUN_ACTIVE_TIMEOUT enum value to SquidLogCode |
| src/proxy/http/HttpSM.cc | Sets the squid code in SSL tunnel producer and consumer handlers on active timeout events |
| src/proxy/logging/Log.cc | Updates the log field alias table to include the new squid code string mapping |
| tests/gold_tests/timeout/tunnel_timeout_client.py | Provides test client that establishes CONNECT tunnel and holds it idle to trigger timeout |
| tests/gold_tests/timeout/tunnel_active_timeout.test.py | Test case that verifies ERR_TUN_ACTIVE_TIMEOUT is logged for tunnel timeouts |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Add proxy.config.log.max_secs_per_buffer=1 to force log flush - Add delay test run to wait for log file to be written - Remove unused 'import time' from client script
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@bryancall make sure this change doesn't brake traffic_logstats |
Add ERR_TUN_ACTIVE_TIMEOUT to both switch statements in logstats.cc so tunnel timeouts are correctly counted in the errors bucket instead of silently falling through the default case. Clean up tunnel_timeout_client.py: remove unused time import and use socket context manager instead of manual try/finally/close.
|
[approve ci autest 0 autest 1 rocky] |
|
Cherry-picked to 10.2.x |
* Add ERR_TUN_ACTIVE_TIMEOUT squid code ('T') so CONNECT
tunnel timeouts are visible in access logs via the crc
field instead of only in DEBUG output.
* Set the code in tunnel_handler_ssl_producer() and
tunnel_handler_ssl_consumer() on VC_EVENT_ACTIVE_TIMEOUT.
* Add the code to traffic_logstats switch statements so
tunnel timeouts count in the errors bucket.
* Add autest with Python CONNECT client that triggers a
tunnel timeout and verifies the log entry.
(cherry picked from commit 2baa396)
Problem
CONNECT tunnel timeouts were invisible in access logs -- only visible via DEBUG tags. Operators had no way to distinguish tunnel timeouts from other error conditions in log analysis.
Changes
ERR_TUN_ACTIVE_TIMEOUTsquid code -- newSquidLogCodeenum value ('T') and string mapping inLog.ccso access logs showcrc=ERR_TUN_ACTIVE_TIMEOUTfor timed-out CONNECT tunnels.tunnel_handler_ssl_producer()andtunnel_handler_ssl_consumer(), set the code onVC_EVENT_ACTIVE_TIMEOUT.traffic_logstats-- add the new code to both switch statements so tunnel timeouts count in the errors bucket instead of falling through.tunnel_active_timeout.test.pywith a Python CONNECT client that holds a tunnel idle to trigger the timeout, then verifies the log entry.Testing
tunnel_active_timeoutvalidates log output