Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Foreground service related crash #352

Open
ianthetechie opened this issue Nov 8, 2024 · 1 comment
Open

Foreground service related crash #352

ianthetechie opened this issue Nov 8, 2024 · 1 comment
Labels
android bug Something isn't working

Comments

@ianthetechie
Copy link
Contributor

Got this interesting crash in the demo app... Nothing particularly interesting about the session. I had just started it up in the emulator and was idle (during a trip, but no inputs since location was static at the time).

2024-11-09 01:39:49.123  3755-3755  AndroidRuntime          com.stadiamaps.ferrostar.demo        E  FATAL EXCEPTION: main
                                                                                                    Process: com.stadiamaps.ferrostar.demo, PID: 3755
                                                                                                    android.app.RemoteServiceException$ForegroundServiceDidNotStartInTimeException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{9148e2a u0 com.stadiamaps.ferrostar.demo/com.stadiamaps.ferrostar.core.service.FerrostarForegroundService}
                                                                                                    	at android.app.ActivityThread.generateForegroundServiceDidNotStartInTimeException(ActivityThread.java:2104)
                                                                                                    	at android.app.ActivityThread.throwRemoteServiceException(ActivityThread.java:2075)
                                                                                                    	at android.app.ActivityThread.-$$Nest$mthrowRemoteServiceException(Unknown Source:0)
                                                                                                    	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2369)
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:106)
                                                                                                    	at android.os.Looper.loopOnce(Looper.java:205)
                                                                                                    	at android.os.Looper.loop(Looper.java:294)
                                                                                                    	at android.app.ActivityThread.main(ActivityThread.java:8177)
                                                                                                    	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
                                                                                                    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
                                                                                                    Caused by: android.app.StackTrace: Last startServiceCommon() call for this service was made here
                                                                                                    	at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1952)
                                                                                                    	at android.app.ContextImpl.startForegroundService(ContextImpl.java:1906)
                                                                                                    	at android.content.ContextWrapper.startForegroundService(ContextWrapper.java:830)
                                                                                                    	at com.stadiamaps.ferrostar.core.service.FerrostarForegroundServiceManager.startService(ForegroundServiceManager.kt:65)
                                                                                                    	at com.stadiamaps.ferrostar.core.FerrostarCore.startNavigation(FerrostarCore.kt:228)
                                                                                                    	at com.stadiamaps.ferrostar.core.FerrostarCore.startNavigation$default(FerrostarCore.kt:220)
                                                                                                    	at com.stadiamaps.ferrostar.DemoNavigationSceneKt$DemoNavigationScene$4$1$1$1$1$1$1.invokeSuspend(DemoNavigationScene.kt:155)
                                                                                                    	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
                                                                                                    	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:101)
                                                                                                    	at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:113)
                                                                                                    	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:89)
                                                                                                    	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:589)
                                                                                                    	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:823)
                                                                                                    	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:720)
                                                                                                    	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:707)
@ianthetechie ianthetechie added bug Something isn't working android labels Nov 8, 2024
@Archdoog
Copy link
Collaborator

I got this once out of 10s of runs w/ the demo app. I haven't troubleshot it, so I'm not sure, but I'm guessing it has to do with the coroutine context the autocomplete search is running on, since that's now auto starting navigation. E.g. running start foreground from an IO thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android bug Something isn't working
Projects
Status: No status
Development

No branches or pull requests

2 participants