Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blocking call in UnixResolverDnsServerAddressStreamProvider.parse #10925

Closed
violetagg opened this issue Jan 12, 2021 · 3 comments · Fixed by #10935
Closed

Blocking call in UnixResolverDnsServerAddressStreamProvider.parse #10925

violetagg opened this issue Jan 12, 2021 · 3 comments · Fixed by #10935

Comments

@violetagg
Copy link
Member

Expected behavior

No blocking calls reported by BlockHound

Actual behavior

The exception below appears when BlockHound is installed

reactor.blockhound.BlockingOperationError: Blocking call! java.io.FileInputStream#readBytes
     	at java.io.FileInputStream.readBytes(FileInputStream.java)
     	at java.io.FileInputStream.read(FileInputStream.java:255)
     	at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)
     	at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
     	at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
     	at java.io.InputStreamReader.read(InputStreamReader.java:184)
     	at java.io.BufferedReader.fill(BufferedReader.java:161)
     	at java.io.BufferedReader.readLine(BufferedReader.java:324)
     	at java.io.BufferedReader.readLine(BufferedReader.java:389)
     	at io.netty.resolver.dns.UnixResolverDnsServerAddressStreamProvider.parse(UnixResolverDnsServerAddressStreamProvider.java:175)
     	at io.netty.resolver.dns.UnixResolverDnsServerAddressStreamProvider.<init>(UnixResolverDnsServerAddressStreamProvider.java:98)
     	at io.netty.resolver.dns.UnixResolverDnsServerAddressStreamProvider.<init>(UnixResolverDnsServerAddressStreamProvider.java:133)
     	at io.netty.resolver.dns.UnixResolverDnsServerAddressStreamProvider.parseSilently(UnixResolverDnsServerAddressStreamProvider.java:72)
     	at io.netty.resolver.dns.DnsServerAddressStreamProviders$DefaultProviderHolder$1.provider(DnsServerAddressStreamProviders.java:139)
     	at io.netty.resolver.dns.DnsServerAddressStreamProviders$DefaultProviderHolder$1.nameServerAddressStream(DnsServerAddressStreamProviders.java:129)
     	at io.netty.resolver.dns.DnsNameResolver.doResolveAllUncached0(DnsNameResolver.java:1070)
     	at io.netty.resolver.dns.DnsNameResolver.access$600(DnsNameResolver.java:90)
     	at io.netty.resolver.dns.DnsNameResolver$6.run(DnsNameResolver.java:1053)
     	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
     	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
     	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
    	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
     	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
     	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
     	at java.lang.Thread.run(Thread.java:748)

Netty version

4.1.57.Final

JVM version (e.g. java -version)

JDK 8

OS version (e.g. uname -a)

MacOS

@normanmaurer
Copy link
Member

@violetagg can you provide a PR ?

@violetagg
Copy link
Member Author

@normanmaurer I was thinking for allowing blocking calls when loading etcResolverFiles, is that what you are thinking also?

@normanmaurer
Copy link
Member

This sounds good

normanmaurer pushed a commit that referenced this issue Jan 14, 2021
…rse (#10935)


Motivation:

Internally UnixResolverDnsServerAddressStreamProvider#parse calls FileInputStream.read(...)
when parsing the etcResolverFiles.
This will cause the error below when BlockHound is enabled
reactor.blockhound.BlockingOperationError: Blocking call! java.io.FileInputStream#readBytes
     	at java.io.FileInputStream.readBytes(FileInputStream.java)
     	at java.io.FileInputStream.read(FileInputStream.java:255)

Modifications:

- Add whitelist entry to BlockHound configuration
- Add test

Result:

Fixes #10925
normanmaurer pushed a commit that referenced this issue Jan 14, 2021
…rse (#10935)

Motivation:

Internally UnixResolverDnsServerAddressStreamProvider#parse calls FileInputStream.read(...)
when parsing the etcResolverFiles.
This will cause the error below when BlockHound is enabled
reactor.blockhound.BlockingOperationError: Blocking call! java.io.FileInputStream#readBytes
     	at java.io.FileInputStream.readBytes(FileInputStream.java)
     	at java.io.FileInputStream.read(FileInputStream.java:255)

Modifications:

- Add whitelist entry to BlockHound configuration
- Add test

Result:

Fixes #10925
ZzxyNn pushed a commit to ZzxyNn/netty that referenced this issue Jan 29, 2021
…rse (netty#10935)


Motivation:

Internally UnixResolverDnsServerAddressStreamProvider#parse calls FileInputStream.read(...)
when parsing the etcResolverFiles.
This will cause the error below when BlockHound is enabled
reactor.blockhound.BlockingOperationError: Blocking call! java.io.FileInputStream#readBytes
     	at java.io.FileInputStream.readBytes(FileInputStream.java)
     	at java.io.FileInputStream.read(FileInputStream.java:255)

Modifications:

- Add whitelist entry to BlockHound configuration
- Add test

Result:

Fixes netty#10925
raidyue pushed a commit to raidyue/netty that referenced this issue Jul 8, 2022
…rse (netty#10935)


Motivation:

Internally UnixResolverDnsServerAddressStreamProvider#parse calls FileInputStream.read(...)
when parsing the etcResolverFiles.
This will cause the error below when BlockHound is enabled
reactor.blockhound.BlockingOperationError: Blocking call! java.io.FileInputStream#readBytes
     	at java.io.FileInputStream.readBytes(FileInputStream.java)
     	at java.io.FileInputStream.read(FileInputStream.java:255)

Modifications:

- Add whitelist entry to BlockHound configuration
- Add test

Result:

Fixes netty#10925
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 a pull request may close this issue.

2 participants