Skip to content

Add BlockHound exception for DnsQueryIdSpace (#16896) - #16915

Merged
chrisvest merged 1 commit into
netty:4.1from
chrisvest:4.1-backport-dns
Jun 5, 2026
Merged

chrisvest merged 1 commit into
netty:4.1from
chrisvest:4.1-backport-dns

Conversation

@chrisvest

Copy link
Copy Markdown
Member

Motivation:
DnsQueryIdSpace uses SecureRandom.nextBytes.
This can call java.io.FileInputStream#readBytes, which triggers a BlockingOperationError when BlockHound is enabled.

Modification:

  • Allow blocking calls in DnsQueryIdSpace#nextId and DnsQueryIdSpace$DnsQueryIdRange#pushId.
  • Add testDnsNameResolverAllowsBlockingCalls to verify that DnsNameResolver does not trigger BlockHound exceptions.

Result:
No BlockHound exceptions during DNS resolution.

Motivation:
DnsQueryIdSpace uses SecureRandom.nextBytes.
This can call java.io.FileInputStream#readBytes, which triggers a
BlockingOperationError when BlockHound is enabled.

Modification:
- Allow blocking calls in DnsQueryIdSpace#nextId and
DnsQueryIdSpace$DnsQueryIdRange#pushId.
- Add testDnsNameResolverAllowsBlockingCalls to verify that
DnsNameResolver does not trigger BlockHound exceptions.

Result:
No BlockHound exceptions during DNS resolution.
@chrisvest chrisvest added this to the 4.1.136.Final milestone Jun 4, 2026
@chrisvest
chrisvest merged commit 66cb6f1 into netty:4.1 Jun 5, 2026
18 checks passed
lltopk pushed a commit to lltopk/netty that referenced this pull request Oct 24, 2026
Motivation:
DnsQueryIdSpace uses SecureRandom.nextBytes.
This can call java.io.FileInputStream#readBytes, which triggers a
BlockingOperationError when BlockHound is enabled.

Modification:
- Allow blocking calls in DnsQueryIdSpace#nextId and
DnsQueryIdSpace$DnsQueryIdRange#pushId.
- Add testDnsNameResolverAllowsBlockingCalls to verify that
DnsNameResolver does not trigger BlockHound exceptions.

Result:
No BlockHound exceptions during DNS resolution.

Co-authored-by: Violeta Georgieva <[email protected]>
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.

2 participants