Skip to content

[BUG] nmrs race condition #175

@cachebag

Description

@cachebag

// Subscribe to signals FIRST to avoid race condition
let mut stream = active_conn.receive_activation_state_changed().await?;
debug!("Subscribed to ActiveConnection StateChanged signal");
// Check current state - if already terminal, return immediately
let current_state = active_conn.state().await?;
let state = ActiveConnectionState::from(current_state);
debug!("Current active connection state: {state}");

We subscribe to signals AFTER creating the proxy, but there's still a window between subscription and checking current state where a state change could be missed.

If the state changes between subscribing and checking, we might miss it.

So I guess technically this is actually handled correctly (subscribe first, then check), but we should add a re-check after the loop to catch any state changes that occurred during the gap.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinglow-priorityDevelopment can continue without itnmrsChanges to nmrs

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions