Not Responding. Would you like to close it

Rusty

Well-Known Member
Licensed User
Longtime User
I have a Main app that has a service started with
B4X:
startactivity(servicename)
within the service, it plays some sound files that are held in a queue which resides in MAIN process globals. The queue is "popped" by the service and then the service issues
B4X:
StartServiceAt("", Datetime.now + .1 * 1000, False)
I've even tried
B4X:
StopService("")
Both play the audio perfectly
the first one shows
HTML:
** Service (servicename) Destroy **
in the log
The second shows
HTML:
** Service (servicename) Start **
in the log
I've put a timer in the Main which executes a Doevents every 1 second as per Erel's suggestion in another post, but after the application user interface is idle for a few seconds, i get the message
applicationname Not Responding. Would you like to close it
If i touch wait, the application will continue and I do not receive the message again even if i continue using the app.
It does not happen if the user touches any views and continues using the application.
I've disabled all other services to isolate the problem and now the sound generator is the only service running, the problem persists.
Any ideas of how to track this? When I hit the pause button in the IDE, it pauses in my doevents timer, so it appears nothing else is going on unless i touch a view.
Thanks
 

Rusty

Well-Known Member
Licensed User
Longtime User
No, I call the service repetitively with StartService from the Main.
Each time a veiw is touched, i queue up a sound file to play then startservice the sound service. It sees the sound file in the queue and plays it with MediaPlayer. When the MediaPlayer.complete occurs, it checks the queue for more sound files and plays them, popping them off the queue as it does so.
When the queue is empty, i used to just leave the service running and when the Main would add a sound file to the queue, it would just play it.
Now, I began receiving this message and have tried to stop the service and tried rescheduling the service to get rid of the error.
I've isolated the Main by not starting the service (so no sound) and the main app does not have this error, so I'm pretty sure the service is causing the problem, that's why I started trying to stop service/startat when the queue was empty. I even added a timer to the main app to execute doevents every 1 second.
Thanks Erel, any ideas?
 
Upvote 0

Rusty

Well-Known Member
Licensed User
Longtime User
I can't seem to find the trace file.
It says it wrote stack traces to '/data/anr/traces.txt' but that file does not exist on my tablet. Am I looking in the wrong place?
I'm looking in /sdcard/data/anr/traces.txt
Thanks
I couldn't find the file, but I right clicked and copied all, didn't know I could do this.
** Service (ttsservice) Destroy **
** Service (ttsservice) Create **
** Service (ttsservice) Start **
Failed to open file, all profile flags have to set through setprop method.
setDataSource_l('/mnt/sdcard/survey/APGAR_Consent/vox/By_signing_the_consentEng.mp3')
ERROR_END_OF_STREAM
** Service (ttsservice) Start **
Failed to open file, all profile flags have to set through setprop method.
setDataSource_l('/mnt/sdcard/survey/APGAR_Consent/vox/TrueEng.mp3')
ERROR_END_OF_STREAM
Failed to open file, all profile flags have to set through setprop method.
setDataSource_l('/mnt/sdcard/survey/APGAR_Consent/vox/FalseEng.mp3')
ERROR_END_OF_STREAM
ttsserice restart set
Timeout executing service: ServiceRecord{418e52c0 talkingsurvey.b4a.survey/.ttsservice}
Sending signal. PID: 1426 SIG: 3
threadid=3: reacting to signal 3
Wrote stack traces to '/data/anr/traces.txt'
Sending signal. PID: 166 SIG: 3
threadid=3: reacting to signal 3
Wrote stack traces to '/data/anr/traces.txt'
Sending signal. PID: 423 SIG: 3
threadid=3: reacting to signal 3
Wrote stack traces to '/data/anr/traces.txt'
Sending signal. PID: 275 SIG: 3
threadid=3: reacting to signal 3
Wrote stack traces to '/data/anr/traces.txt'
Sending signal. PID: 437 SIG: 3
threadid=3: reacting to signal 3
Wrote stack traces to '/data/anr/traces.txt'
GC_CONCURRENT freed 1964K, 14% free 13152K/15175K, paused 2ms+6ms
GC_EXPLICIT freed 647K, 14% free 13200K/15175K, paused 2ms+5ms
ANR in talkingsurvey.b4a.survey
Reason: Executing service talkingsurvey.b4a.survey/.ttsservice
Load: 0.35 / 0.38 / 0.16
CPU usage from 7646ms to 0ms ago:
4.1% 166/system_server: 2.7% user + 1.4% kernel / faults: 13 minor
1.1% 269/ksdioirqd/mmc2: 0% user + 1.1% kernel
0.5% 956/anywheresoftware.b4a.b4abridge: 0.3% user + 0.1% kernel / faults: 24 minor
0.5% 1426/talkingsurvey.b4a.survey: 0.5% user + 0% kernel / faults: 31 minor
0.1% 3/ksoftirqd/0: 0% user + 0.1% kernel
0% 10/ksoftirqd/1: 0% user + 0% kernel
0.1% 61/kinteractiveup: 0% user + 0.1% kernel
0.1% 90/mediaserver: 0.1% user + 0% kernel
0.1% 98/kworker/0:2: 0% user + 0.1% kernel
0.1% 266/dhd_watchdog: 0% user + 0.1% kernel
0.1% 267/dhd_dpc: 0% user + 0.1% kernel
0% 270/wpa_supplicant2: 0% user + 0% kernel
0% 437/com.android.phone: 0% user + 0% kernel / faults: 11 minor
0% 781/com.android.email: 0% user + 0% kernel
0.7% TOTAL: 0.1% user + 0.5% kernel + 0% softirq
CPU usage from 360ms to 876ms later:
9.4% 166/system_server: 5.6% user + 3.7% kernel / faults: 5 minor
5.6% 180/ActivityManager: 1.8% user + 3.7% kernel
3.7% 178/SensorService: 3.7% user + 0% kernel
1.8% 179/er.ServerThread: 1.8% user + 0% kernel
1.8% 189/UEventObserver: 1.8% user + 0% kernel
1.4% 269/ksdioirqd/mmc2: 0% user + 1.4% kernel
2% TOTAL: 0% user + 2% kernel
Triggered Alarm 418df7d0 ELAPSED_REALTIME_WAKEUP IntentSender{4190a180: PendingIntentRecord{41293e40 android broadcastIntent}}
Added alarm Alarm{416c8f48 type 2 android} type:ELAPSED_REALTIME_WAKEUP when: After 0h:1m:34.0s
Triggered Alarm 41754370 RTC_WAKEUP IntentSender{4162fb18: PendingIntentRecord{4175e658 com.asus.cm broadcastIntent}}
Start proc com.asus.cm for broadcast com.asus.cm/.push.PushControlReceiver: pid=1568 uid=1000 gids={3003, 1015, 3002, 3001, 3007}
DMConfig.init()
mFumoHandlerName=DefaultFumoHandler
allowShowMoreInfoOnError=false
allowFotaPolling=true
connected -> start server
get cached uniqueID
============== PushService.onStartCommand() ==============
get cached uniqueID
ClassLoader.getResources: The class loader returned by Thread.getContextClassLoader() may fail for processes that host multiple applications. You should explicitly specify a context class loader. For example: Thread.setContextClassLoader(getClass().getClassLoader());
addClient: 14:DA:E9:1C:CD:EB
Triggered Alarm 416c8f48 ELAPSED_REALTIME_WAKEUP IntentSender{41323340: PendingIntentRecord{41293e40 android broadcastIntent}}
Added alarm Alarm{41920b48 type 2 android} type:ELAPSED_REALTIME_WAKEUP when: After 0h:0m:30.0s
failed sync operation xxxxx (com.google), com.android.gallery3d.picasa.contentprovider, POLL, earliestRunTime 158914, SyncResult: stats [ numIoExceptions: 1]
Triggered Alarm 41920b48 ELAPSED_REALTIME_WAKEUP IntentSender{41420068: PendingIntentRecord{41293e40 android broadcastIntent}}
Added alarm Alarm{417b93d0 type 2 android} type:ELAPSED_REALTIME_WAKEUP when: After 0h:3m:38.0s
Force finishing activity talkingsurvey.b4a.survey/.main
** Activity (main) Pause, UserClosed = true **
Killing ProcessRecord{418b2c78 1426:talkingsurvey.b4a.survey/10024}: user's request
adjustConfigurationLw, config:{1.0 0mcc0mnc (no locale) layoutdir=0 sw800dp w1280dp h752dp xlrg land ?uimode ?night finger -keyb/v/h -nav/v} mLidOpen:-1 mHasDockFeature:true mHasHallSensorFeature:true config.hardKeyboardHidden:2
session id 8 not found for pid 90
WIN DEATH: Window{418b72f8 talkingsurvey.b4a.survey/talkingsurvey.b4a.survey.main paused=false}
Process talkingsurvey.b4a.survey (pid 1426) has died.
Scheduling restart of crashed service talkingsurvey.b4a.survey/.ttsservice in 327640ms
WIN DEATH: Window{418b9280 talkingsurvey.b4a.survey/talkingsurvey.b4a.survey.main paused=false}
No longer want com.android.packageinstaller (pid 1244): hidden #16
Got RemoteException sending setActive(false) notification to pid 1426 uid 10024
TextType = 0x0
START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 pkg=com.estrongs.android.pop cmp=com.estrongs.android.pop/.view.FileExplorerActivity bnds=[144,444][240,540]} from pid 449
Start proc com.estrongs.android.pop for activity com.estrongs.android.pop/.view.FileExplorerActivity: pid=1589 uid=10087 gids={3003, 3002, 3001, 1015}
Turning on JNI app bug workarounds for target SDK version 4...
adjustConfigurationLw, config:{1.0 0mcc0mnc (no locale) layoutdir=0 sw800dp w1280dp h752dp xlrg land ?uimode ?night finger -keyb/v/h -nav/v} mLidOpen:-1 mHasDockFeature:true mHasHallSensorFeature:true config.hardKeyboardHidden:2
Flushing caches (mode 1)
Flushing caches (mode 0)
Pub com.estrongs.android.provider.fex: com.estrongs.android.pop.FexProvider
Pub com.estrongs.files: com.estrongs.android.pop.app.FileContentProvider
RequestEventHandler:0 is waiting to pop request...
RequestEventHandler:2 is waiting to pop request...
RequestEventHandler:1 is waiting to pop request...
RequestEventHandler:3 is waiting to pop request...
GC_CONCURRENT freed 222K, 4% free 6771K/7047K, paused 3ms+1ms
Constructor - Got Res id for appearance for textColorPrimaryInverse
Skipping entry 0x1060003 in package table 0 because it is not complex!
Constructor - Got appearance for textColorPrimaryInverse
Constructor -- Got mEditTextBackgroundColor
GC_CONCURRENT freed 282K, 5% free 6959K/7303K, paused 3ms+3ms
GC_FOR_ALLOC freed 276K, 7% free 7099K/7559K, paused 19ms
GC_CONCURRENT freed 265K, 6% free 7246K/7687K, paused 2ms+3ms
GC_CONCURRENT freed 313K, 6% free 7419K/7815K, paused 3ms+3ms
GC_CONCURRENT freed 318K, 6% free 7586K/8007K, paused 2ms+3ms
GC_FOR_ALLOC freed 6K, 6% free 7579K/8007K, paused 15ms
Grow heap (frag case) to 7.703MB for 262160-byte allocation
GC_FOR_ALLOC freed 0K, 6% free 7835K/8327K, paused 23ms
setLightsOn(true)
nativeDestroy view: 0x1883400
GC_EXPLICIT freed 700K, 14% free 13146K/15175K, paused 3ms+5ms
TextType = 0x0
Displayed com.estrongs.android.pop/.view.FileExplorerActivity: +1s81ms
GC_CONCURRENT freed 392K, 6% free 7918K/8391K, paused 2ms+5ms
GC_FOR_ALLOC freed 50K, 6% free 7923K/8391K, paused 24ms
Grow heap (frag case) to 7.934MB for 152656-byte allocation
GC_FOR_ALLOC freed <1K, 6% free 8071K/8583K, paused 16ms
GC_FOR_ALLOC freed 0K, 6% free 8072K/8583K, paused 16ms
Grow heap (frag case) to 8.080MB for 152656-byte allocation
GC_FOR_ALLOC freed 0K, 7% free 8221K/8775K, paused 17ms
GC_FOR_ALLOC freed 0K, 7% free 8221K/8775K, paused 17ms
Grow heap (frag case) to 8.225MB for 152656-byte allocation
GC_FOR_ALLOC freed 0K, 7% free 8370K/8967K, paused 17ms
GC_FOR_ALLOC freed 0K, 5% free 8519K/8967K, paused 17ms
GC_FOR_ALLOC freed <1K, 6% free 8668K/9159K, paused 16ms
GC_FOR_ALLOC freed 0K, 6% free 8818K/9351K, paused 17ms
GC_FOR_ALLOC freed 0K, 7% free 8967K/9543K, paused 17ms
GC_FOR_ALLOC freed 0K, 5% free 9265K/9735K, paused 17ms
GC_FOR_ALLOC freed 0K, 6% free 9564K/10119K, paused 16ms
GC_FOR_ALLOC freed 0K, 6% free 10160K/10695K, paused 17ms
GC_FOR_ALLOC freed 53K, 5% free 10906K/11463K, paused 17ms
GC_CONCURRENT freed 21418K, 69% free 9708K/31239K, paused 5ms+5ms
@PowerManagement: 'KEEP_SCREEN_ON_FLAG' releaseWakeLock when screen locked
GC_FOR_ALLOC freed 3898K, 33% free 8289K/12359K, paused 17ms
GC_CONCURRENT freed 20K, 29% free 8866K/12359K, paused 1ms+3ms
GC_CONCURRENT freed <1K, 23% free 9612K/12359K, paused 2ms+2ms
GC_CONCURRENT freed 2270K, 33% free 8293K/12359K, paused 1ms+3ms
GC_CONCURRENT freed 10K, 29% free 8880K/12359K, paused 1ms+2ms
GC_FOR_ALLOC freed <1K, 23% free 9626K/12359K, paused 17ms
GC_CONCURRENT freed <1K, 14% free 10670K/12359K, paused 2ms+3ms
battery level:100 plugged:1
Triggered Alarm 417b93d0 ELAPSED_REALTIME_WAKEUP IntentSender{41818340: PendingIntentRecord{41293e40 android broadcastIntent}}
Added alarm Alarm{418c58e0 type 2 android} type:ELAPSED_REALTIME_WAKEUP when: After 0h:0m:29.0s
failed sync operation xxxxx (com.google), com.android.gallery3d.picasa.contentprovider, POLL, earliestRunTime 283390, SyncResult: stats [ numIoExceptions: 1]
Added alarm Alarm{4168a180 type 0 com.google.android.gsf} type:RTC_WAKEUP when: At 6/11/12 9:41 AM repeatInterval: 0h:30m:0.0s
Triggered Alarm 4168a180 RTC_WAKEUP IntentSender{415dc978: PendingIntentRecord{4168a080 com.google.android.gsf broadcastIntent}}
Aggregate from 1339425673845 (log), 1339425673845 (data)
Unknown tag: facelock_activated
Unknown tag: facelock_fail
Unknown tag: facelock_success
Removed alarm Alarm{4168a180 type 0 com.google.android.gsf} type:RTC_WAKEUP
Added alarm Alarm{41823870 type 0 com.google.android.gsf} type:RTC_WAKEUP when: At 6/11/12 9:41 AM repeatInterval: 0h:30m:0.0s
GC_CONCURRENT freed 399K, 10% free 6623K/7303K, paused 6ms+2ms
GC_FOR_ALLOC freed 3173K, 30% free 8752K/12359K, paused 18ms
GC_CONCURRENT freed 15K, 24% free 9483K/12359K, paused 2ms+4ms
GC_CONCURRENT freed <1K, 17% free 10378K/12359K, paused 1ms+2ms
Triggered Alarm 418c58e0 ELAPSED_REALTIME_WAKEUP IntentSender{4176b720: PendingIntentRecord{41293e40 android broadcastIntent}}
Added alarm Alarm{413b14d8 type 2 android} type:ELAPSED_REALTIME_WAKEUP when: After 0h:7m:47.0s
GC_CONCURRENT freed 3613K, 36% free 7975K/12359K, paused 1ms+3ms
GC_FOR_ALLOC freed 56K, 33% free 8291K/12359K, paused 26ms
GC_CONCURRENT freed 1K, 29% free 8887K/12359K, paused 1ms+2ms
GC_CONCURRENT freed <1K, 23% free 9633K/12359K, paused 2ms+3ms
GC_CONCURRENT freed <1K, 14% free 10677K/12359K, paused 3ms+5ms
battery level:100 plugged:1
Start proc talkingsurvey.b4a.survey for service talkingsurvey.b4a.survey/.ttsservice: pid=1637 uid=10024 gids={1015, 3003, 3002}
Turning on JNI app bug workarounds for target SDK version 4...
** Service (ttsservice) Create **
** Service (ttsservice) Start **
unable to find stats for iface rmnet0

Even though this is in the trace, the sounds are playing.
 
Last edited:
Upvote 0

Rusty

Well-Known Member
Licensed User
Longtime User
Hi Erel,
I edited my previous post after copying the unfiltered logs as per your suggestion.
I don't want to clutter this thread with duplicate postings, so if you could look at the previous post (from me) and advise on the logs, I would appreciate it.
Regards
 
Upvote 0

Rusty

Well-Known Member
Licensed User
Longtime User
What can cause this?
I call StartService when adding items to the queue.
If I add three items to the queue, I call StartService after adding each item.
Is this correct?
No there is no log file, I even searched using file manager and no file.
 
Upvote 0

Rusty

Well-Known Member
Licensed User
Longtime User
B4X:
Sub Service_Create
   MediaPlayer1.Initialize2("MediaPlayer1")
   Main.MediaServiceIsRunning = True
End Sub

Sub Service_Start
   Highlight = True
   If Main.MediaPointer < 1 Then
      MediaPlayer1.stop
      StopService("")
   End If
   If Main.MediaPointer > 0 Then
      If Main.MediaQueue(0).Vox.trim <> "" Then          'there is a vox file to play   
         If MediaPlayer1.IsPlaying = False Then 
            MediaPlayer1_Complete      'cause it to play
         End If
      Else
         If Main.MediaQueue(0).Alternate.Trim <> "" Then  'there is alternate text to speak use TTS (taken out due to not responding error
            RemoveFromMediaQueue(0)      'remove it from the queue
         End If
      End If
   Else                              'they've cleared the queue and want it to stop talking
      Highlight = False                  'indicate that they are just stopping the vox playing and not trying to highlight
      MediaPlayer1.Stop
      StopService("")
   End If
End Sub
 
Upvote 0

Rusty

Well-Known Member
Licensed User
Longtime User
B4X:
'Service module
Sub Process_Globals
   Dim MediaPlayer1 As MediaPlayer
   Dim Highlight As Boolean       
End Sub

Sub Service_Create
   MediaPlayer1.Initialize2("MediaPlayer1")
   Main.MediaServiceIsRunning = True
End Sub

Sub Service_Start
   Highlight = True
   If Main.MediaPointer < 1 Then
      MediaPlayer1.stop
      StopService("")
   End If
   If Main.MediaPointer > 0 Then
      If Main.MediaQueue(0).Vox.trim <> "" Then          'there is a vox file to play   
         If MediaPlayer1.IsPlaying = False Then 
            MediaPlayer1_Complete      'cause it to play
         End If
      Else
         If Main.MediaQueue(0).Alternate.Trim <> "" Then                  'there is alternate text to speak
            RemoveFromMediaQueue(0)      'remove it from the queue
         End If
      End If
   Else                              'they've cleared the queue and want it to stop talking
      Highlight = False                  'indicate that they are just stopping the vox playing and not trying to highlight
      MediaPlayer1.Stop
      StopService("")
   End If
End Sub

Sub Service_Destroy
   MediaPlayer1.Stop
   MediaPlayer1.Release
End Sub

'When the media is finished see if there is more to play
Sub MediaPlayer1_Complete
   If Main.MediaQueue(0).vox <> "" Then
      MediaPlayer1.Load(Main.MediaQueue(0).VoxFldr, Main.MediaQueue(0).Vox)
      MediaPlayer1.Play
      RemoveFromMediaQueue(0)      'remove it from the queue
   End If
End Sub

'Remove the playing item from the queue
Sub RemoveFromMediaQueue(Item As Int)
   If Main.MediaPointer = 0 Then
      Main.MediaQueue(0).Vox = ""
      Main.MediaQueue(0).Alternate = ""
      Main.MediaQueue(0).Wait = 0
      Main.Mediaqueue(0).ViewNo = 0
      Main.MediaQueue(0).isHighLighted = False
   Else
      For i = 0 To Main.MediaPointer  
         Main.MediaQueue(i).vox = Main.MediaQueue(i+1).Vox
         Main.MediaQueue(i).alternate = Main.MediaQueue(i+1).alternate
         Main.MediaQueue(i).Wait = Main.MediaQueue(i+1).Wait
         Main.Mediaqueue(i).ViewNo = Main.MediaQueue(i+1).ViewNo
         Main.MediaQueue(i).isHighLighted = Main.MediaQueue(i+1).isHighLighted
         Main.MediaQueue(i+1).Vox = ""
         Main.MediaQueue(i+1).Alternate = ""
         Main.MediaQueue(i+1).Wait = 0
      Next
   End If
   Main.MediaPointer = Main.MediaPointer - 1
   If Main.MediaPointer < 0 Then Main.MediaPointer = 0
End Sub
 
Upvote 0

Rusty

Well-Known Member
Licensed User
Longtime User
Erel,
I sent you a private message but don't know how to attach a zip file.
Meanwhile, I took out all StopService calls and (even though the .mp3 file keeps playing) the program does not encounter this error.
However, this is not my desired result. I need to be able to stop the mediaplayer (which exists in the service) from playing at will.
Am I failing to treat the mediaplayer properly?
Thanks,
 
Upvote 0

Rusty

Well-Known Member
Licensed User
Longtime User
Erel,
I've done a lot of experimenting and have moved the mediaplayer to the MAIN and manage it from the service. This way I never have to stop and release the mediaplayer resources in the service.
I am able to stop the mediaplayer playing by merely issuing a mediaplayer.stop in the MAIN. The service still manages the mediaqueue and plays the .mp3 files.
This seems to have fixed the not responding error. :sign0060:
Your assistance is greatly appreciated, thanks.
I'm interested if the way I solved this makes any sense or if it is "good practice"
Regards,
Rusty
 
Upvote 0
Top