Fix panic after bailout in previous request#3537
Conversation
|
Nice find 🚀 |
Benchmarks [ tracer ]Benchmark execution time: 2025-12-17 17:34:56 Comparing candidate commit e611c33 in PR branch Found 1 performance improvements and 6 performance regressions! Performance is the same for 186 metrics, 1 unstable metrics. scenario:MessagePackSerializationBench/benchMessagePackSerialization-opcache
scenario:SamplingRuleMatchingBench/benchRegexMatching1
scenario:SamplingRuleMatchingBench/benchRegexMatching2
scenario:SamplingRuleMatchingBench/benchRegexMatching3
scenario:SamplingRuleMatchingBench/benchRegexMatching4
scenario:SpanBench/benchOpenTelemetryAPI
scenario:TraceSerializationBench/benchSerializeTrace
|
Unfortunately, this is buried deep in macros and abstraction:
Log::Span => {
use ::tracing::__macro_support::Callsite as _;
static __CALLSITE: ::tracing::callsite::DefaultCallsite = {
static META: ::tracing::Metadata<'static> = {
::tracing_core::metadata::Metadata::new(
"event components-rs/log.rs:188",
"span",
Level::DEBUG,
// ...
)
};
::tracing::callsite::DefaultCallsite::new(&META)
};
let enabled = Level::DEBUG <= ::tracing::level_filters::STATIC_MAX_LEVEL
&& Level::DEBUG <= ::tracing::level_filters::LevelFilter::current()
&& {
let interest = __CALLSITE.interest();
!interest.is_never()
&& ::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(), interest)
};
if enabled {
(|value_set: ::tracing::field::ValueSet| {
let meta = __CALLSITE.metadata();
::tracing::Event::dispatch(meta, &value_set); // THE RELEVANT CALL
// ...
})({
// ... build value_set with format_args!("{0}", msg.to_utf8_lossy()) ...
});
}
}The pub fn dispatch(metadata: &'static Metadata<'static>, fields: &'a field::ValueSet<'_>) {
let event = Event::new(metadata, fields);
crate::dispatcher::get_default(|current| {
current.event(&event);
});
}The borrow is held during the execution of the lambda that eventually calls PHP: |
Fix panic after bailout in previous request
Description
Fix panic on the startup of a request:
after on the previous request there was a bailout when logging and holding a borrow:
Bailout happens here:
As seen in error-tracking issue: a8a562c4-9f99-11f0-a59c-da7ad0900002
Reviewer checklist