Skip to content

Guard pre-init log wakeups - #13472

Open
bneradt wants to merge 1 commit into
apache:masterfrom
bneradt:guard-pre-init-log-wakeups
Open

Guard pre-init log wakeups#13472
bneradt wants to merge 1 commit into
apache:masterfrom
bneradt:guard-pre-init-log-wakeups

Conversation

@bneradt

@bneradt bneradt commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Plugins can fill a text log buffer during TSPluginInit before logging
preprocessing threads and their notification objects exist. This causes
a null dereference that crashes traffic_server during startup.

This problem is addressed in this patch by queuing those buffers without
signaling until the logging workers exist. Their initial queue scan then
flushes the pending data. A regression test forces a rollover during
plugin initialization and verifies ATS stays up and preserves the log
entry.

With the production fix removed, the regression test caused
traffic_server to crash with SIGSEGV at address zero while signaling the
preprocessing notification. With the fix applied, the identical test
passes.

@bneradt bneradt added this to the 11.0.0 milestone Aug 1, 2026
Copilot AI review requested due to automatic review settings August 1, 2026 19:56
@bneradt bneradt self-assigned this Aug 1, 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

This pull request prevents a startup crash when plugins write to text logs during TSPluginInit, before logging preprocessing threads (and their EventNotify objects) are created. It does so by allowing buffers to be queued without signaling until the notification array exists, and adds an AuTest regression that forces an early rollover to validate the fix.

Changes:

  • Guard Log::preproc_notify[idx].signal() calls so early text-log buffer flush/rollover can’t dereference a null preproc_notify.
  • Extend the test_log_interface test plugin to optionally write large log entries during plugin initialization.
  • Add a new gold test that configures a small log buffer, triggers initialization-time rollover, and verifies ATS stays running and the message reaches the plugin log.

Reviewed changes

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

File Description
src/proxy/logging/LogObject.cc Adds null checks before signaling preproc_notify when enqueuing buffers for preprocessing, preventing pre-init crashes.
tests/tools/plugins/test_log_interface.cc Adds a --write-during-init option to generate large initialization-time log writes to reproduce the pre-init rollover scenario.
tests/gold_tests/logging/log_plugin_init.test.py New regression test to ensure initialization-time text logging doesn’t crash and buffered entries are flushed to the plugin log.

Plugins can fill a text log buffer during TSPluginInit before logging
preprocessing threads and their notification objects exist. This causes
a null dereference that crashes traffic_server during startup.

This problem is addressed in this patch by queuing those buffers without
signaling until the logging workers exist. Their initial queue scan then
flushes the pending data. A regression test forces a rollover during
plugin initialization and verifies ATS stays up and preserves the log
entry.

With the production fix removed, the regression test caused
traffic_server to crash with SIGSEGV at address zero while signaling the
preprocessing notification. With the fix applied, the identical test
passes.
@bneradt
bneradt force-pushed the guard-pre-init-log-wakeups branch from 35057c5 to 0b37ebc Compare August 1, 2026 20:15
@bneradt

bneradt commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

I verified the regression test in an A/B run. With the test and test-plugin changes present but the production LogObject guards removed, traffic_server crashed during TSPluginInit with SIGSEGV at address 0x0. The backtrace passed through EventNotify::signal() and LogObject::_checkout_write(), and AuTest failed. Restoring the production fix made the identical test pass.

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