Skip to content

Commit 8cf2fa6

Browse files
authored
Fix test timeout_during_authentication (#6388)
1 parent 7751d2e commit 8cf2fa6

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

.github/workflows/build.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,10 +301,19 @@ jobs:
301301
# TODO: Once test/Npgsql.Specification.Tests work, switch to just testing on the solution
302302
- name: Test
303303
run: |
304-
dotnet test -c ${{ matrix.config }} -f ${{ matrix.test_tfm }} test/Npgsql.Tests --logger "GitHubActions;report-warnings=false" --blame-hang-timeout 30s
304+
dotnet test -c ${{ matrix.config }} -f ${{ matrix.test_tfm }} test/Npgsql.Tests --logger "GitHubActions;report-warnings=false" --blame-crash --blame-hang-timeout 30s
305305
dotnet test -c ${{ matrix.config }} -f ${{ matrix.test_tfm }} test/Npgsql.DependencyInjection.Tests --logger "GitHubActions;report-warnings=false"
306306
shell: bash
307307

308+
- name: Upload Test Hang Dumps
309+
uses: actions/upload-artifact@v6
310+
if: failure()
311+
with:
312+
name: test-hang-dumps
313+
path: |
314+
**/*.dmp
315+
**/Sequence*.xml
316+
308317
- name: Test Plugins
309318
if: "!startsWith(matrix.os, 'macos')"
310319
run: |

src/Npgsql/Internal/NpgsqlConnector.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,7 +1339,7 @@ async Task ConnectAsync(NpgsqlTimeout timeout, CancellationToken cancellationTok
13391339
}
13401340
else
13411341
{
1342-
IPAddress[] ipAddresses;
1342+
IPAddress[] ipAddresses = [];
13431343
try
13441344
{
13451345
using var combinedCts = timeout.IsSet ? CancellationTokenSource.CreateLinkedTokenSource(cancellationToken) : null;
@@ -1352,7 +1352,8 @@ async Task ConnectAsync(NpgsqlTimeout timeout, CancellationToken cancellationTok
13521352
catch (OperationCanceledException)
13531353
{
13541354
cancellationToken.ThrowIfCancellationRequested();
1355-
throw new TimeoutException();
1355+
Debug.Assert(timeout.HasExpired);
1356+
ThrowHelper.ThrowNpgsqlExceptionWithInnerTimeoutException("The operation has timed out");
13561357
}
13571358
}
13581359
catch (SocketException ex)

0 commit comments

Comments
 (0)