Dmitry

Android Oreo ReconnectionManager crash

Discussion created by Dmitry on Sep 12, 2017
Latest reply on Sep 18, 2017 by Flow

I've just updated my phone to the latest Android 8 Oreo, now I am getting application crashes:

09-12 10:01:26.582 E/AndroidRuntime: FATAL EXCEPTION: Smack Reconnection Manager (1)

                                     Process: com.accelior.vega.debug, PID: 29209

                                     java.lang.NullPointerException: Attempt to get length of null array

                                         at de.measite.minidns.DNSClient.query(DNSClient.java:116)

                                         at de.measite.minidns.iterative.ReliableDNSClient.query(ReliableDNSClient.java:96)

                                         at de.measite.minidns.AbstractDNSClient.query(AbstractDNSClient.java:145)

                                         at de.measite.minidns.hla.ResolverApi.resolve(ResolverApi.java:44)

                                         at de.measite.minidns.hla.ResolverApi.resolve(ResolverApi.java:40)

                                         at de.measite.minidns.hla.ResolverApi.resolve(ResolverApi.java:34)

                                         at org.jivesoftware.smack.util.dns.minidns.MiniDnsResolver.lookupHostAddress0(Mini DnsResolver.java:112)

                                         at org.jivesoftware.smack.util.dns.DNSResolver.lookupHostAddress(DNSResolver.java: 55)

                                         at org.jivesoftware.smack.AbstractXMPPConnection.populateHostAddresses(AbstractXMP PConnection.java:620)

                                         at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectUsingConfiguration(XMPPTCPC onnection.java:556)

                                         at org.jivesoftware.smack.tcp.XMPPTCPConnection.connectInternal(XMPPTCPConnection. java:888)

                                         at org.jivesoftware.smack.AbstractXMPPConnection.connect(AbstractXMPPConnection.ja va:377)

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

                                         at java.lang.Thread.run(Thread.java:764)

As a possible solution to this, in the ReconnectionManager.reconnectionRunnable, instead of catching only a specific set of exceptions, catch all of them:

catch (Exception e) {

    // Fires the failed reconnection notification

    for (ConnectionListener listener : connection.connectionListeners) {

        listener.reconnectionFailed(e);

    }

}

 

Smack lib both 4.2.0 and 4.2.1

Outcomes