Skip to content

Commit

Permalink
fix(trace): crash when disabled by webserver config
Browse files Browse the repository at this point in the history
  • Loading branch information
morrisonlevi committed Feb 14, 2025
1 parent 13d1512 commit 47be019
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ext/span.c
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,10 @@ void ddtrace_close_all_open_spans(bool force_close_root_span) {
zend_object **end = objects->object_buckets + 1;
zend_object **obj_ptr = objects->object_buckets + objects->top;

do {
// If ddtrace_close_all_open_spans is called in rinit, then it's possible
// that there are no objects in the object store at all. This can happen
// if the user sets DD_TRACE_ENABLED=false in a webserver configuration.
while (obj_ptr != end);
obj_ptr--;
zend_object *obj = *obj_ptr;
if (IS_OBJ_VALID(obj) && obj->ce == ddtrace_ce_span_stack) {
Expand All @@ -668,7 +671,7 @@ void ddtrace_close_all_open_spans(bool force_close_root_span) {

OBJ_RELEASE(&stack->std);
}
} while (obj_ptr != end);
}
}

void ddtrace_mark_all_span_stacks_flushable(void) {
Expand Down

0 comments on commit 47be019

Please sign in to comment.