powered by Jive Software

setKeepAliveInterval() used - still reconnection problems

Hi,

I am using Smack 3.2.2 with Java 6 for simple sending of IRC messages to a public server (technical status messages of a server side process). The initiating process runs for quite a long time, the IRC server however seems to break up connection once a day for a short time.

Smack however seems to have problems with this - although it should be okay regarding the API and various discussions going on about this topic.

I am setting programmatically a keepalive every 30 seconds:

SmackConfiguration.setKeepAliveInterval(300000);

An automatic reconnect seems not to work, so on sending packets I even try to reconnect manually

   try {

       connection.sendPacket(message);

   } catch (IllegalStateException e) {

       logger.info("IM Versand mit IllegalStateException, versuche Reconnect");

       connection.disconnect();

       connection.connect();

   }

On the console OTOH I can see stacktraces when the connection seems to break up an from this point on I cannot send any more messages even with the above trial to reconnect.

 java.net.SocketTimeoutException: Read timed out

         at java.net.SocketInputStream.socketRead0(Native Method)         at   

java.net.SocketInputStream.read(SocketInputStream.java:129)

         at   

com.sun.net.ssl.internal.ssl.InputRecord.readFully(InputRecord.java:293)

         at   

com.sun.net.ssl.internal.ssl.InputRecord.read(InputRecord.java:331)

         at

com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:830)

         at

com.sun.net.ssl.internal.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:787 )

         at   

com.sun.net.ssl.internal.ssl.AppInputStream.read(AppInputStream.java:75)

         at   

sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:264)

         at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:306)         at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:158)         at   

java.io.InputStreamReader.read(InputStreamReader.java:167)

         at java.io.BufferedReader.fill(BufferedReader.java:136)         at java.io.BufferedReader.read1(BufferedReader.java:187)         at java.io.BufferedReader.read(BufferedReader.java:261)         at org.xmlpull.mxp1.MXParser.fillBuf(MXParser.java:2992)         at org.xmlpull.mxp1.MXParser.more(MXParser.java:3046)         at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1144)         at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)         at   

org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:325)

         at   

org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:43)

         at   

org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:70)

 No response from the server.:

         at

org.jivesoftware.smack.SASLAuthentication.bindResourceAndEstablishSession(SASLAu thentication.java:452)

         at

org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java:3 48)

         at   

org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:203)

         at   

org.jivesoftware.smack.XMPPConnection.connect(XMPPConnection.java:964)

         at

org.jivesoftware.smack.ReconnectionManager$2.run(ReconnectionManager.java:128)

So any hints how to make the application “connection break down” safe is highly appreciated.

Thanks,

Soeren Gerlach