Skip to content

Fix teardown NRE/ODE in ReplicationConnection's SendStatusUpdate - #6630

Open
Hawxy wants to merge 1 commit into
npgsql:mainfrom
Hawxy:fix-replication-feedback-teardown-race
Open

Fix teardown NRE/ODE in ReplicationConnection's SendStatusUpdate#6630
Hawxy wants to merge 1 commit into
npgsql:mainfrom
Hawxy:fix-replication-feedback-teardown-race

Conversation

@Hawxy

@Hawxy Hawxy commented Aug 11, 2026

Copy link
Copy Markdown

If the replication connection gets torn down whilst SendStatusUpdate is in-flight, you get to spin the wheel on getting an NRE or ODE which isn't ideal:

System.NullReferenceException: Object reference not set to an instance of an object.
   at Npgsql.Replication.ReplicationConnection.SendFeedback(Boolean waitOnSemaphore, Boolean requestReply, CancellationToken cancellationToken)
   at Npgsql.Replication.ReplicationConnection.SendStatusUpdate(CancellationToken cancellationToken)

This fixes it so OperationCanceledException and InvalidOperationException are the only exceptions that show up and should match developer expectations a bit better.

@Hawxy
Hawxy requested review from Brar, roji and vonzshik as code owners August 11, 2026 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant