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

Handle pipeline().get( SslHandler.class) returning null #27

Closed
andrewscode opened this issue Dec 6, 2013 · 3 comments
Closed

Handle pipeline().get( SslHandler.class) returning null #27

andrewscode opened this issue Dec 6, 2013 · 3 comments
Labels
Milestone

Comments

@andrewscode
Copy link

I've come across a rare problem where channel.pipeline().get( SslHandler.class) can return null. The situation is that the channel connection completes but the ssl side fails (handshake error, ex. the remote side rejects the certificate). SslHandler will close the connection and then it (SslHandler) is removed from the pipeline. Thereby, it won't be possible to get a handshakeFuture

This code should check if this.channel.pipeline().get(SslHandler.class) is null, otherwise a null pointer exception could occur.

ApnsClientThread.java:423

this.handshakeFuture = this.channel.pipeline().get(SslHandler.class).handshakeFuture();

This should be rare since it's a tiny window between the channel opening and handshakeFuture is called, but yesterday I had it happen consistently happen.

@jchambers
Copy link
Owner

Sounds vaguely like netty/netty#1980.

@jchambers
Copy link
Owner

Also:

…and then it (SslHandler) is removed from the pipeline

Do you think that's the intended behavior or an upstream issue? I plan on working around it in Pushy either way, but will open an issue with Netty if need be.

@andrewscode
Copy link
Author

Do you think that's the intended behavior or an upstream issue? I plan on working around it in Pushy either way, but will open an issue with Netty if need be.

It may not be a bad idea but I wonder if there's a better way to get the handshakeFuture, perhaps when the SslHandler is created grab a reference to the handshakeFuture (currently inside the initChannel of the bootstrap),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants