Mozilla UnifiedNlp Backend keeps crashing
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 221
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
Mozilla UnifiedNlp Backend keeps crashing, logcat shows:
```
12-05 00:29:48.173 870 4526 D GmsLocProviderU: unified network: no longer requesting location update
12-05 00:29:48.173 870 4526 D ULocClient: Disable automatic updates
12-05 00:29:48.173 870 4526 D ULocService: setUpdateInterval[com.google.android.gms] interval: 0
12-05 00:29:48.173 870 4526 D ULocService: Disable location updates
12-05 00:29:48.173 870 4526 D ULocClient: updateBinding - current: true, refs: 0, reqs: 0, avail: true
12-05 00:29:48.174 870 870 D ULocService: onDestroy
12-05 00:29:48.174 870 11722 D UnifiedLocation: Calling close
12-05 00:29:48.175 870 870 E ActivityThread: Service org.microg.nlp.service.UnifiedLocationServiceEntryPoint has leaked ServiceConnection org.microg.nlp.service.LocationBackendHelper@d898ab0 that was originally bound here
12-05 00:29:48.175 870 870 E ActivityThread: android.app.ServiceConnectionLeaked: Service org.microg.nlp.service.UnifiedLocationServiceEntryPoint has leaked ServiceConnection org.microg.nlp.service.LocationBackendHelper@d898ab0 that was originally bound here
12-05 00:29:48.175 870 870 E ActivityThread: at android.app.LoadedApk$ServiceDispatcher.(LoadedApk.java:1810)
12-05 00:29:48.175 870 870 E ActivityThread: at android.app.LoadedApk.getServiceDispatcherCommon(LoadedApk.java:1682)
12-05 00:29:48.175 870 870 E ActivityThread: at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:1661)
12-05 00:29:48.175 870 870 E ActivityThread: at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1721)
12-05 00:29:48.175 870 870 E ActivityThread: at android.app.ContextImpl.bindService(ContextImpl.java:1650)
12-05 00:29:48.175 870 870 E ActivityThread: at android.content.ContextWrapper.bindService(ContextWrapper.java:705)
12-05 00:29:48.175 870 870 E ActivityThread: at org.microg.nlp.service.AbstractBackendHelper.bind(AbstractBackendHelper.kt:76)
12-05 00:29:48.175 870 870 E ActivityThread: at org.microg.nlp.service.LocationFuser.bind(LocationFuser.kt:55)
12-05 00:29:48.175 870 870 E ActivityThread: at org.microg.nlp.service.UnifiedLocationServiceRoot.reset(UnifiedLocationServiceRoot.kt:219)
12-05 00:29:48.175 870 870 E ActivityThread: at org.microg.nlp.service.UnifiedLocationServiceRoot$1.invokeSuspend(UnifiedLocationServiceRoot.kt:44)
12-05 00:29:48.175 870 870 E ActivityThread: at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
12-05 00:29:48.175 870 870 E ActivityThread: at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
12-05 00:29:48.175 870 870 E ActivityThread: at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
12-05 00:29:48.175 870 870 E ActivityThread: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:738)
12-05 00:29:48.175 870 870 E ActivityThread: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
12-05 00:29:48.175 870 870 E ActivityThread: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
12-05 00:29:48.176 11925 11944 D IchnaeaBackendService: Deactivating instance at process 11925
12-05 00:29:48.177 870 4526 D UnifiedLocation: Unbinding from: Intent { act=org.microg.nlp.LOCATION_BACKEND pkg=org.microg.nlp.backend.ichnaea cmp=org.microg.nlp.backend.ichnaea/.BackendService }
12-05 00:29:48.177 870 4526 W UnifiedLocation:
12-05 00:29:48.177 870 4526 W UnifiedLocation: java.lang.IllegalArgumentException: Service not registered: org.microg.nlp.service.LocationBackendHelper@d898ab0
12-05 00:29:48.177 870 4526 W UnifiedLocation: at android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:1756)
12-05 00:29:48.177 870 4526 W UnifiedLocation: at android.app.ContextImpl.unbindService(ContextImpl.java:1776)
12-05 00:29:48.177 870 4526 W UnifiedLocation: at android.content.ContextWrapper.unbindService(ContextWrapper.java:741)
12-05 00:29:48.177 870 4526 W UnifiedLocation: at org.microg.nlp.service.AbstractBackendHelper.unbind(AbstractBackendHelper.kt:54)
12-05 00:29:48.177 870 4526 W UnifiedLocation: at org.microg.nlp.service.AbstractBackendHelper$unbind$1.invokeSuspend(Unknown Source:11)
12-05 00:29:48.177 870 4526 W UnifiedLocation: at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
12-05 00:29:48.177 870 4526 W UnifiedLocation: at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
12-05 00:29:48.177 870 4526 W UnifiedLocation: at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
12-05 00:29:48.177 870 4526 W UnifiedLocation: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:738)
12-05 00:29:48.177 870 4526 W UnifiedLocation: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
12-05 00:29:48.177 870 4526 W UnifiedLocation: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
12-05 00:29:48.177 11925 11925 D AndroidRuntime: Shutting down VM
12-05 00:29:48.178 11925 11925 E AndroidRuntime: FATAL EXCEPTION: main
12-05 00:29:48.178 11925 11925 E AndroidRuntime: Process: org.microg.nlp.backend.ichnaea, PID: 11925
12-05 00:29:48.178 11925 11925 E AndroidRuntime: java.lang.RuntimeException: Unable to unbind to service org.microg.nlp.backend.ichnaea.BackendService@15321cf with Intent { act=org.microg.nlp.LOCATION_BACKEND pkg=org.microg.nlp.backend.ichnaea cmp=org.microg.nlp.backend.ichnaea/.BackendService }: java.lang.IllegalStateException: Do not call onClose if not opened before
12-05 00:29:48.178 11925 11925 E AndroidRuntime: at android.app.ActivityThread.handleUnbindService(ActivityThread.java:4023)
12-05 00:29:48.178 11925 11925 E AndroidRuntime: at android.app.ActivityThread.access$1700(ActivityThread.java:219)
12-05 00:29:48.178 11925 11925 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1885)
12-05 00:29:48.178 11925 11925 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:107)
12-05 00:29:48.178 11925 11925 E AndroidRuntime: at android.os.Looper.loop(Looper.java:214)
12-05 00:29:48.178 11925 11925 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7356)
12-05 00:29:48.178 11925 11925 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
12-05 00:29:48.178 11925 11925 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:491)
12-05 00:29:48.178 11925 11925 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:940)
12-05 00:29:48.178 11925 11925 E AndroidRuntime: Caused by: java.lang.IllegalStateException: Do not call onClose if not opened before
12-05 00:29:48.178 11925 11925 E AndroidRuntime: at org.microg.nlp.api.AbstractBackendHelper.onClose(AbstractBackendHelper.java:47)
12-05 00:29:48.178 11925 11925 E AndroidRuntime: at org.microg.nlp.api.WiFiBackendHelper.onClose(WiFiBackendHelper.java:95)
12-05 00:29:48.178 11925 11925 E AndroidRuntime: at org.microg.nlp.api.HelperLocationBackendService.onClose(HelperLocationBackendService.java:64)
12-05 00:29:48.178 11925 11925 E AndroidRuntime: at org.microg.nlp.backend.ichnaea.BackendService.onClose(BackendService.java:153)
12-05 00:29:48.178 11925 11925 E AndroidRuntime: at org.microg.nlp.api.LocationBackendService.disconnect(LocationBackendService.java:80)
12-05 00:29:48.178 11925 11925 E AndroidRuntime: at org.microg.nlp.api.AbstractBackendService.onUnbind(AbstractBackendService.java:58)
12-05 00:29:48.178 11925 11925 E AndroidRuntime: at android.app.ActivityThread.handleUnbindService(ActivityThread.java:4007)
12-05 00:29:48.178 11925 11925 E AndroidRuntime: ... 8 more
```
**To Reproduce**
1. Open an App which tries to get location or open mozilla unifiednlp settings inside microg settings
4. See error after a while
**System**
Android Version: 10
Custom ROM: LineageOS with microg 17.1 (self compiled)
Mozilla UnifiedNlp Backend version: 1.4.0
MicroG version 0.2.22.212658
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with org.microg.nlp.api.AbstractBackendHelper.onClose and LocationBackendService.disconnect, then trace the unbind path shown in the log through org.microg.nlp.backend.ichnaea.BackendService. Reproduce using the listed Android location steps and verify that the Mozilla UnifiedNlp Backend no longer crashes when the service is stopped or unbound.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100