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

How to improve performance when pushy clients often reconnect by some disconnected Exception #441

Closed
ChasonLiang opened this issue Apr 1, 2017 · 1 comment

Comments

@ChasonLiang
Copy link

ChasonLiang commented Apr 1, 2017

Hi,

Our service located at BeiJing, China. The version of pusy is 0.9.2. I other encounter such Exception of "com.relayrides.pushy.apns.ClientNotConnectedException: Client disconnected unexpectedly" when sending a lot of notifications. We do not hope that our service to wait for reconnecting too much time, so I use 5 pushy clients to send notifications. If it is failed that one client sends a notification, we use another pushy client(isConnected() == true) to sent the notification again at once.

However, the solution is not good yet. It is easy that we encounter that all pushy are invalid.

Could you give me some suggestions to avoid encountering too many such exceptions, please? Or could you tell us some better usages to efficiently use pushy client?

The Exception is as following:

APNs client pipeline caught an exception. 
java.io.IOException: Connection timed out
	at sun.nio.ch.FileDispatcherImpl.read0(Native Method)
	at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39)
	at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
	at sun.nio.ch.IOUtil.read(IOUtil.java:192)
	at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:379)
	at io.netty.buffer.PooledUnsafeDirectByteBuf.setBytes(PooledUnsafeDirectByteBuf.java:288)
	at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1100)
	at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:366)
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:118)
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:651)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:574)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:488)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:450)
	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:873)
	at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144)
	at java.lang.Thread.run(Thread.java:745)
DEBUG : 2017-04-01 15:56:26 (nioEventLoopGroup-8-1) - com.relayrides.pushy.apns.ApnsClient 
Disconnected. Next automatic reconnection attempt in 1 seconds. 
ERROR : 2017-04-01 15:56:26 (nioEventLoopGroup-8-1) - com.xinge.push.manager.PushyApnsListener 
failed to send Notification: 142276 
ERROR : 2017-04-01 15:56:26 (nioEventLoopGroup-8-1) - com.xinge.push.manager.ResponseResultListener 
Failed to send push notification using the APNs Clinet[4] 
java.util.concurrent.ExecutionException: com.relayrides.pushy.apns.ClientNotConnectedException: Client disconnected unexpectedly.
	at io.netty.util.concurrent.AbstractFuture.get(AbstractFuture.java:41)
	at com.xinge.push.manager.ResponseResultListener.operationComplete(ResponseResultListener.java:34)
	at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:514)
	at io.netty.util.concurrent.DefaultPromise.notifyListeners0(DefaultPromise.java:507)
	at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:486)
	at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:427)
	at io.netty.util.concurrent.DefaultPromise.tryFailure(DefaultPromise.java:129)
	at com.relayrides.pushy.apns.ApnsClient$3$2.run(ApnsClient.java:514)
	at io.netty.util.concurrent.PromiseTask$RunnableAdapter.call(PromiseTask.java:38)
	at io.netty.util.concurrent.PromiseTask.run(PromiseTask.java:73)
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:418)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:454)
	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:873)
	at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144)
	at java.lang.Thread.run(Thread.java:745)
Caused by: com.relayrides.pushy.apns.ClientNotConnectedException: Client disconnected unexpectedly.
	... 9 more

Regards,
Chason

@jchambers
Copy link
Owner

This appears to be a duplicate of #433. I'm going to close this issue, but let's continue the conversation in #433.

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

No branches or pull requests

2 participants