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
ApnsClient is unable to reconnect #435
Comments
Strange. How often does this happen? Is it reproducible? Two things would be helpful from a debugging perspective:
Thanks! |
It happens nearly every week (on both servers, with low traffic). At the time it is not working I have a established connection in netstat:
And if the application is trying to send a push, their is nothing send (tracked with tcpdump). Their are only the ping packets every minute.
I have currently only enabled debug log level on pushy package and get this on send:
ApnsClient says also it is not connected and connecting again is not working. And tcpdump shows that their is a open connection. I'm using DI and queueing so their is only one instance of apns client in my application. Seems that he is losing the correct state internally. |
Based on the information you've provided, I agree. Thank you very much for digging into the issue! We'll see what we can figure out. |
One more question: do you see any lines in your logs like this?
Thanks! |
No. Currently if have this code in place of a client not connected exception: if (e.getCause() instanceof ClientNotConnectedException) {
try {
apnsClient.disconnect().await(TIMEOUT);
logger.info("reconnect apns client after disconnection: " + apnsClient.isConnected());
apnsClient.connect(sandbox ? ApnsClient.DEVELOPMENT_APNS_HOST : ApnsClient.PRODUCTION_APNS_HOST)
.await(TIMEOUT);
if (!retry) {
return sendMessage(...);
}
} catch (Exception e1) {
logger.info("failed to reconnect: " + e.getMessage());
}
} |
To clarify, what happens if you don't manually disconnect? Does the client appear to be trying to reconnect itself? As a separate question, is there anything in the logs that gives a hint about why the client disconnected in the first place? I'm wondering if this might be related to #433. |
I found this one time in my log (i have only the last 7 days). But that was 2 days before it stopped working.
But their is nothing in the log before the first ClientNotConnectedException is thrown.
So their was ~40 minute no push to send. |
Thanks. That helps narrow down the field of possibilities quite a bit! |
Maybe the issue is related to some dependency pushy has.
|
Very strange. Thanks for the update! |
I meet the same problem: the apnsClient.isConnected gives false, connect without exception but the next sending fails with ClientNotConenctedException. And my pushy version is 0.10.1, I need your help! |
After some time we get a ClientNotConnectedException and the ApnsClient is unable to reconnect. I tried several ways to to reconnect. First i implemented the suggestion like on the readme.
After that was not working i tried to force a disconnect and connect again, but that's also not working:
By the way the apnsClient.isConnected gives false, connect without exception but the next sending fails with ClientNotConenctedException.
Currently only help is to restart the application.
Used Pushy 0.9.2 with netty-tcnative 1.1.33.Fork25
The text was updated successfully, but these errors were encountered: