Skip to content

Commit

Permalink
Rethrow Error during retrieving remoteAddress / localAddress
Browse files Browse the repository at this point in the history
Motivation:

Besides an error caused by closing socket in Windows a bunch of other errors may happen at this place which won't be somehow logged. For instance any VirtualMachineError as OutOfMemoryError will be simply ignored. The library should at least log the problem.

Modification:

Added logging of the throwable object.

Result:

Fixes #8499.
  • Loading branch information
Andremoniy authored and normanmaurer committed Nov 16, 2018
1 parent cb0d239 commit abc8a08
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions transport/src/main/java/io/netty/channel/AbstractChannel.java
Expand Up @@ -170,6 +170,8 @@ public SocketAddress localAddress() {
if (localAddress == null) {
try {
this.localAddress = localAddress = unsafe().localAddress();
} catch (Error e) {
throw e;
} catch (Throwable t) {
// Sometimes fails on a closed socket in Windows.
return null;
Expand All @@ -192,6 +194,8 @@ public SocketAddress remoteAddress() {
if (remoteAddress == null) {
try {
this.remoteAddress = remoteAddress = unsafe().remoteAddress();
} catch (Error e) {
throw e;
} catch (Throwable t) {
// Sometimes fails on a closed socket in Windows.
return null;
Expand Down

0 comments on commit abc8a08

Please sign in to comment.