Hi All, Need help for this issue. Thanks in advance.
I have below issue once in a while. It takes almost 30 sec after sending notification and gets this warning.
WARN 2022-10-03 23:16:50,755 436994467 com.eatthepath.pushy.apns.ApnsChannelPool [nioEventLoopGroup-2474-1] Failed to create channel
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe$1.run(AbstractNioChannel.java:261)
at io.netty.util.concurrent.PromiseTask.runTask(PromiseTask.java:98)
at io.netty.util.concurrent.ScheduledFutureTask.run(ScheduledFutureTask.java:153)
at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:167)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:503)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:829)
Below is the code I am using :
private boolean sendNotification(ApnsClient client, final PushNotificationFuture<SimpleApnsPushNotification,PushNotificationResponse<SimpleApnsPushNotification>> sendNotificationFuture) throws InterruptedException, ExecutionException {
boolean accepted = false;
try {
final PushNotificationResponse<SimpleApnsPushNotification> pushNotificationResponse = sendNotificationFuture.get();
if (pushNotificationResponse.isAccepted()) {
accepted = true;
log.info("Notification accepted by the APNs gateway: ");
} else {
log.error("Notification rejected by the APNs gateway: " + pushNotificationResponse.getRejectionReason());
if (pushNotificationResponse.getTokenInvalidationTimestamp() != null) {
log.error("Notification rejected due to invalid timestamp: "+pushNotificationResponse.getTokenInvalidationTimestamp());
}
}
} catch (final ExecutionException e) {
//Exception Ignored - Retry will be attempted
throw e;
}
finally {
client.close();
}
return accepted;
}