Bound user cancellation by Cancellation Timeout while prepended responses are outstanding by lahma · Pull Request #6663 · npgsql/npgsql · GitHub
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/Npgsql/Internal/NpgsqlConnector.cs
6 changes: 3 additions & 3 deletions src/Npgsql/Internal/NpgsqlReadBuffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ int ReadWithTimeout(Span<byte> buffer)
// If we should attempt PostgreSQL cancellation, do it the first time we get a timeout.
// TODO: As an optimization, we can still attempt to send a cancellation request, but after
// that immediately break the connection
if (connector is { AttemptPostgresCancellation: true, PostgresCancellationPerformed: false }
if (connector is { ShouldAttemptPostgresCancellation: true }
&& connector.PerformPostgresCancellation())
{
// Note that if the cancellation timeout is negative, we flow down and break the
Expand Down Expand Up @@ -220,7 +220,7 @@ async ValueTask<int> ReadWithTimeoutAsync(Memory<byte> buffer, CancellationToken
// If we should attempt PostgreSQL cancellation, do it the first time we get a timeout.
// TODO: As an optimization, we can still attempt to send a cancellation request, but after
// that immediately break the connection
if (connector is { AttemptPostgresCancellation: true, PostgresCancellationPerformed: false } &&
if (connector is { ShouldAttemptPostgresCancellation: true } &&
connector.PerformPostgresCancellation())
{
// Note that if the cancellation timeout is negative, we flow down and break the
Expand Down Expand Up @@ -346,7 +346,7 @@ static async ValueTask EnsureLong(
// If we should attempt PostgreSQL cancellation, do it the first time we get a timeout.
// TODO: As an optimization, we can still attempt to send a cancellation request, but after
// that immediately break the connection
if (connector is { AttemptPostgresCancellation: true, PostgresCancellationPerformed: false } &&
if (connector is { ShouldAttemptPostgresCancellation: true } &&
connector.PerformPostgresCancellation())
{
// Note that if the cancellation timeout is negative, we flow down and break the
Expand Down
77 changes: 77 additions & 0 deletions test/Npgsql.Tests/CommandTests.cs