RE: Heuristic crash

László Tóth, modified 6 Years ago. Junior Member Posts: 36 Join Date: 5/9/19 Recent Posts
Hi!
I use screenlets (usually AssetListScreenlet or WebContentDisplayScreenlet) to display contents, but sometimes it's crashing with this error:
java.lang.IllegalMonitorStateException:
at java.util.concurrent.locks.ReentrantLock$Sync.tryRelease (ReentrantLock.java:152)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.release (AbstractQueuedSynchronizer.java:1285)
at java.util.concurrent.locks.ReentrantLock.unlock (ReentrantLock.java:458)
at com.liferay.mobile.android.auth.refresh.OAuth2AuthenticationRefreshHandler$1.onFailure (OAuth2AuthenticationRefreshHandler.java:45)
at com.liferay.mobile.android.auth.oauth2.TokenRequester$1.onResponse (TokenRequester.java:101)
at com.squareup.okhttp.Call$AsyncCall.execute (Call.java:177)
at com.squareup.okhttp.internal.NamedRunnable.run (NamedRunnable.java:33)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:641)
at java.lang.Thread.run (Thread.java:764)


Why get this error?How can I prevent/catch this crash?
Thank you!
thumbnail
Victor Galan, modified 6 Years ago. Regular Member Posts: 144 Join Date: 6/14/16 Recent Posts
Hey, this should be fixed with the 7.2.2 version of the liferay-mobile-sdk-core
László Tóth, modified 5 Years ago. Junior Member Posts: 36 Join Date: 5/9/19 Recent Posts
I've modified the dependency to the 7.2.2., but the the error is still coming! 
László Tóth, modified 5 Years ago. Junior Member Posts: 36 Join Date: 5/9/19 Recent Posts
Now is coming the below exception.... it's not the same, but similar
java.lang.IllegalMonitorStateException:
at java.util.concurrent.locks.ReentrantLock$Sync.tryRelease (ReentrantLock.java:152)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.release (AbstractQueuedSynchronizer.java:1285)
at java.util.concurrent.locks.ReentrantLock.unlock (ReentrantLock.java:458)
at com.liferay.mobile.android.auth.refresh.OAuth2AuthenticationRefreshHandler$1.onFailure (OAuth2AuthenticationRefreshHandler.java:45)
at com.liferay.mobile.android.auth.oauth2.TokenRequester$1.onFailure (TokenRequester.java:93)
at com.squareup.okhttp.Call$AsyncCall.execute (Call.java:185)
at com.squareup.okhttp.internal.NamedRunnable.run (NamedRunnable.java:33)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:641)
at java.lang.Thread.run (Thread.java:764)
thumbnail
Victor Galan, modified 5 Years ago. Regular Member Posts: 144 Join Date: 6/14/16 Recent Posts
Hey,Are you using liferay-screens in the same project?  I think it is using a past version imported for liferay-screensCan you check the version used executing
./gradlew app:dependencies 
app is the name of the gradle project, yours can be different
I hope it helps emoticon
László Tóth, modified 5 Years ago. Junior Member Posts: 36 Join Date: 5/9/19 Recent Posts
The relevant dependencies
+--- com.liferay.mobile:liferay-material-viewset:4.0.1@aar
+--- com.liferay.mobile:liferay-screens:5.0.3@aar
+--- com.liferay.mobile:liferay-push:1.2.1@aar
+--- com.liferay.mobile:liferay-android-sdk:7.2.2@aar
+--- com.liferay.mobile:liferay-android-services-v62:7.2.2@aar
+--- com.liferay.mobile:liferay-android-services-v7:7.2.2@aar
+--- com.liferay.mobile:liferay-android-services-v71:7.2.2@aar
+--- com.liferay.mobile:liferay-android-services-v72:7.2.2@aar
+--- com.liferay.mobile:liferay-android-sdk-core:7.2.2@aar
thumbnail
Victor Galan, modified 5 Years ago. Regular Member Posts: 144 Join Date: 6/14/16 Recent Posts
HeyIf you have the 7.2.2 version it shouldn't be possible to get that error because we didn't even use a reentrantLock in that class, can you check in your project the class OAuth2AuthenticationRefreshHandler and let me know if this is using the lock?
Thanks 
László Tóth, modified 5 Years ago. Junior Member Posts: 36 Join Date: 5/9/19 Recent Posts
As you've seen above, I use 7.2.2. I'd like to believe that it shouldn't be possible, but this error is created by endusers mobile.  After refreshing to 7.2.2, the error occurrence is less than before in 7.2.1.I don't know how can I check client's lock.I trying to refresh the application one more time.
László Tóth, modified 5 Years ago. Junior Member Posts: 36 Join Date: 5/9/19 Recent Posts
I inspected the apps logs, on newer version it runs good... no error.Thank you!