netty: Exception message of 'connection refused' is confusing

Expected behavior

syscall:getsockopt(...) failed: does not appear in the exception message or something more helpful appears.

Actual behavior

syscall:getsockopt(...) failed: appears in the exception message.

Steps to reproduce

Attempt to connect to a unbound port, then you’ll get the following exception:

Caused by: io.netty.channel.AbstractChannel$AnnotatedConnectException: syscall:getsockopt(..) failed: Connection refused: square.lineapi.line-apps-beta.com/10.127.103.71:34773
	at io.netty.channel.unix.Socket.finishConnect(..)(Unknown Source)
Caused by: io.netty.channel.unix.Errors$NativeConnectException: syscall:getsockopt(..) failed: Connection refused
	... 1 more

This gives a user an impression that the connection attempt failed while trying to get some socket option, which doesn’t sound right, given that the exception occurred during finishConnect().

Netty version

4.1.9

OS version (e.g. uname -a)

Linux infinity 4.9.0-0.bpo.2-amd64 #1 SMP Debian 4.9.13-1~bpo8+1 (2017-02-27) x86_64 GNU/Linux

About this issue

  • Original URL
  • State: open
  • Created 7 years ago
  • Comments: 16 (12 by maintainers)

Most upvoted comments

I’m saying the fact that syscall getsocketopt() has been failed is an implementation detail and AnnotatedConnectException doesn’t need to show it to a user to misunderstand.