Repository navigation
signal: Avoid allocation in fatal signal handler - #48471
Merged
Merged
Conversation
ravenblackx
previously approved these changes
Oct 20, 2026
ravenblackx
previously approved these changes
Oct 20, 2026
Member
Author
|
/retest flakey android |
jwendell
previously approved these changes
Oct 20, 2026
Member
Author
|
/retest |
Member
Author
|
/coverage |
|
Coverage for this Pull Request will be rendered here: For comparison, current coverage on The coverage results are (re-)rendered each time the CI |
Signed-off-by: Ryan Northey <[email protected]>
Signed-off-by: Ryan Northey <[email protected]>
Signed-off-by: Ryan Northey <[email protected]>
Signed-off-by: Ryan Northey <[email protected]>
Signed-off-by: Ryan Northey <[email protected]>
jwendell
approved these changes
Oct 21, 2026
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 6, 2026
Signed-off-by: Ryan Northey <[email protected]> (cherry picked from commit f8b232f) Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 9, 2026
This branch does not have coroutine backtraces, so the envoyproxy#48471 entry only applies to native ones. Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 9, 2026
Signed-off-by: Ryan Northey <[email protected]> (cherry picked from commit f8b232f) Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 11, 2026
Signed-off-by: Ryan Northey <[email protected]> (cherry picked from commit f8b232f) Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 11, 2026
envoyproxy#49180) envoyproxy#48471 made the fatal signal handler write fault descriptions and backtraces directly to stderr, so that it does not re-enter the logger. The release note describes that as a bug fix, but does not say that the output no longer reaches configured log sinks such as `--log-path`. State it explicitly as a minor behavior change, as it matters to anyone collecting crash backtraces from the log file, in particular when the fix is backported to a stable branch. Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 11, 2026
Signed-off-by: Ryan Northey <[email protected]> (cherry picked from commit f8b232f) Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
that referenced
this pull request
Nov 11, 2026
#49180) #48471 made the fatal signal handler write fault descriptions and backtraces directly to stderr, so that it does not re-enter the logger. Its release note describes that as a bug fix, but does not say that the output no longer reaches configured log sinks such as `--log-path`. This adds a `minor_behavior_changes` entry stating it explicitly, as it matters to anyone collecting crash backtraces from the log file. Raised from review of the 1.40 backport (#49174), where a patch release would otherwise change this silently. To be backported there. Signed-off-by: Ryan Northey <[email protected]>
jwendell
pushed a commit
that referenced
this pull request
Nov 11, 2026
Signed-off-by: Ryan Northey <[email protected]> (cherry picked from commit f8b232f) Signed-off-by: Ryan Northey <[email protected]>
jwendell
pushed a commit
that referenced
this pull request
Nov 11, 2026
#49180) #48471 made the fatal signal handler write fault descriptions and backtraces directly to stderr, so that it does not re-enter the logger. The release note describes that as a bug fix, but does not say that the output no longer reaches configured log sinks such as `--log-path`. State it explicitly as a minor behavior change, as it matters to anyone collecting crash backtraces from the log file, in particular when the fix is backported to a stable branch. Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 12, 2026
Signed-off-by: Ryan Northey <[email protected]> (cherry picked from commit f8b232f) Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 12, 2026
envoyproxy#49180) envoyproxy#48471 made the fatal signal handler write fault descriptions and backtraces directly to stderr, so that it does not re-enter the logger. The release note describes that as a bug fix, but does not say that the output no longer reaches configured log sinks such as `--log-path`. State it explicitly as a minor behavior change, as it matters to anyone collecting crash backtraces from the log file, in particular when the fix is backported to a stable branch. Signed-off-by: Ryan Northey <[email protected]>
This was referenced Nov 12, 2026
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 12, 2026
Signed-off-by: Ryan Northey <[email protected]> (cherry picked from commit f8b232f) Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 12, 2026
envoyproxy#49180) envoyproxy#48471 made the fatal signal handler write fault descriptions and backtraces directly to stderr, so that it does not re-enter the logger. The release note describes that as a bug fix, but does not say that the output no longer reaches configured log sinks such as `--log-path`. State it explicitly as a minor behavior change, as it matters to anyone collecting crash backtraces from the log file, in particular when the fix is backported to a stable branch. Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 12, 2026
envoyproxy#48471 took the fatal signal handler's output off the logger, which could deadlock or abort on the logger mutex, and sent it to `std::cerr`. That is not async-signal-safe either: iostream output goes through the stdio lock and is not guaranteed to be allocation free, so a signal arriving while the same thread is inside a stream or allocator call can still hang or fault again before the backtrace and the fatal actions run. Add `StderrWriter`, which builds a line in a fixed buffer and writes it with a single write(2), and use it for the fault line and for the regular and coroutine backtraces when they are directed to stderr. The output is unchanged. `printTrace()` goes back to taking only a stream, as its prefixed form was only used for this path. Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 12, 2026
envoyproxy#48471 took the fatal signal handler's output off the logger, which could deadlock or abort on the logger mutex, and sent it to `std::cerr`. That is not async-signal-safe either: iostream output goes through the stdio lock and is not guaranteed to be allocation free, so a signal arriving while the same thread is inside a stream or allocator call can still hang or fault again before the backtrace and the fatal actions run. Add `StderrWriter`, which builds a line in a fixed buffer and writes it with a single write(2), and use it for the fault line and for the regular and coroutine backtraces when they are directed to stderr. The output is unchanged. `printTrace()` goes back to taking only a stream, as its prefixed form was only used for this path. Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 12, 2026
Signed-off-by: Ryan Northey <[email protected]> (cherry picked from commit f8b232f) Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 12, 2026
envoyproxy#49180) envoyproxy#48471 made the fatal signal handler write fault descriptions and backtraces directly to stderr, so that it does not re-enter the logger. The release note describes that as a bug fix, but does not say that the output no longer reaches configured log sinks such as `--log-path`. State it explicitly as a minor behavior change, as it matters to anyone collecting crash backtraces from the log file, in particular when the fix is backported to a stable branch. Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 12, 2026
envoyproxy#48471 took the fatal signal handler's output off the logger, which could deadlock or abort on the logger mutex, and sent it to `std::cerr`. That is not async-signal-safe either: iostream output goes through the stdio lock and is not guaranteed to be allocation free, so a signal arriving while the same thread is inside a stream or allocator call can still hang or fault again before the backtrace and the fatal actions run. Add `StderrWriter`, which builds a line in a fixed buffer and writes it with a single write(2), and use it for the fault line and for the regular and coroutine backtraces when they are directed to stderr. The output is unchanged. `printTrace()` goes back to taking only a stream, as its prefixed form was only used for this path. Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 12, 2026
Signed-off-by: Ryan Northey <[email protected]> (cherry picked from commit f8b232f) Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 12, 2026
envoyproxy#49180) envoyproxy#48471 made the fatal signal handler write fault descriptions and backtraces directly to stderr, so that it does not re-enter the logger. The release note describes that as a bug fix, but does not say that the output no longer reaches configured log sinks such as `--log-path`. State it explicitly as a minor behavior change, as it matters to anyone collecting crash backtraces from the log file, in particular when the fix is backported to a stable branch. Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 12, 2026
envoyproxy#48471 took the fatal signal handler's output off the logger, which could deadlock or abort on the logger mutex, and sent it to `std::cerr`. That is not async-signal-safe either: iostream output goes through the stdio lock and is not guaranteed to be allocation free, so a signal arriving while the same thread is inside a stream or allocator call can still hang or fault again before the backtrace and the fatal actions run. Add `StderrWriter`, which builds a line in a fixed buffer and writes it with a single write(2), and use it for the fault line and for the regular and coroutine backtraces when they are directed to stderr. The output is unchanged. `printTrace()` goes back to taking only a stream, as its prefixed form was only used for this path. Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
that referenced
this pull request
Nov 12, 2026
#48471 took the fatal signal handler's output off the logger, which could deadlock or abort on the logger mutex, and sent it to `std::cerr`. That is not async-signal-safe either: iostream output goes through the stdio lock and is not guaranteed to be allocation free, so a signal arriving while the same thread is inside a stream or allocator call can still hang or fault again before the backtrace and the fatal actions run. This adds `StderrWriter`, which builds a line in a fixed buffer and writes it with a single `write(2)`, and uses it for the fault line and for the regular and coroutine backtraces when they are directed to stderr. The output is unchanged. `printTrace()` goes back to taking only a stream, as its prefixed form was only used for this path. Not covered: the fatal error handlers that run after the backtrace are still handed `std::cerr`, as before. Risk Level: low Testing: unit test for `StderrWriter`; the existing `Backward.FaultToStderr`, `Backward.TraceToStderr` and coroutine stderr tests cover the output format Docs Changes: n/a Release Notes: n/a Platform Specific Features: n/a --------- Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 17, 2026
Signed-off-by: Ryan Northey <[email protected]> (cherry picked from commit f8b232f) Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 17, 2026
envoyproxy#49180) envoyproxy#48471 made the fatal signal handler write fault descriptions and backtraces directly to stderr, so that it does not re-enter the logger. The release note describes that as a bug fix, but does not say that the output no longer reaches configured log sinks such as `--log-path`. State it explicitly as a minor behavior change, as it matters to anyone collecting crash backtraces from the log file, in particular when the fix is backported to a stable branch. (cherry picked from commit 8976dff) Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 17, 2026
Signed-off-by: Ryan Northey <[email protected]> (cherry picked from commit f8b232f) Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 17, 2026
envoyproxy#49180) envoyproxy#48471 made the fatal signal handler write fault descriptions and backtraces directly to stderr, so that it does not re-enter the logger. The release note describes that as a bug fix, but does not say that the output no longer reaches configured log sinks such as `--log-path`. State it explicitly as a minor behavior change, as it matters to anyone collecting crash backtraces from the log file, in particular when the fix is backported to a stable branch. (cherry picked from commit 8976dff) Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 17, 2026
Signed-off-by: Ryan Northey <[email protected]> (cherry picked from commit f8b232f) Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 17, 2026
envoyproxy#49180) envoyproxy#48471 made the fatal signal handler write fault descriptions and backtraces directly to stderr, so that it does not re-enter the logger. The release note describes that as a bug fix, but does not say that the output no longer reaches configured log sinks such as `--log-path`. State it explicitly as a minor behavior change, as it matters to anyone collecting crash backtraces from the log file, in particular when the fix is backported to a stable branch. (cherry picked from commit 8976dff) Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
that referenced
this pull request
Nov 17, 2026
Signed-off-by: Ryan Northey <[email protected]> (cherry picked from commit f8b232f) Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
that referenced
this pull request
Nov 17, 2026
#49180) #48471 made the fatal signal handler write fault descriptions and backtraces directly to stderr, so that it does not re-enter the logger. The release note describes that as a bug fix, but does not say that the output no longer reaches configured log sinks such as `--log-path`. State it explicitly as a minor behavior change, as it matters to anyone collecting crash backtraces from the log file, in particular when the fix is backported to a stable branch. (cherry picked from commit 8976dff) Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 18, 2026
Signed-off-by: Ryan Northey <[email protected]> (cherry picked from commit f8b232f) Signed-off-by: Ryan Northey <[email protected]>
phlax
added a commit
to phlax/envoy
that referenced
this pull request
Nov 18, 2026
envoyproxy#49180) envoyproxy#48471 made the fatal signal handler write fault descriptions and backtraces directly to stderr, so that it does not re-enter the logger. The release note describes that as a bug fix, but does not say that the output no longer reaches configured log sinks such as `--log-path`. State it explicitly as a minor behavior change, as it matters to anyone collecting crash backtraces from the log file, in particular when the fix is backported to a stable branch. (cherry picked from commit 8976dff) Signed-off-by: Ryan Northey <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.