Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion profiling/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,6 @@ extern "C" fn rinit(_type: c_int, _module_number: c_int) -> ZendResult {
let result = REQUEST_LOCALS.try_with_borrow_mut(|locals| {
// SAFETY: we are in rinit on a PHP thread.
locals.vm_interrupt_addr = unsafe { zend::datadog_php_profiling_vm_interrupt_addr() };
locals.interrupt_count.store(0, Ordering::SeqCst);

// SAFETY: We are after first rinit and before mshutdown.
unsafe {
Expand Down
6 changes: 6 additions & 0 deletions profiling/src/profiling/interrupts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ impl InterruptManager {
pub(super) fn remove_interrupt(&self, interrupt: VmInterrupt) {
let mut vm_interrupts = self.vm_interrupts.lock().unwrap();
vm_interrupts.remove(&interrupt);
unsafe {
// Reset interrupt counter to prevent sampling during `mshutdown` (PHP 8.0 bug with
// userland destructors), but leave the interrupt flag unchanged as other extensions
// may have raised it.
(*interrupt.interrupt_count_ptr).store(0, Ordering::SeqCst);
}
}

#[inline]
Expand Down
Loading