java - Thread hangs while executing DNS query employing JNDI library -
below deadlock encountered result of thread getting locked while fetching txt record dns
java.lang.thread.state: runnable @ java.io.fileinputstream.readbytes(native method) @ java.io.fileinputstream.read(fileinputstream.java:272) @ sun.security.provider.nativeprng$randomio.readfully(nativeprng.java:202) @ sun.security.provider.nativeprng$randomio.ensurebuffervalid(nativeprng.java:264) @ sun.security.provider.nativeprng$randomio.implnextbytes(nativeprng.java:278) - locked <0x00000004f3cd17b0> (a java.lang.object) @ sun.security.provider.nativeprng$randomio.access$200(nativeprng.java:125) @ sun.security.provider.nativeprng.enginenextbytes(nativeprng.java:114) @ java.security.securerandom.nextbytes(securerandom.java:466) - locked <0x00000004f111d290> (a java.security.securerandom) @ java.security.securerandom.next(securerandom.java:488) @ java.util.random.nextint(random.java:303) @ com.sun.jndi.dns.dnsclient.query(dnsclient.java:175) @ com.sun.jndi.dns.resolver.query(resolver.java:81) @ com.sun.jndi.dns.dnscontext.c_getattributes(dnscontext.java:430) @ com.sun.jndi.toolkit.ctx.componentdircontext.p_getattributes(componentdircontext.java:231) @ com.sun.jndi.toolkit.ctx.partialcompositedircontext.getattributes(partialcompositedircontext.java:139) @ com.sun.jndi.toolkit.ctx.partialcompositedircontext.getattributes(partialcompositedircontext.java:127) @ javax.naming.directory.initialdircontext.getattributes(initialdircontext.java:142)
on analysing, find thread lock due slowness in executing java.security.securerandom.next .
below jdk bug filed similar deadlock encountered https://bugs.openjdk.java.net/browse/jdk-8066209
can please let me know reason occurring & how resolved ?
i seeing same issue , believe i've solved it. problem appears securerandom.nextbytes
reads /dev/random
. however, if there isn't sufficent entropy left in /dev/random
entropy pool read block. possible solutions see the oracle docs issue, this excellent article options securerandom, , this bug setting java option use /dev/./urandom
rather seemingly equivalent /dev/urandom
Comments
Post a Comment