@@ -1274,10 +1274,19 @@ static void dd_shutdown_hooks_and_observer(void) {
12741274void dd_force_shutdown_tracing (void ) {
12751275 DDTRACE_G (in_shutdown ) = true;
12761276
1277- ddtrace_close_all_open_spans (true); // All remaining userland spans (and root span)
1278- if (ddtrace_flush_tracer (false, true) == FAILURE ) {
1279- LOG (Warn , "Unable to flush the tracer" );
1280- }
1277+ zend_try {
1278+ ddtrace_close_all_open_spans (true ); // All remaining userland spans (and root span)
1279+ } zend_catch {
1280+ LOG (Warn , "Failed to close remaining spans due to bailout" );
1281+ } zend_end_try ();
1282+
1283+ zend_try {
1284+ if (ddtrace_flush_tracer (false, true) == FAILURE ) {
1285+ LOG (Warn , "Unable to flush the tracer" );
1286+ }
1287+ } zend_catch {
1288+ LOG (Warn , "Unable to flush the tracer due to bailout" );
1289+ } zend_end_try ();
12811290
12821291 // we here need to disable the tracer, so that further hooks do not trigger
12831292 ddtrace_disable_tracing_in_current_request (); // implicitly calling dd_clean_globals
@@ -1288,7 +1297,7 @@ void dd_force_shutdown_tracing(void) {
12881297 DDTRACE_G (in_shutdown ) = false;
12891298}
12901299
1291- static void dd_finalize_telemtry (void ) {
1300+ static void dd_finalize_telemetry (void ) {
12921301 if (DDTRACE_G (telemetry_queue_id )) {
12931302 ddtrace_telemetry_finalize ();
12941303 DDTRACE_G (telemetry_queue_id ) = 0 ;
@@ -1315,7 +1324,7 @@ static PHP_RSHUTDOWN_FUNCTION(ddtrace) {
13151324 DDTRACE_G (active_stack ) = NULL ;
13161325 }
13171326
1318- dd_finalize_telemtry ();
1327+ dd_finalize_telemetry ();
13191328 if (DDTRACE_G (last_flushed_root_service_name )) {
13201329 zend_string_release (DDTRACE_G (last_flushed_root_service_name ));
13211330 DDTRACE_G (last_flushed_root_service_name ) = NULL ;
@@ -1990,7 +1999,7 @@ PHP_FUNCTION(dd_trace_internal_fn) {
19901999 ddtrace_coms_test_msgpack_consumer ();
19912000 RETVAL_TRUE ;
19922001 } else if (FUNCTION_NAME_MATCHES ("finalize_telemetry" )) {
1993- dd_finalize_telemtry ();
2002+ dd_finalize_telemetry ();
19942003 RETVAL_TRUE ;
19952004 } else if (FUNCTION_NAME_MATCHES ("dump_sidecar" )) {
19962005 if (!ddtrace_sidecar ) {
0 commit comments