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

Android strict mode violation reported in NioUdpClient.sendrecv() #267

Closed
jt416 opened this issue Sep 28, 2022 · 1 comment
Closed

Android strict mode violation reported in NioUdpClient.sendrecv() #267

jt416 opened this issue Sep 28, 2022 · 1 comment

Comments

@jt416
Copy link

jt416 commented Sep 28, 2022

It appears there is a case where an open DatagramChannel is not closed.

This is from 3.4.2 but the source looks the same in master.

D/StrictMode: StrictMode policy violation: android.os.strictmode.LeakedClosableViolation: A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
        at android.os.StrictMode$AndroidCloseGuardReporter.report(StrictMode.java:1877)
        at dalvik.system.CloseGuard.warnIfOpen(CloseGuard.java:286)
        at sun.nio.ch.DatagramChannelImpl.finalize(DatagramChannelImpl.java:1083)
        at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:289)
        at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:276)
        at java.lang.Daemons$Daemon.run(Daemons.java:137)
        at java.lang.Thread.run(Thread.java:919)
     Caused by: java.lang.Throwable: Explicit termination method 'close' not called
        at dalvik.system.CloseGuard.open(CloseGuard.java:237)
        at sun.nio.ch.DatagramChannelImpl.<init>(DatagramChannelImpl.java:132)
        at sun.nio.ch.SelectorProviderImpl.openDatagramChannel(SelectorProviderImpl.java:42)
        at java.nio.channels.DatagramChannel.open(DatagramChannel.java:149)
        at org.xbill.DNS.NioUdpClient.sendrecv(NioUdpClient.java:158)
        at org.xbill.DNS.SimpleResolver.sendAsync(SimpleResolver.java:371)
        at org.xbill.DNS.SimpleResolver.sendAsync(SimpleResolver.java:338)
        at org.xbill.DNS.ExtendedResolver$Resolution.send(ExtendedResolver.java:81)
        at org.xbill.DNS.ExtendedResolver$Resolution.handle(ExtendedResolver.java:123)
        at org.xbill.DNS.ExtendedResolver$Resolution.lambda$handle$3$org-xbill-DNS-ExtendedResolver$Resolution(ExtendedResolver.java:124)
        at org.xbill.DNS.ExtendedResolver$Resolution$$ExternalSyntheticLambda0.apply(Unknown Source:8)
        at java.util.concurrent.CompletableFuture.uniHandle(CompletableFuture.java:834)
        at java.util.concurrent.CompletableFuture.uniHandleStage(CompletableFuture.java:846)
        at java.util.concurrent.CompletableFuture.handle(CompletableFuture.java:2183)
        at java.util.concurrent.CompletableFuture.handle(CompletableFuture.java:117)
        at org.xbill.DNS.ExtendedResolver$Resolution.handle(ExtendedResolver.java:124)
        at org.xbill.DNS.ExtendedResolver$Resolution.lambda$startAsync$2$org-xbill-DNS-ExtendedResolver$Resolution(ExtendedResolver.java:87)
        at org.xbill.DNS.ExtendedResolver$Resolution$$ExternalSyntheticLambda1.apply(Unknown Source:8)
        at java.util.concurrent.CompletableFuture.uniHandle(CompletableFuture.java:834)
        at java.util.concurrent.CompletableFuture.uniHandleStage(CompletableFuture.java:846)
        at java.util.concurrent.CompletableFuture.handle(CompletableFuture.java:2183)
        at java.util.concurrent.CompletableFuture.handle(CompletableFuture.java:117)
        at org.xbill.DNS.ExtendedResolver$Resolution.startAsync(ExtendedResolver.java:87)
        at org.xbill.DNS.ExtendedResolver$Resolution.access$800(ExtendedResolver.java:34)
        at org.xbill.DNS.ExtendedResolver.sendAsync(ExtendedResolver.java:310)
        at org.xbill.DNS.ExtendedResolver.sendAsync(ExtendedResolver.java:296)
        at org.xbill.DNS.Resolver.send(Resolver.java:152)
        at org.xbill.DNS.Lookup.lookup(Lookup.java:573)
        at org.xbill.DNS.Lookup.resolve(Lookup.java:653)
        at org.xbill.DNS.Lookup.run(Lookup.java:686)
@ibauersachs
Copy link
Member

I don't have an Android phone nor the simulator at hand. Can you please provide some details when this happens? Verbose-level logs from dnsjava would also be helpful.

@ibauersachs ibauersachs added the bug label Oct 2, 2022
ibauersachs added a commit that referenced this issue Aug 1, 2023
ibauersachs added a commit that referenced this issue Aug 1, 2023
@ibauersachs ibauersachs added this to the v3.5.3 milestone Aug 1, 2023
ibauersachs added a commit that referenced this issue Aug 1, 2023
ibauersachs added a commit that referenced this issue Aug 1, 2023
@ibauersachs ibauersachs removed this from the v3.5.3 milestone Nov 2, 2023
@ibauersachs ibauersachs removed the bug label Nov 2, 2023
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

No branches or pull requests

2 participants