GeezerVison is showing github.com — PortUnreachableExceptions thrown without detail message · Issue #6179 · netty/netty
PortUnreachableExceptions thrown without detail message #6179DescriptionExpected behavior
When a PortUnreachableException is thrown, calling exception.getLocalizedMessage() should return a non-null String.
Actual behavior
PortUnreachableException has an available empty constructor which is being used by the underlying Netty library... Here's the call stack which leads to the Exception being created:
"vert.x-eventloop-thread-1@1858" prio=5 tid=0x14 nid=NA runnable
java.lang.Thread.State: RUNNABLE
at java.net.PortUnreachableException.<init>(PortUnreachableException.java:51)
at sun.nio.ch.DatagramChannelImpl.receive0(DatagramChannelImpl.java:-1)
at sun.nio.ch.DatagramChannelImpl.receiveIntoNativeBuffer(DatagramChannelImpl.java:414)
at sun.nio.ch.DatagramChannelImpl.receive(DatagramChannelImpl.java:392)
at sun.nio.ch.DatagramChannelImpl.receive(DatagramChannelImpl.java:345)
- locked <0x868> (a java.lang.Object)
at io.netty.channel.socket.nio.NioDatagramChannel.doReadMessages(NioDatagramChannel.java:248)
at io.netty.channel.nio.AbstractNioMessageChannel$NioMessageUnsafe.read(AbstractNioMessageChannel.java:75)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:610)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:551)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:465)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:437)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:873)
at java.lang.Thread.run(Thread.java:745)
So, this appears to be a JDK or a Netty problem, not a Vert.x problem.
Steps to reproduce
Attempt a UDP socket send to a non-existent service.
Minimal yet complete reproducer code (or URL to code)
I did this in Vert.x, so here is that code in Groovy:
vertx.createDnsClient(8053, '127.0.0.1').lookup('www.google.com', { res ->
if (res.succeeded()) {
LOG.info('SUCCESS')
} else {
LOG.error('FAILURE')
LOG.error(res.cause().getLocalizedMessage()) // Returns NULL
}
})
Netty version
4.1.5
JVM version (e.g. java -version)
java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)
OS version (e.g. uname -a)
Several
Activitynormanmaurer commented on Jan 6, 2017 @InfoSec812 this is thrown by the JDK impl itself so not much we can do here InfoSec812 commented on Jan 6, 2017 That's unfortunate! What about catch8ng and rethrowing?
Deven
…normanmaurer commented on Jan 6, 2017 Yep that is a good idea.. let me do this InfoSec812 commented on Jan 6, 2017 InfoSec812 commented on Jan 6, 2017 normanmaurer commented on Jan 7, 2017 @InfoSec812 one question.. what you would link to have in the exception message ? InfoSec812 commented on Jan 7, 2017 Received Port Unreachable when attempting to send to <socket addr>?
Something like that.
And thanks again!
Deven
…Scottmitch commented on Jan 7, 2017 Can't the rethrowing be done at a higher level? I just wonder if this will be useful for all use cases, or maybe some won't care about the message ... or can derive their own if necessary? Maybe not a big deal but just want to make sure the extra object allocation / wrapping is more generally useful. InfoSec812 commented on Jan 7, 2017 I would suggest that the error should be useful at the lowest level
possible so the all downstream users benefit. Also, adding the message will
not break existing implementations which currently handle the value being
null.
Deven
…
On Jan 7, 2017 3:47 PM, "Scott Mitchell" ***@***.***> wrote:
Can't the rethrowing be done at a higher level? I just wonder if this will
be useful for all use cases, or maybe some won't care about the message ...
or can derive their own if necessary? Maybe not a big deal but just want to
make sure the extra object allocation / wrapping is more generally useful.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
< #6179 (comment)>, or mute
the thread
< https://github.com/notifications/unsubscribe-auth/AAGFa0RlJHZygwlLZ5ldxSHwMv-X26W3ks5rP_nWgaJpZM4LcqCL>
.
normanmaurer commented on Jan 7, 2017 @Scottmitch I think it make sense to add it to netty as its basically the same as we do with out "ConnectException" stuff. I will also do an openjdk patch so we may get it fixed in openjdk at some point tho 👍 InfoSec812 commented on Jan 7, 2017 normanmaurer commented on Mar 28, 2018 At the end we decided we dont want to catch and rethrow.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|