powered by Jive Software

Smack removeRosterListener deadlock?

Hi Smack community,
we’ve been using Smack in our Web application for some time and it work well.
Recently, we experienced a problem where we were unable to shutdown application instance and after diggin in prstat output it’s clear that the issue is related to deadlock.

We are using Smack v.4.2.4 and here is the log output:

"Smack Cached Executor":
        at org.jivesoftware.smack.roster.Roster.fireRosterPresenceEvent(Roster.java:1270)
        - waiting to lock <0x000000071551af48> (a java.lang.Object)
        at org.jivesoftware.smack.roster.Roster.access$1200(Roster.java:91)
        at org.jivesoftware.smack.roster.Roster$PresencePacketListener.processStanza(Roster.java:1520)
        at org.jivesoftware.smack.roster.Roster.setOfflinePresences(Roster.java:1213)
        at org.jivesoftware.smack.roster.Roster.access$600(Roster.java:91)
        at org.jivesoftware.smack.roster.Roster$4.processStanza(Roster.java:346)
        at org.jivesoftware.smack.AbstractXMPPConnection$3.run(AbstractXMPPConnection.java:909)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
"Smack-Single Threaded Executor 82 (11565)":
        at com.sonicle.webtop.core.xmpp.XMPPClient.checkAuthentication(XMPPClient.java:1005)
        - waiting to lock <0x000000071550af58> (a org.jivesoftware.smack.tcp.XMPPTCPConnection)
        at com.sonicle.webtop.core.xmpp.XMPPClient.getFriendPresence(XMPPClient.java:256)
        at com.sonicle.webtop.core.xmpp.XMPPClient$XmppsRosterListener.presenceChanged(XMPPClient.java:1070)
        at org.jivesoftware.smack.roster.Roster.fireRosterPresenceEvent(Roster.java:1272)
        - locked <0x000000071551af48> (a java.lang.Object)
        at org.jivesoftware.smack.roster.Roster.access$1200(Roster.java:91)
        at org.jivesoftware.smack.roster.Roster$PresencePacketListener.processStanza(Roster.java:1520)
        at org.jivesoftware.smack.AbstractXMPPConnection$6.run(AbstractXMPPConnection.java:1263)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
"ContainerBackgroundProcessor[StandardEngine[Catalina]]":
        at org.jivesoftware.smack.roster.Roster.removeRosterListener(Roster.java:547)
        - waiting to lock <0x000000071551af48> (a java.lang.Object)
        at com.sonicle.webtop.core.xmpp.XMPPClient.internalLogout(XMPPClient.java:1001)
        at com.sonicle.webtop.core.xmpp.XMPPClient.disconnect(XMPPClient.java:195)
        - locked <0x000000071550af58> (a org.jivesoftware.smack.tcp.XMPPTCPConnection)
        at com.sonicle.webtop.core.Service.cleanup(Service.java:234)
        at com.sonicle.webtop.core.app.ServiceManager.cleanupPrivateService(ServiceManager.java:887)
        at com.sonicle.webtop.core.app.WebTopSession.emptyPrivateServices(WebTopSession.java:743)
        - locked <0x000000071550fd28> (a java.util.LinkedHashMap)
        at com.sonicle.webtop.core.app.WebTopSession.cleanup(WebTopSession.java:134)
        - locked <0x000000071550bee8> (a com.sonicle.webtop.core.app.WebTopSession)
        at com.sonicle.webtop.core.app.SessionManager.onContainerSessionDestroyed(SessionManager.java:160)
        at com.sonicle.webtop.core.app.shiro.WTContainerSessionListener.sessionDestroyed(WTContainerSessionListener.java:69)
        at org.apache.catalina.session.StandardSession.expire(StandardSession.java:824)
        - locked <0x000000071550bda0> (a org.apache.catalina.session.StandardSession)
        at org.apache.catalina.session.StandardSession.isValid(StandardSession.java:682)
        at org.apache.catalina.session.ManagerBase.processExpires(ManagerBase.java:550)
        at org.apache.catalina.session.ManagerBase.backgroundProcess(ManagerBase.java:535)
        at org.apache.catalina.core.StandardContext.backgroundProcess(StandardContext.java:5621)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1390)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1394)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1394)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1362)
        at java.lang.Thread.run(Thread.java:748)

Basically, when the web session expires, it calls removeRosterListener method, but the execution cannot continue due to lock in fireRosterPresenceEvent.

We would like to know if the there are known problems in Smack version we are using, something that we can solve with an upgrade. Is this issue can be caused by the top code that is using Smack?
Any advices are welcome! :slight_smile:

Thank you,
Matteo A.

Smack 4.2 is End-of-Life (EOL), hence I do not provide free community support for this version. You may want to 4.4.0 which is the newest release. Or, you could also update to 4.3.5 first, which is also EOL but may require less changes to your codebase.

If you need a detailed analysis of your issue, then you could consider using Smack’s professional support.

1 Like

This topic was automatically closed 62 days after the last reply. New replies are no longer allowed.