Description
When using Npgsql 10.x (.NET) with Supavisor (Transaction Pooler or Shared Pooler), ObjectDisposedException occurs on ManualResetEventSlim.Reset() under high latency conditions (500-1200ms).
Direct Connection (PgBouncer) works correctly with the exact same code.
Environment
- Npgsql: 10.0.1
- Npgsql.EntityFrameworkCore.PostgreSQL: 10.0.0
- .NET: 10.0
- EF Core: 10.0
- Network latency: 500-1200ms (Istanbul to EU-Central-1)
- Supabase region: EU-Central-1
Reproduction
Using EF Core's standard ExecutionStrategy pattern with transactions:
var strategy = context.Database.CreateExecutionStrategy();
await strategy.ExecuteAsync(async () =>
{
await using var transaction = await context.Database.BeginTransactionAsync();
// Single sequential operation
await context.SaveChangesAsync();
await transaction.CommitAsync();
});
Test Results
| Connection Type |
Backend |
Result |
| Transaction Pooler |
Supavisor |
❌ ObjectDisposedException |
| Session Pooler |
Supavisor |
❌ ObjectDisposedException |
| Direct Connection |
PgBouncer |
✅ Works correctly |
Stack Trace
System.ObjectDisposedException: The event has been disposed.
at System.Threading.ManualResetEventSlim.ThrowObjectDisposedException()
at System.Threading.ManualResetEventSlim.Reset()
at Npgsql.Internal.NpgsqlConnector.ResetCancellation()
at Npgsql.Internal.NpgsqlConnector.<Open>g__OpenCore|212_0()
...
Workaround
Using Direct Connection instead of Transaction/Shared Pooler bypasses Supavisor and resolves the issue.
Related Issues
Multiple users have confirmed this behavior. The Npgsql team indicated this is likely related to how Supavisor handles connection lifecycle under high latency conditions.
Expected Behavior
Supavisor should handle Npgsql 10.x connections the same way PgBouncer (Direct Connection) does, without causing ObjectDisposedException.
Description
When using Npgsql 10.x (.NET) with Supavisor (Transaction Pooler or Shared Pooler),
ObjectDisposedExceptionoccurs onManualResetEventSlim.Reset()under high latency conditions (500-1200ms).Direct Connection (PgBouncer) works correctly with the exact same code.
Environment
Reproduction
Using EF Core's standard ExecutionStrategy pattern with transactions:
Test Results
Stack Trace
Workaround
Using Direct Connection instead of Transaction/Shared Pooler bypasses Supavisor and resolves the issue.
Related Issues
Multiple users have confirmed this behavior. The Npgsql team indicated this is likely related to how Supavisor handles connection lifecycle under high latency conditions.
Expected Behavior
Supavisor should handle Npgsql 10.x connections the same way PgBouncer (Direct Connection) does, without causing ObjectDisposedException.