Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not propagate exception once context has been closed in PushRegistrationHandler #1282

Merged
merged 1 commit into from
Aug 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,9 @@ public final void channelInactive(ChannelHandlerContext ctx) throws Exception {
}

@Override
public final void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
logger.error("Exception caught, closing push channel for " + authEvent, cause);
ctx.close();
Copy link
Contributor

@gavinbunney gavinbunney Aug 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we shift to closing on flush (i.e. closeOnFlush) rather than explicit close here?

if (ctx.channel().isActive()) {
    ctx.channel().writeAndFlush(Unpooled.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Synced offline — we can keep this change small and keep the close() behavior while still removing the final in case we (or anyone else) wants to override with the fancier closeOnFlush 👍

super.exceptionCaught(ctx, cause);
}

protected final void forceCloseConnectionFromServerSide() {
Expand Down