@@ -41,9 +41,7 @@ impl Drop for BlockingTaskHandle {
4141 if let Some ( handle) = guard. take ( ) {
4242 // Use block_on to wait for the task to complete
4343 // This ensures ThreadScope::drop() runs and PHP TLS is cleaned up
44- let _ = crate :: sapi:: fallback_handle ( ) . block_on ( async move {
45- let _ = handle. await ;
46- } ) ;
44+ let _ = crate :: sapi:: fallback_handle ( ) . block_on ( handle) ;
4745 }
4846 }
4947 }
@@ -343,31 +341,43 @@ impl Handler for Embed {
343341
344342 // Spawn blocking PHP execution - ALL PHP operations happen here
345343 let blocking_handle = tokio:: task:: spawn_blocking ( move || {
344+ eprintln ! ( "[DEBUG] spawn_blocking: starting" ) ;
346345 // Keep sapi alive for the duration of this task
347346 let _sapi = _sapi;
347+ eprintln ! ( "[DEBUG] spawn_blocking: creating ThreadScope" ) ;
348348 let _thread_scope = ThreadScope :: new ( ) ;
349+ eprintln ! ( "[DEBUG] spawn_blocking: ThreadScope created" ) ;
349350
350351 // Setup RequestContext (always streaming from SAPI perspective)
351352 // RequestContext::new() will extract the request body's read stream and add it as RequestStream extension
353+ eprintln ! ( "[DEBUG] spawn_blocking: creating RequestContext" ) ;
352354 let ctx = RequestContext :: new (
353355 request,
354356 docroot. clone ( ) ,
355357 response_writer. clone ( ) ,
356358 headers_sent_tx,
357359 ) ;
360+ eprintln ! ( "[DEBUG] spawn_blocking: setting RequestContext::current" ) ;
358361 RequestContext :: set_current ( Box :: new ( ctx) ) ;
362+ eprintln ! ( "[DEBUG] spawn_blocking: RequestContext set" ) ;
359363
360364 // All estrdup calls MUST happen here, inside spawn_blocking, after ThreadScope::new()
361365 // has initialized PHP's memory manager for this thread.
362366 // These will be freed by efree in sapi_module_deactivate during request shutdown.
367+ eprintln ! ( "[DEBUG] spawn_blocking: calling estrdup for request_uri_str" ) ;
363368 let request_uri_c = estrdup ( request_uri_str. as_str ( ) ) ;
369+ eprintln ! ( "[DEBUG] spawn_blocking: calling estrdup for path_translated" ) ;
364370 let path_translated = estrdup ( translated_path_str. as_str ( ) ) ;
371+ eprintln ! ( "[DEBUG] spawn_blocking: calling estrdup for request_method" ) ;
365372 let request_method = estrdup ( method_str. as_str ( ) ) ;
373+ eprintln ! ( "[DEBUG] spawn_blocking: calling estrdup for query_string" ) ;
366374 let query_string = estrdup ( query_str. as_str ( ) ) ;
375+ eprintln ! ( "[DEBUG] spawn_blocking: calling estrdup for content_type" ) ;
367376 let content_type = content_type_str
368377 . as_ref ( )
369378 . map ( |s| estrdup ( s. as_str ( ) ) )
370379 . unwrap_or ( std:: ptr:: null_mut ( ) ) ;
380+ eprintln ! ( "[DEBUG] spawn_blocking: estrdup calls complete" ) ;
371381
372382 // Prepare argv pointers
373383 let argc = args. len ( ) as i32 ;
0 commit comments