roycezhc/javapns

The feedback service hangs while connecting to production server

GoogleCodeExporter opened this issue · 4 comments

Sometimes the feedback method hangs while connecting to Apple productions 
server. Happened twice on the last weeks. 

What steps will reproduce the problem?
Cannot explain how to reproduce the problem.

What is the expected output? What do you see instead?
The last log I see on the log is: "ConnectionToAppleServer:149 - Creating 
SSLSocket to feedback.push.apple.com:2196". After this I expect to see the log 
"FeedbackServiceManager:102 - Found: [0]" but nothing else appears.

What version of the product are you using? On what operating system?
JavaPNS_2.2

Please provide any additional information below.
I think the problem is because the "getDevices" method on the 
"FeedbackServiceManager" class does not set any timeout while connecting to the 
Apple server..

Original issue reported on code.google.com by lluismon...@gmail.com on 5 Nov 2013 at 8:56

Operating System: Linux

Original comment by lluismon...@gmail.com on 5 Nov 2013 at 9:05

Encountered this issue while having problems with Internet connectivity - 
thread was left waiting forever in the socketStream.read() call in 
FeedbackServiceManager.getDevices(SSLSocket). Socket was open at OS level, to 
exit this state must set TCP keepalives or a read timeout. Patched locally by 
adding a socket.setSoTimeout() in 
FeedbackServiceManager.getDevices(AppleFeedbackServer). Might be nice to move 
timeouts to ConnectionToAppleServe.

Original comment by seb...@gmail.com on 21 Feb 2014 at 11:43

Fixed in r382 (trunk)

Original comment by sype...@gmail.com on 30 Sep 2014 at 2:12

  • Changed state: Fixed
  • Added labels: Type-Enhancement
  • Removed labels: Type-Defect
Experiencing the same behaviour in our servers running in AWS (Java 7, javapns 
2.1). Sending thread hangs at:

java.net.SocketInputStream.socketRead0(native)
java.net.SocketInputStream.read(SocketInputStream.java:150)
java.net.SocketInputStream.read(SocketInputStream.java:121)
sun.security.ssl.InputRecord.readFully(InputRecord.java:442)
sun.security.ssl.InputRecord.read(InputRecord.java:480)
sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:927)
sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1312)
sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:882)
sun.security.ssl.AppInputStream.read(AppInputStream.java:102)
javapns.feedback.FeedbackServiceManager.getDevices(FeedbackServiceManager.java:9
6)
javapns.feedback.FeedbackServiceManager.getDevices(FeedbackServiceManager.java:7
2)
javapns.Push.feedback(Push.java:325)

(this is from version 2.1, but the trunk code in the FeedbackServiceManager 
still looks the same)

Please add a socket timeout (like is done in the PushNotificationManager class 
after the "connectionToAppleServer.getSSLSocket()" calls) in the 
FeedbackServiceManager.

Original comment by lucas041...@gmail.com on 30 Apr 2014 at 2:38