AndBible / and-bible

AndBible: Bible Study
https://andbible.org
GNU General Public License v3.0
576 stars 193 forks source link

TTS related crash #2212

Open tuomas2 opened 2 years ago

tuomas2 commented 2 years ago

https://support.andbible.org/scp/tickets.php?id=1543 https://support.andbible.org/scp/tickets.php?id=1545

08-03 09:24:51.994 20226 20226 E AndroidRuntime: FATAL EXCEPTION: main
08-03 09:24:51.994 20226 20226 E AndroidRuntime: Process: net.bible.android.activity, PID: 20226
08-03 09:24:51.994 20226 20226 E AndroidRuntime: android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{f4b390 u0 net.bible.android.activity/net.bible.service.device.speak.TextToSpeechNotificationManager$ForegroundService}
08-03 09:24:51.994 20226 20226 E AndroidRuntime:    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2093)
08-03 09:24:51.994 20226 20226 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:106)
08-03 09:24:51.994 20226 20226 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:236)
08-03 09:24:51.994 20226 20226 E AndroidRuntime:    at android.app.ActivityThread.main(ActivityThread.java:8107)
08-03 09:24:51.994 20226 20226 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
08-03 09:24:51.994 20226 20226 E AndroidRuntime:    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:656)
08-03 09:24:51.994 20226 20226 E AndroidRuntime:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967)
08-03 09:24:52.739 20226 20226 I Process : Sending signal. PID: 20226 SIG: 9
tuomas2 commented 2 years ago

I don't understand why it keeps happening my side too. I opened a phone cleaner app, then opened your app and it crashed, it opened but then crashed. At other times after opening a different all and then switching to yours, it crashes

tuomas2 commented 2 years ago

We have similar issue here: https://support.andbible.org/scp/tickets.php?id=1551

and with steps to reproduce:

  1. Opened app and read thru
  2. Switched over to WhatsApp
  3. Then back again to the Andbible app but then it crashed soon after opening it
08-07 09:06:22.827 28610 28610 E AndroidRuntime: FATAL EXCEPTION: main
08-07 09:06:22.827 28610 28610 E AndroidRuntime: Process: net.bible.android.activity, PID: 28610
08-07 09:06:22.827 28610 28610 E AndroidRuntime: android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{9f4dcb u0 net.bible.android.activity/net.bible.service.device.speak.TextToSpeechNotificationManager$ForegroundService}
08-07 09:06:22.827 28610 28610 E AndroidRuntime:    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2093)
08-07 09:06:22.827 28610 28610 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:106)
08-07 09:06:22.827 28610 28610 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:236)
08-07 09:06:22.827 28610 28610 E AndroidRuntime:    at android.app.ActivityThread.main(ActivityThread.java:8107)
08-07 09:06:22.827 28610 28610 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
08-07 09:06:22.827 28610 28610 E AndroidRuntime:    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:656)
08-07 09:06:22.827 28610 28610 E AndroidRuntime:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967)
0
tuomas2 commented 2 years ago

https://support.andbible.org/scp/tickets.php?id=1556

tuomas2 commented 2 years ago

again here https://support.andbible.org/scp/tickets.php?id=1558

tuomas2 commented 2 years ago

I'm guessing this could be related to these changes when I implemented media button support (and fixed related issues): #867 #2176 #2082

tuomas2 commented 2 years ago

https://support.andbible.org/scp/tickets.php?id=1558

tuomas2 commented 2 years ago

https://support.andbible.org/scp/tickets.php?id=1561

tuomas2 commented 2 years ago

https://support.andbible.org/scp/tickets.php?id=1568

tuomas2 commented 2 years ago

onTaskRemoved() -> stopSelf() ->  ... -> onDestroy

08-07 09:06:22.671 28610 28610 I Speak/TTSService: Task removed

<- switching to Whatsapp? 

SpeakEvent -> onEventMainThread -> startForeground().... onStartCommand() -> start() -> startForeground() 
foreground = true

08-07 09:06:22.676 28610 28610 I Speak/TTSService: START_SERVICE

onDestroy()

08-07 09:06:22.702 28610 28610 I WinRepository: saveIntoDb
08-07 09:06:22.822 28610 28610 I Speak/TTSService: onDestroy
08-07 09:06:22.824 28610 28610 I Speak/TTSService: STOP_SERVICE

foreground = false
stopForeground()

08-07 09:06:22.826 28610 28610 D AndroidRuntime: Shutting down VM
--------- beginning of crash
08-07 09:06:22.827 28610 28610 E AndroidRuntime: FATAL EXCEPTION: main
08-07 09:06:22.827 28610 28610 E AndroidRuntime: Process: net.bible.android.activity, PID: 28610
08-07 09:06:22.827 28610 28610 E AndroidRuntime: android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{9f4dcb u0 net.bible.android.activity/net.bible.service.device.speak.TextToSpeechNotificationManager$ForegroundService}
0
tuomas2 commented 2 years ago

I don't understand why it keeps happening my side too. I opened a phone cleaner app, then opened your app and it crashed, it opened but then crashed. At other times after opening a different all and then switching to yours, it crashes

Perhaps this "phone cleaner app" is the root cause... asking user.

tuomas2 commented 2 years ago

Perhaps this "phone cleaner app" is the root cause... asking user.

no:

Thanks for your reply. The phone cleaning app is disabled but still facing the same issue. I'll try to uninstall and reinstall the app

tuomas2 commented 1 year ago
  1. Stepping one verse backwards
  2. during SPEAK in Bible view
  3. while listening to a daily reading

Has happened over three times.

https://support.andbible.org/scp/tickets.php?id=1598

tuomas2 commented 1 year ago
  1. Stopped SPEAK
  2. Selected range of verses with +
  3. Selected SHARE

https://support.andbible.org/scp/tickets.php?id=1604

tuomas2 commented 1 year ago

https://support.andbible.org/scp/tickets.php?id=1609

App crashed because it's really impossible to fully exit it when tts playback notification is on. When I close the app, dismiss tts notification, then play audio from another app, this app starts playing audio by itself and that tts notification comes back again

tuomas2 commented 1 year ago

https://support.andbible.org/scp/tickets.php?id=1609

App crashed because it's really impossible to fully exit it when tts playback notification is on. When I close the app, dismiss tts notification, then play audio from another app, this app starts playing audio by itself and that tts notification comes back again

Tried playback from Youtube Music and it did not start AndBible Exact steps: 1. Started playback in AndBible 2. Paused it -> notification stays

  1. Closed app (swiped it away from task selector) -> notification stays
  2. Dismissed notification by swiping it away from notification bar
  3. Opened Youtube Music and started playback -> Youtube music starts playback nicely and AndBible keeps silent.
tuomas2 commented 1 year ago

I'm having that issue where the app would start playing by itself even when dismissed and closed on a second Samsung phone, a Galaxy a8 2018 on Android 9 (ONEUI 1). First device was A galaxy note 9 on Android 10 ONEUI 2.5. Launching the app sometimes (like half the time) immediately launches tts playback

https://support.andbible.org/scp/tickets.php?id=1609

tuomas2 commented 1 year ago

Just found the culprit! It's this app I have Installed (https://play.google.com/store/apps/details?id=apps.ijp.mediabar) that display a progress bar for media apps. It needs accessibility permissions, maybe that's why it's conflicting with your app.

https://support.andbible.org/scp/tickets.php?id=1609

tuomas2 commented 1 year ago

Here a person getes this ( or similar) crash by adjusting playback speed https://support.andbible.org/scp/tickets.php?id=1700

tuomas2 commented 1 year ago

https://support.andbible.org/scp/tickets.php?id=1731

tuomas2 commented 1 year ago

https://support.andbible.org/scp/tickets.php?id=1731

User reports that in 670 does not reproduce any more.

tuomas2 commented 1 year ago

I was listening to Scripture, using SPEAK, he book of Daniel, and I tapped the previous verse control button, in order to back up a few verses.

https://support.andbible.org/scp/tickets.php?id=1704

tuomas2 commented 1 year ago

https://support.andbible.org/scp/tickets.php?id=1703

I was listening to a portion of scripture using the SPEAK procedure, then I tapped PAUSE, then tapped ADD NOTE.

tuomas2 commented 1 year ago

Attempting to adjust the speech speed

https://support.andbible.org/scp/tickets.php?id=1700

tuomas2 commented 1 year ago

https://stackoverflow.com/questions/44425584/context-startforegroundservice-did-not-then-call-service-startforeground was giving me a little hint of how (possibly) to fix this issue. Trying it (needs some beta testing).

tuomas2 commented 1 year ago

So, there are two (probably related) crashes:

12-08 07:25:35.873 28316 28316 I Speak/TTSService: START_SERVICE
12-08 07:25:36.003 28316 28316 I Speak/TTSService: Updating notification, isSpeaking: true
12-08 07:25:42.759 28316 28316 I SpeakControl: Pause TTS speaking
12-08 07:25:42.760 28316 28316 I Speak   : Pause TTS
12-08 07:25:42.760 28316 28316 I Speak   : Duration:7296
12-08 07:25:42.760 28316 28316 I Speak   : Fraction completed:0.6589276356299597
12-08 07:25:42.760 28316 28316 I Speak   : Resetting. state: AND-BIBLE-1209 State(book=NASB, startVerse=Daniel 7:4, endVerse=Daniel 7:4, currentVerse=Daniel 7:5, command=net.bible.service.device.speak.TextCommand@d234a3b The first was like a lion and had the wings of an eagle. I kept looking until its wings were plucked, and it was lifted up from the ground and made to stand on two feet like a man; a human mind also was given to it.)
12-08 07:25:42.761 28316 28316 I Speak   : Persisting Pause state
12-08 07:25:42.770 28316 28316 I Speak   : Shutdown TTS Engine
12-08 07:25:42.779 28316 28316 I Speak/TTSService: SpeakEvent net.bible.service.device.speak.event.SpeakEvent@1b630ce
12-08 07:25:42.779 28316 28316 I Speak/TTSService: Stop foreground (pause)
12-08 07:25:42.786 28316 28316 I Speak/TTSService: Updating notification, isSpeaking: false
12-08 07:25:42.795 28316 28316 I SpeakWidget: updateWidgetTexts
12-08 07:25:42.795 28316 28316 I SpeakWidget: updating status
12-08 07:25:42.870 28316 28316 I Speak/TTSService: STOP_SERVICE
12-08 07:25:45.475 28316 28316 E AndroidRuntime: android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{812e745 u0 net.bible.android.activity/net.bible.service.device.speak.TextToSpeechNotificationManager$ForegroundService}
12-08 07:25:45.475 28316 28316 E AndroidRuntime:    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1879)
12-08 07:25:45.475 28316 28316 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:106)
12-08 07:25:45.475 28316 28316 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:214)
12-08 07:25:45.475 28316 28316 E AndroidRuntime:    at android.app.ActivityThread.main(ActivityThread.java:7078)
12-08 07:25:45.475 28316 28316 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
12-08 07:25:45.475 28316 28316 E AndroidRuntime:    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
12-08 07:25:45.475 28316 28316 E AndroidRuntime:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)

(previous verse control button)

and

12-08 05:39:56.125  2219  2232 I Speak   : Speak timer started
12-08 05:39:56.510  2219  2219 I Speak/TTSService: SpeakEvent net.bible.service.device.speak.event.SpeakEvent@9c62589
12-08 05:39:56.510  2219  2219 I Speak/TTSService: Stop foreground (pause)
12-08 05:39:57.004  2219  2219 I Speak/TTSService: Updating notification, isSpeaking: false
12-08 05:39:57.223  2219  2219 I SpeakWidget: updateWidgetTexts
12-08 05:39:57.223  2219  2219 I SpeakWidget: updating status
12-08 05:39:57.231  2219  2219 I SpeakWidget: updateWidgetSpeakButton
12-08 05:39:59.211  2219  2219 I MediaButtons: playback state SPEAKING
12-08 05:40:00.775  2219  2219 I Speak/TTSService: SpeakEvent net.bible.service.device.speak.event.SpeakEvent@7924dbc
12-08 05:40:01.157  2219  2219 I Speak/TTSService: Updating notification, isSpeaking: true
12-08 05:40:01.263  2219  2219 I Speak/TTSService: Foreground service started
12-08 05:40:01.266  2219  2219 I SpeakWidget: updateWidgetTexts
12-08 05:40:01.266  2219  2219 I SpeakWidget: updating status
12-08 05:40:01.268  2219  2219 I SpeakWidget: updateWidgetSpeakButton
12-08 05:40:56.927  3108  3108 I Speak/TTSService: START_SERVICE
12-08 05:40:57.291  3108  3108 D AndroidRuntime: Shutting down VM
12-08 05:40:57.347  3108  3108 E AndroidRuntime: java.lang.RuntimeException: Unable to start service net.bible.service.device.speak.TextToSpeechNotificationManager$ForegroundService@f3cd8e7 with Intent { act=action_start_service cmp=net.bible.android.activity/net.bible.service.device.speak.TextToSpeechNotificationManager$ForegroundService }: java.lang.NullPointerException
12-08 05:40:57.347  3108  3108 E AndroidRuntime:    at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3816)
12-08 05:40:57.347  3108  3108 E AndroidRuntime:    at android.app.ActivityThread.access$1600(ActivityThread.java:201)
12-08 05:40:57.347  3108  3108 E AndroidRuntime:    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1756)
12-08 05:40:57.347  3108  3108 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:106)
12-08 05:40:57.347  3108  3108 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:193)
12-08 05:40:57.347  3108  3108 E AndroidRuntime:    at android.app.ActivityThread.main(ActivityThread.java:6975)
12-08 05:40:57.347  3108  3108 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
12-08 05:40:57.347  3108  3108 E AndroidRuntime:    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
12-08 05:40:57.347  3108  3108 E AndroidRuntime:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:865)
12-08 05:40:57.347  3108  3108 E AndroidRuntime: Caused by: java.lang.NullPointerException
12-08 05:40:57.347  3108  3108 E AndroidRuntime:    at net.bible.service.device.speak.TextToSpeechNotificationManager$ForegroundService.start(TextToSpeechNotificationManager.kt:100)
12-08 05:40:57.347  3108  3108 E AndroidRuntime:    at net.bible.service.device.speak.TextToSpeechNotificationManager$ForegroundService.onStartCommand(TextToSpeechNotificationManager.kt:83)
12-08 05:40:57.347  3108  3108 E AndroidRuntime:    at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3797)
12-08 05:40:57.347  3108  3108 E AndroidRuntime:    ... 8 more

(attempt to adjust speech speed)

tuomas2 commented 1 year ago

Hmm no crash reports about htis recently. Could it be that we finally got over this...

tuomas2 commented 1 year ago

Closing in good hopes

tuomas2 commented 1 year ago

crashed again in 674 https://support.andbible.org/scp/tickets.php?id=1773

tuomas2 commented 1 year ago

https://support.andbible.org/scp/tickets.php?id=1791

tuomas2 commented 1 year ago

https://support.andbible.org/scp/tickets.php?id=1837 (using Samsung TTS)

tuomas2 commented 1 year ago

https://support.andbible.org/scp/tickets.php?id=1867