Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

fix: race condition in IdeStreamingSink #4857

Copy link
Copy link

Description

@thomhurst
Issue body actions

Description

IdeStreamingSink.cs (Lines 147-152)

Double-check locking pattern without proper synchronization:

if (state.IsCompleted || testContext.Result is not null) { state.TryMarkCompleted(); return; }
// ... Send update
if (state.IsCompleted || testContext.Result is not null) { state.TryMarkCompleted(); return; }

Between the first check and sending the update, another thread could mark the test as completed, resulting in state updates being sent after test completion. This could cause IDE test explorers to receive updates after seeing the final state, causing UI glitches.

Timer Leak (Lines 80-85)

Timer is created with new Timer() but if an exception occurs during CreateStreamingState, the timer could leak. Dispose() is only called in CleanupTest().

Suggested Fix

  • Use a single atomic check: if (!state.TryMarkCompleted()) return;
  • Wrap state creation in try-catch and always dispose the timer on failure
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.