Skip to content

100 sequential DNS queries over TCP consistently result in 1-2 failures only on macOS #3395

@MahdiBM

Description

@MahdiBM

I haven't investigated this too thoroughly myself. I'll be doing that later, and I'll appreciate if anyone here has any pointers to anything that could help my debugging. Or I could help you debug through the library, that's also one way.

Expected behavior

100 sequential-only DNS NS queries in swift-dns, on macOS only, over TCP only, using PostgresNIO's connection-pool module, should result in 0 failures, but don't.

Actual behavior

This specific test in swift-dns has been consistently failing over the past few months.
I didn't report this because I wanted to make sure I have connection unit tests first.

The failures are:

  • Almost always the query for dropbox.com
  • And then occasionally another domain as well.

dropbox.com usually fails with either channelInactive or queryTimeout (both are thrown by swift-dns).

Doing a single dropbox NS query doesn't ever fail by itself.
There is an integration test to do concurrent requests, that doesn't fail either.
There are a bunch of conn unit test to do concurrent/sequential queries and all of those are passing as well.

Linux is doing fine which makes me think the issue is due to the difference in ELGs used on different platforms in swift-dns (though this is common in swift-nio based pacakges), or the bootstraps.

Steps to reproduce

Clone https://github.com/MahdiBM/swift-dns.
Revision doesn't matter. Just use the main branch.
Run IntegrationTests.query100DomainsSequentially.
Like: swift test --filter IntegrationTests.query100DomainsSequentially.

If possible, minimal yet complete reproducer code (or URL to code)

Mentioned links above. I also have these packet captures that the CI archives:

swift-dns_dns_capture_2025-10-03-09-29-12_macos-26_6.2_debug_latest-stable_0a7eed3_failure.zip
You can find the dropbox query with this Wireshark filter: dns.id == 0xa95e.
The other failing query, that doesn't always happen, but does most of the times: dns.id == 0x1ea9 (edgekey.net).
This is a capture of the whole integration tests run, so it does contain more than just that one test.
Looking at the packet capture, the queries look to have been timely fulfilled and received a response. So this packet-capture might not be too helpful.

SwiftNIO version/commit hash

2.86.2

System & version information

macOS 15/26. The library requires Swift 6.2.

Please provide at the very least your operating system and Swift version
information.

Ideally, run

scripts/nio-diagnose -o nio-diagnose.md PID_OF_YOUR_NIO_PROGRAM

and attach (or paste) the resulting file nio-diagnose.md into this bug report
or send it to the SwiftNIO maintainers privately.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions