I think we are almost there. What do you think of the following incremental (i.e. on top of your latest webrev) change?
http://cr.openjdk.java.net/~prappo/8228580/webrev.01/ I fixed a couple of trivial typos and addressed the socket relinquishing issue. Initializing a socket is not an atomic "all-or-nothing" operation now. Someone needs to take care of the socket in case things go not as planned. -Pavel > On 5 Sep 2019, at 11:20, Milan Mimica <milan.mim...@gmail.com> wrote: > > On Wed, 4 Sep 2019 at 20:32, Florian Weimer <fwei...@redhat.com> wrote: >> >> If you use the initial UDP timeout (one second, I think), the kernel >> will not complete the TCP handshake if the initial SYN segment is lost >> because the retransmit delay during the handshake is longer than that. > > We could set a higher timeout value, but I would not prefer that. > After all, 1 second is just default value, and can be changed. If the > user wants us to give up on DNS query after the specified timeout then > lets do just that. True, some queries that previously worked might > start failing, but that is true even for slow socket.read() > operations. > > New webrev: http://cr.openjdk.java.net/~mmimica/8228580/webrev.01/ > > * simplified test with no thread (nice catch Pavel) > * set connect timeout and account for it > > -- > Milan Mimica