[#5541] Ensure failing a Promise in SimpleChannelPool will not result in stack overflow.

Motivation:

We used Promise.setFailure(...) when fail a Promise in SimpleChannelPool. As this happens in multiple levels this can result in stackoverflow as setFailure(...) may throw an IllegalStateException which then again is propergated.

Modifications:

Use tryFailure(...)

Result:

No more possibility to cause a stack overflow when failing the promise.
This commit is contained in:
Norman Maurer 2016-07-25 14:18:38 +02:00
parent cebf255951
commit dc6c6d956a

View File

@ -149,7 +149,7 @@ public class SimpleChannelPool implements ChannelPool {
});
}
} catch (Throwable cause) {
promise.setFailure(cause);
promise.tryFailure(cause);
}
return promise;
}
@ -162,7 +162,7 @@ public class SimpleChannelPool implements ChannelPool {
release(channel);
}
} else {
promise.setFailure(future.cause());
promise.tryFailure(future.cause());
}
}
@ -310,7 +310,7 @@ public class SimpleChannelPool implements ChannelPool {
private static void closeAndFail(Channel channel, Throwable cause, Promise<?> promise) {
closeChannel(channel);
promise.setFailure(cause);
promise.tryFailure(cause);
}
/**