From 9805f4ee04d20ee013d32d9c56b55b0d798608f4 Mon Sep 17 00:00:00 2001 From: Jonathan Krebs Date: Sat, 9 Nov 2024 11:44:43 +0100 Subject: [PATCH] lightproc: drop span guard before deallocating the process This should fix #77 --- runtime/lightproc/src/raw_proc.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/runtime/lightproc/src/raw_proc.rs b/runtime/lightproc/src/raw_proc.rs index 1481fb0..1521c35 100644 --- a/runtime/lightproc/src/raw_proc.rs +++ b/runtime/lightproc/src/raw_proc.rs @@ -395,7 +395,7 @@ where unsafe fn tick(ptr: *const ()) { let mut raw = Self::from_ptr(ptr); // Enter the span associated with the process to track execution time if enabled. - let _guard = (&(*raw.pdata).span).enter(); + let guard = (&(*raw.pdata).span).enter(); // Create a context from the raw proc pointer and the vtable inside its pdata. let waker = ManuallyDrop::new(Waker::from_raw(RawWaker::new( @@ -487,6 +487,8 @@ where (*raw.pdata).notify(); } + // the tracing guard is inside the proc, so it must be dropped first + drop(guard); // Drop the proc reference. Self::decrement(ptr); break;