4thline/cling — pull request #92 by asamoylenko (2014-07-08 17:46:24+00:00)
Title: Crash fix UpnpServiceImpl.java

People keep experiencing a floating bug on the network message router shutdown, couldn't catch it by myself till today. It appears very rarely, but when it does, my app crashes. Here is the stacktrace:

FATAL EXCEPTION: Thread-9066
java.lang.RuntimeException: Router error on shutdown: org.fourthline.cling.transport.RouterException: Router wasn't available exclusively after waiting 15000ms, lock failed: WriteLock
at org.fourthline.cling.UpnpServiceImpl.shutdownRouter(UpnpServiceImpl.java:168)
at org.fourthline.cling.UpnpServiceImpl$1.run(UpnpServiceImpl.java:143)
at java.lang.Thread.run(Thread.java:856)
Caused by: org.fourthline.cling.transport.RouterException: Router wasn't available exclusively after waiting 15000ms, lock failed: WriteLock
at org.fourthline.cling.transport.RouterImpl.lock(RouterImpl.java:497)
at org.fourthline.cling.transport.RouterImpl.lock(RouterImpl.java:510)
at org.fourthline.cling.android.AndroidRouter.disable(AndroidRouter.java:108)
at org.fourthline.cling.transport.RouterImpl.shutdown(RouterImpl.java:199)
at org.fourthline.cling.android.AndroidRouter.shutdown(AndroidRouter.java:83)
at org.fourthline.cling.UpnpServiceImpl.shutdownRouter(UpnpServiceImpl.java:162)
at org.fourthline.cling.UpnpServiceImpl$1.run(UpnpServiceImpl.java:143)
at java.lang.Thread.run(Thread.java:856)

Test environment: XBMC server for Windows, Samsung Galaxy S4 (Android 4.2.2)

It appears on Android, can't tell for other platforms. Will be much appreciated, if you could apply this workaround sometime soon.

Thanks in advance!