question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Received GOAWAY from APNs server with "null" reason

See original GitHub issue

Hi,

We are using pushy 0.7.2 to send out a large number (about 1.5 million tokens) of notifications. When first about 5000 tokens being sent (~3000 succeeded, ~2000 rejected), we get repeated Http2GoAwayException:

io.netty.handler.codec.http2.StreamBufferingEncoder$Http2GoAwayException: null
        at io.netty.handler.codec.http2.StreamBufferingEncoder.cancelGoAwayStreams(StreamBufferingEncoder.java:245) [netty-4.1.0.Final.jar:4.1.0.Final]
        at io.netty.handler.codec.http2.StreamBufferingEncoder.access$000(StreamBufferingEncoder.java:55) [netty-4.1.0.Final.jar:4.1.0.Final]
        at io.netty.handler.codec.http2.StreamBufferingEncoder$1.onGoAwayReceived(StreamBufferingEncoder.java:117) [netty-4.1.0.Final.jar:4.1.0.Final]
        at io.netty.handler.codec.http2.DefaultHttp2Connection.goAwayReceived(DefaultHttp2Connection.java:228) [netty-4.1.0.Final.jar:4.1.0.Final]
        at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder.onGoAwayRead0(DefaultHttp2ConnectionDecoder.java:186) [netty-4.1.0.Final.jar:4.1.0.Final]
        at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder$FrameReadListener.onGoAwayRead(DefaultHttp2ConnectionDecoder.java:523) [netty-4.1.0.Final.jar:4.1.0.Final]
        at io.netty.handler.codec.http2.DefaultHttp2FrameReader.readGoAwayFrame(DefaultHttp2FrameReader.java:564) [netty-4.1.0.Final.jar:4.1.0.Final]
        at io.netty.handler.codec.http2.DefaultHttp2FrameReader.processPayloadState(DefaultHttp2FrameReader.java:265) [netty-4.1.0.Final.jar:4.1.0.Final]
        at io.netty.handler.codec.http2.DefaultHttp2FrameReader.readFrame(DefaultHttp2FrameReader.java:155) [netty-4.1.0.Final.jar:4.1.0.Final]
        at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder.decodeFrame(DefaultHttp2ConnectionDecoder.java:113) [netty-4.1.0.Final.jar:4.1.0.Final]
        at io.netty.handler.codec.http2.Http2ConnectionHandler$FrameDecoder.decode(Http2ConnectionHandler.java:333) [netty-4.1.0.Final.jar:4.1.0.Final]
        at io.netty.handler.codec.http2.Http2ConnectionHandler.decode(Http2ConnectionHandler.java:393) [netty-4.1.0.Final.jar:4.1.0.Final]
        at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:406) [netty-4.1.0.Final.jar:4.1.0.Final]
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:243) [netty-4.1.0.Final.jar:4.1.0.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:349) [netty-4.1.0.Final.jar:4.1.0.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:335) [netty-4.1.0.Final.jar:4.1.0.Final]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:327) [netty-4.1.0.Final.jar:4.1.0.Final]
        at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:266) [netty-4.1.0.Final.jar:4.1.0.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:349) [netty-4.1.0.Final.jar:4.1.0.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:335) [netty-4.1.0.Final.jar:4.1.0.Final]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:327) [netty-4.1.0.Final.jar:4.1.0.Final]
        at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1070) [netty-4.1.0.Final.jar:4.1.0.Final]
        at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:904) [netty-4.1.0.Final.jar:4.1.0.Final]
        at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:406) [netty-4.1.0.Final.jar:4.1.0.Final]
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:243) [netty-4.1.0.Final.jar:4.1.0.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:349) [netty-4.1.0.Final.jar:4.1.0.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:335) [netty-4.1.0.Final.jar:4.1.0.Final]
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:327) [netty-4.1.0.Final.jar:4.1.0.Final]
        at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1336) [netty-4.1.0.Final.jar:4.1.0.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:349) [netty-4.1.0.Final.jar:4.1.0.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:335) [netty-4.1.0.Final.jar:4.1.0.Final]
        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:911) [netty-4.1.0.Final.jar:4.1.0.Final]
        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:123) [netty-4.1.0.Final.jar:4.1.0.Final]
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:544) [netty-4.1.0.Final.jar:4.1.0.Final]
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:485) [netty-4.1.0.Final.jar:4.1.0.Final]
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:399) [netty-4.1.0.Final.jar:4.1.0.Final]
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:371) [netty-4.1.0.Final.jar:4.1.0.Final]
        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:742) [netty-4.1.0.Final.jar:4.1.0.Final]
        at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:145) [netty-4.1.0.Final.jar:4.1.0.Final]
        at java.lang.Thread.run(Thread.java:745) [na:1.8.0_05]
[18:19:34 WARN ] Sending
java.util.concurrent.ExecutionException: io.netty.handler.codec.http2.StreamBufferingEncoder$Http2GoAwayException
        at io.netty.util.concurrent.AbstractFuture.get(AbstractFuture.java:41) ~[netty-4.1.0.Final.jar:4.1.0.Final]
        at com.idreamsky.push.apns.APNSAgent.operationComplete(APNSAgent.java:101) ~[APNSAgent.jar:na]

The code snap is as below:

@Override
public void operationComplete(Future<PushNotificationResponse<SimpleApnsPushNotification>> f) {
    try {
        try {
            PushNotificationResponse<SimpleApnsPushNotification> resp = f.get();
            SimpleApnsPushNotification notification = resp.getPushNotification();
            if (resp.isAccepted()) {
                if (listener != null) {
                    listener.onAccepted(appId, notification.getToken());
                }
                LOG.debug("[Sent] {}", notification.getToken());
            } else {
                if (listener != null) {
                    listener.onRejected(appId, notification.getToken(), resp.getRejectionReason());
                } else {
                    tokenDao.removeToken(appId, notification.getToken());
                }
                LOG.debug("[Rejected] {}: {}", notification.getToken(), resp.getRejectionReason());
            }
        } catch (ExecutionException e) {
            if (listener != null) {
                listener.onError(appId, e.getCause());
            }
            LOG.warn("Sending", e);
            if (e.getCause() instanceof ClientNotConnectedException) {
                apns.getReconnectionFuture().await(1000 * 60 * 30);//30min timeout
            }
        }
    } catch (InterruptedException e) {
        LOG.error(e.getMessage());
    }
}

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:22 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
jchamberscommented, Jun 15, 2016

Cool! Glad it’s resolved. It sounds like we can do more to clarify the situation in the README, docs, and FAQ. Will close this issue when those are all updated.

1reaction
Photoycommented, Jun 15, 2016

@jchambers, Yes, it is the case! Verified! @maor-teradata, Thank you. I assumed that the disconnect() method would handle the “naturally shutdown”.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Received GOAWAY from APNs server with "null" reason #312
In short, no. The client is connected (although it will soon disconnect), but streams are being (correctly) terminated because the server sent a ......
Read more >
Handling Notification Responses from APNs - Apple Developer
During testing, if you find that your test devices are not receiving push notifications sent by your provider server, examine the following possible...
Read more >
GOAWAY from APNs - Google Groups
ApnsClient client = new ApnsClientBuilder() ... ApnsClientHandler - Received GOAWAY from APNs server: {"reason":"BadCertificateEnvironment"}
Read more >
error Failed to fetch APNS token Error Domain=com.firebase ...
I'm using Firebase to handle push notifications in my iOS app. All notifications was working fine, but stop working suddenly without touch ...
Read more >
com.turo.pushy.apns.ApnsClientHandler Maven / Gradle / Ivy
package com.turo.pushy.apns; import com.google.gson. ... debugData) throws Http2Exception { log.info("Received GOAWAY from APNs server: {}", debugData.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found