Skip to content

Commit 5937cc4

Browse files
committed
fix: clean up pipelining/auto-age/event state on vxReleaseGraph
vxReleaseGraph now removes graph entries from: - GRAPH_PIPELINING (stale queues, executor threads) - GRAPH_AUTO_AGE_DELAYS (stale delay aging registry) - EVENT_SYSTEMS registrations (stale event listeners across all contexts) This fixes state pollution causing UserKernel tests to fail when run after other pipelining tests. Fast suite now passes 34/37 (only 3 UserKernel variants still failing - intermittent state pollution).
1 parent 739af50 commit 5937cc4

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

openvx-core/src/c_api.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -963,6 +963,22 @@ pub extern "C" fn vxReleaseGraph(graph: *mut vx_graph) -> vx_status {
963963
if let Ok(mut names) = REFERENCE_NAMES.lock() {
964964
names.remove(&addr);
965965
}
966+
// Clean up pipelining state
967+
if let Ok(mut pipe_states) = crate::pipelining_api::GRAPH_PIPELINING.lock() {
968+
pipe_states.remove(&id);
969+
}
970+
// Clean up auto-aging delay registry
971+
if let Ok(mut registry) = crate::unified_c_api::GRAPH_AUTO_AGE_DELAYS.lock() {
972+
registry.remove(&id);
973+
}
974+
// Clean up event registrations for this graph (from all contexts)
975+
if let Ok(mut systems) = crate::pipelining_api::EVENT_SYSTEMS.lock() {
976+
for (_, event_system) in systems.iter_mut() {
977+
if let Ok(mut registrations) = event_system.registrations.lock() {
978+
registrations.retain(|reg| reg.graph_id != Some(id));
979+
}
980+
}
981+
}
966982
}
967983

968984
*graph = std::ptr::null_mut();

openvx-core/src/unified_c_api.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9893,7 +9893,7 @@ pub extern "C" fn vxReleaseDelay(delay: *mut vx_delay) -> vx_status {
98939893
// ============================================================================
98949894

98959895
/// Registry of delays registered for auto-aging with each graph
9896-
static GRAPH_AUTO_AGE_DELAYS: Lazy<Mutex<HashMap<u64, Vec<usize>>>> =
9896+
pub static GRAPH_AUTO_AGE_DELAYS: Lazy<Mutex<HashMap<u64, Vec<usize>>>> =
98979897
Lazy::new(|| Mutex::new(HashMap::new()));
98989898

98999899
/// Register a delay for auto-aging with a graph

0 commit comments

Comments
 (0)