Skip to content

fix(operators): serialize timeout terminal delivery#84

Merged
glennawatson merged 2 commits into
mainfrom
CP_issue-68-timeout-terminal-gate
Jun 25, 2026
Merged

fix(operators): serialize timeout terminal delivery#84
glennawatson merged 2 commits into
mainfrom
CP_issue-68-timeout-terminal-gate

Conversation

@ChrisPulman

Copy link
Copy Markdown
Member

What kind of change does this PR introduce?

Bug fix for timeout operator concurrency.

What is the new behavior?

Timeout terminal delivery is serialized with source notifications so a timeout OnError cannot enter an observer concurrently with an in-flight OnNext.

Fixes #68.

What is the current behavior?

A timeout timer can emit OnError while the upstream OnNext path is still inside the downstream observer, allowing observer calls to overlap.

Checklist

  • Tests have been added or updated (for bug fixes / features)
  • Docs have been added or updated (for bug fixes / features)
  • Changes target the main branch
  • PR title follows Conventional Commits

Additional information

Validation:

  • dotnet build "tests/ReactiveUI.Primitives.Tests/ReactiveUI.Primitives.Tests.csproj" -f net10.0 --no-restore -v minimal
  • dotnet test "tests/ReactiveUI.Primitives.Tests/ReactiveUI.Primitives.Tests.csproj" -f net10.0 --no-build -- --treenode-filter "/*/*/ExpireCoordinatorTests/*" --output Detailed
  • mcp__mtpunittestmcp.get_solution_coverage was run, but no Cobertura coverage data was present under the solution directory.

A full multi-target test command was attempted first but exceeded the local timeout while the repository was under parallel issue validation load.

@ChrisPulman
ChrisPulman marked this pull request as ready for review June 25, 2026 00:03

@glennawatson glennawatson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified against #68. The shared Lock now serializes value delivery with the timeout: OnNext/OnError/OnCompleted/EmitTimeout all check-and-set _done and forward under the gate, so a timeout OnError can no longer enter the observer concurrently with an in-flight OnNext. Dispose stays outside the lock. System.Threading.Lock is reentrant, so synchronous re-entrancy won't deadlock. Threaded test confirms it. LGTM.

@ChrisPulman
ChrisPulman enabled auto-merge (squash) June 25, 2026 01:02
@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.39%. Comparing base (d101d36) to head (1d54bea).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #84      +/-   ##
==========================================
+ Coverage   90.37%   90.39%   +0.02%     
==========================================
  Files         649      649              
  Lines       20228    20251      +23     
  Branches     2416     2419       +3     
==========================================
+ Hits        18281    18306      +25     
+ Misses       1564     1563       -1     
+ Partials      383      382       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@glennawatson
glennawatson disabled auto-merge June 25, 2026 02:44
@glennawatson
glennawatson merged commit 21cf8d8 into main Jun 25, 2026
13 checks passed
@glennawatson
glennawatson deleted the CP_issue-68-timeout-terminal-gate branch June 25, 2026 02:44
@github-actions

Copy link
Copy Markdown

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jul 10, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Timeout can emit OnNext after the timeout OnError (grammar violation)

2 participants