Hi again,
Our service is still crashing for some reason not related to our
application. To make sure it's not RunTime exception we've used a :
try
{
// Get WakeLock
// Perform actions
}
catch (Throwable t)
{
// log error (if any)
}
finally
{
// Schedule a new service startup and PendingIntent an AlarmManager
long tick = 60000L;
long nextUpdate = System.currentTimeMillis();
nextUpdate += (tick - nextUpdate % tick);
Intent updateIntent = new Intent();
updateIntent.setClass(this, RefreshService.class);
PendingIntent pendingIntent = PendingIntent.getService(this, 0,
updateIntent, 0);
AlarmManager alarmManager = (AlarmManager)getSystemService
(Context.ALARM_SERVICE);
alarmManager.set(AlarmManager.RTC, nextUpdate, pendingIntent);
// Release WakeLock
...
}
stopSelf();
The service is still crashing randomly on real device (Android 1.6/HTC
Magic) and it does not restart. It's not a problem of Taskiller
because it is not installed.
Here are the logs:
01-06 21:18:00.653: INFO/ActivityManager(75): Stopping service:
xx.yy/.widget.RefreshService
01-06 21:18:06.283: DEBUG/dalvikvm(1318): GC freed 4957 objects /
283104 bytes in 110ms
// Problem starts here.
01-06 21:18:59.153: INFO/ActivityManager(75): Process xx.yy(pid 1318)
has died.
01-06 21:21:33.530: INFO/ActivityManager(75): Start proc xx.yyfor
service xx.yy/.widget.RefreshService: pid=1339 uid=10031 gids={3003,
1015}
01-06 21:21:33.720: INFO/dalvikvm(1339): Debugger thread not active,
ignoring DDM send (t=0x41504e4d l=38)
01-06 21:21:33.750: INFO/dalvikvm(1339): Debugger thread not active,
ignoring DDM send (t=0x41504e4d l=48)
01-06 21:21:34.520: INFO/ActivityManager(75): Stopping service:
xx.yy/.widget.RefreshService
01-06 21:23:11.526: ERROR/JavaBinder(75): !!! FAILED BINDER
TRANSACTION !!!
01-06 21:23:11.536: ERROR/JavaBinder(75): !!! FAILED BINDER
TRANSACTION !!!
01-06 21:23:11.635: INFO/ActivityManager(75): Process xx.yy(pid 1339)
has died.
01-06 21:23:11.686: WARN/ActivityManager(75): Scheduling restart of
crashed service xx.yy/.widget.RefreshService in 5000ms
01-06 21:23:16.736: INFO/ActivityManager(75): Start proc xx.yy for
service xx.yy/.widget.RefreshService: pid=1349 uid=10031 gids={3003,
1015}
01-06 21:23:16.825: INFO/dalvikvm(1349): Debugger thread not active,
ignoring DDM send (t=0x41504e4d l=38)
01-06 21:23:16.855: INFO/dalvikvm(1349): Debugger thread not active,
ignoring DDM send (t=0x41504e4d l=48)
// But service never restarts !
We've run the following command according to Dianne advice: "adb shell
dumpsys activity.services" and we can see our service but it is not
executed.
Currently running services:
activity.services
-------------------------------------------------------------------------------
DUMP OF SERVICE activity.services:
Services in Current Activity Manager State:
Active services:
* ServiceRecord{43563d78 xx.yy/.widget.RefreshService}
intent={cmp=xx.yy/.widget.RefreshService}
packageName=xx.yy
processName=xx.uu
baseDir=/data/app/xx.yy.apk/data/app/xx.yy.apk dataDir=/data/data/
xx.yy
app=ProcessRecord{4348d8f8 1349:xx.yy/10031}
isForeground=false lastActivity=-675021
startRequested=true startId=1 executeNesting=0
executingStart=-675021 crashCount=0
totalRestartCount=1 restartCount=1 restartDelay=5000
restartTime=-675021 nextRestartTime=-675183
* ServiceRecord{43471978
com.google.android.location/.NetworkLocationService}
intent={cmp=com.google.android.location/.NetworkLocationService}
packageName=com.google.android.location
processName=system
baseDir=/system/app/NetworkLocation.apk/system/app/
NetworkLocation.apk dataDir=/data/data/com.google.android.location
app=ProcessRecord{433869d8 75:system/1000}
isForeground=false lastActivity=-6811360
startRequested=true startId=1 executeNesting=0
executingStart=-6811353 crashCount=0
totalRestartCount=0 restartCount=0 restartDelay=0
restartTime=-6811360 nextRestartTime=-6857706
* ServiceRecord{43430480
com.google.android.googleapps/.GoogleLoginService}
intent={cmp=com.google.android.googleapps/.GoogleLoginService}
packageName=com.google.android.googleapps
processName=com.google.process.gapps
baseDir=/system/app/GoogleApps.apk/system/app/GoogleApps.apk
dataDir=/data/data/com.google.android.googleapps
app=ProcessRecord{4337a268 149:com.google.process.gapps/10015}
isForeground=false lastActivity=-330241
startRequested=false startId=0 executeNesting=0
executingStart=-6812034 crashCount=0
totalRestartCount=0 restartCount=0 restartDelay=0
restartTime=-6816373 nextRestartTime=-6857714
* IntentBindRecord{4345a4d0}:
intent={act=android.accounts.IAccountsService
cmp=com.google.android.googleapps/.GoogleLoginService}
binder=android.os.binderpr...@4345adc8
requested=true received=true hasBound=false doRebind=false
* IntentBindRecord{43430848}:
intent={cmp=com.google.android.googleapps/.GoogleLoginService}
binder=android.os.binderpr...@43438fa0
requested=true received=true hasBound=true doRebind=false
* Client AppBindRecord{43430918 ProcessRecord{4337a268
149:com.google.process.gapps/10015}}
Per-process Connections:
ConnectionRecord{43398190
com.google.android.googleapps/.GoogleLoginService:@433a3768}
ConnectionRecord{433b9908
com.google.android.googleapps/.GoogleLoginService:@433b9878}
ConnectionRecord{433e7338
com.google.android.googleapps/.GoogleLoginService:@433e2100}
All Connections:
ConnectionRecord{433e7338
com.google.android.googleapps/.GoogleLoginService:@433e2100}
ConnectionRecord{433b9908
com.google.android.googleapps/.GoogleLoginService:@433b9878}
ConnectionRecord{43398190
com.google.android.googleapps/.GoogleLoginService:@433a3768}
* ServiceRecord{43340138
com.google.android.server.checkin/.CheckinService}
intent={cmp=com.google.android.server.checkin/.CheckinService}
packageName=com.google.android.server.checkin
processName=system
baseDir=/system/app/GoogleCheckin.apk/system/app/GoogleCheckin.apk
dataDir=/data/data/com.google.android.server.checkin
app=ProcessRecord{433869d8 75:system/1000}
isForeground=false lastActivity=-6827000
startRequested=true startId=1 executeNesting=0
executingStart=-6826997 crashCount=0
totalRestartCount=0 restartCount=0 restartDelay=0
restartTime=-6827000 nextRestartTime=-6857736
* ServiceRecord{4346d038 com.google.android.apps.gtalkservice/
com.google.android.gtalkservice.service.GTalkService}
intent={cmp=com.google.android.apps.gtalkservice/
com.google.android.gtalkservice.service.GTalkService}
packageName=com.google.android.apps.gtalkservice
processName=com.google.process.gapps
permission=com.google.android.gtalkservice.permission.GTALK_SERVICE
baseDir=/system/app/gtalkservice.apk/system/app/gtalkservice.apk
dataDir=/data/data/com.google.android.apps.gtalkservice
app=ProcessRecord{4337a268 149:com.google.process.gapps/10015}
isForeground=false lastActivity=-6811451
startRequested=true startId=1 executeNesting=0
executingStart=-6811446 crashCount=0
totalRestartCount=0 restartCount=0 restartDelay=0
restartTime=-6811451 nextRestartTime=-6857744
* ServiceRecord{433c6970 com.android.phone/.BluetoothHeadsetService}
intent={cmp=com.android.phone/.BluetoothHeadsetService}
packageName=com.android.phone
processName=com.android.phone
baseDir=/system/app/Phone.apk/system/app/Phone.apk dataDir=/data/
data/com.android.phone
app=ProcessRecord{4335dba0 118:com.android.phone/1001}
isForeground=false lastActivity=-6822206
startRequested=true startId=1 executeNesting=0
executingStart=-6006342 crashCount=0
totalRestartCount=0 restartCount=0 restartDelay=0
restartTime=-6822206 nextRestartTime=-6857753
* IntentBindRecord{43465dc8}:
intent={act=android.bluetooth.IBluetoothHeadset}
binder=android.os.binderpr...@434660d8
requested=true received=true hasBound=false doRebind=false
* Client AppBindRecord{434f1f50 ProcessRecord{4335dba0
118:com.android.phone/1001}}
Per-process Connections:
ConnectionRecord{434f2020
com.android.phone/.BluetoothHeadsetService:@434f1dd0}
All Connections:
ConnectionRecord{434f2020
com.android.phone/.BluetoothHeadsetService:@434f1dd0}
* ServiceRecord{4323e190 com.android.inputmethod.latin/.LatinIME}
intent={act=android.view.InputMethod
cmp=com.android.inputmethod.latin/.LatinIME}
packageName=com.android.inputmethod.latin
processName=com.android.inputmethod.latin
permission=android.permission.BIND_INPUT_METHOD
baseDir=/system/app/LatinIME.apk/system/app/LatinIME.apk dataDir=/
data/data/com.android.inputmethod.latin
app=ProcessRecord{4342f8f8 285:com.android.inputmethod.latin/
10006}
isForeground=false lastActivity=-6737471
startRequested=false startId=0 executeNesting=0
executingStart=-6737464 crashCount=0
totalRestartCount=0 restartCount=0 restartDelay=0
restartTime=-6737471 nextRestartTime=-6857768
* IntentBindRecord{433f1c80}:
intent={act=android.view.InputMethod
cmp=com.android.inputmethod.latin/.LatinIME}
binder=android.os.binderpr...@43385cd8
requested=true received=true hasBound=true doRebind=false
* Client AppBindRecord{4329e058 ProcessRecord{433869d8 75:system/
1000}}
Per-process Connections:
ConnectionRecord{43294410
com.android.inputmethod.latin/.LatinIME:@43338040}
All Connections:
ConnectionRecord{43294410
com.android.inputmethod.latin/.LatinIME:@43338040}
Connection bindings to services:
* ConnectionRecord{434f2020
com.android.phone/.BluetoothHeadsetService:@434f1dd0}
binding=AppBindRecord{434f1f50
com.android.phone/.BluetoothHeadsetService:com.android.phone}
activity=HistoryRecord{43408018 com.android.phone/.InCallScreen}
conn=android.os.binderpr...@434f1dd0 flags=0x0
* ConnectionRecord{43294410
com.android.inputmethod.latin/.LatinIME:@43338040}
binding=AppBindRecord{4329e058
com.android.inputmethod.latin/.LatinIME:system}
conn=android.app.ActivityThread$PackageInfo$ServiceDispatcher
$innerconnect...@43338040 flags=0x1
* ConnectionRecord{433e7338
com.google.android.googleapps/.GoogleLoginService:@433e2100}
binding=AppBindRecord{43430918
com.google.android.googleapps/.GoogleLoginService:com.google.process.gapps}
conn=android.os.binderpr...@433e2100 flags=0x1
* ConnectionRecord{433b9908
com.google.android.googleapps/.GoogleLoginService:@433b9878}
binding=AppBindRecord{43430918
com.google.android.googleapps/.GoogleLoginService:com.google.process.gapps}
conn=android.os.binderpr...@433b9878 flags=0x1
* ConnectionRecord{43398190
com.google.android.googleapps/.GoogleLoginService:@433a3768}
binding=AppBindRecord{43430918
com.google.android.googleapps/.GoogleLoginService:com.google.process.gapps}
conn=android.os.binderpr...@433a3768 flags=0x1
If we run the same command 2 hours later it returns for our service:
DUMP OF SERVICE activity.services:
Services in Current Activity Manager State:
Active services:
* ServiceRecord{43563d78 xx.worldwidyyetime/.widget.RefreshService}
intent={cmp=xx.yy/.widget.RefreshService}
packageName=xx.yy
processName=xx.yy
baseDir=/data/app/xx.yy.apk/data/app/xx.yy.apk dataDir=/data/data/
xx.yy
app=ProcessRecord{4348d8f8 1349:xx.yy/10031}
isForeground=false lastActivity=-5474190
startRequested=true startId=1 executeNesting=0
executingStart=-5474190 crashCount=0
totalRestartCount=1 restartCount=1 restartDelay=5000
restartTime=-5474190 nextRestartTime=-5474352
What could be the problem ?
Thanks for you help.
On Dec 31 2009, 11:25 am, Derek <[email protected]> wrote:
> I can confirm that the problem does not come from TasKiller. I've
> uninstalled it and the problem is still here.
> I'm not able to reproduce it on emulator and it happens on real device
> no more than once a week so it's really difficult to reproduce.
>
> Any hint is welcome.
>
> Cheers.
>
> On Nov 27, 7:50 pm, Dianne Hackborn <[email protected]> wrote:
>
> > Fyi, you can use "adb shell dumpsys activity.services" to see the state of
> > all active services, including those that are started but not currently
> > running and waiting for a restart.
>
> > On Fri, Nov 27, 2009 at 10:44 AM, Derek <[email protected]> wrote:
> > > Hi Nicolas,
>
> > > Thanks for the feedback. I've double checked the logs and I don't see
> > > anything about TasKiller when the process has died.
> > > In the meantime I've read the following thread about developers
> > > complaining about Task killers applications (not yours especially).
>
> > >http://groups.google.com/group/android-developers/browse_thread/threa...
> > > (Our users complain that widget updates stop too)
>
> > > So, I've uninstalled TaskKiller, run GoogleMaps to generate a process
> > > kill from Android. Here are the logs just after GoogleMaps starting:
> > > [...]
> > > 11-27 19:25:47.494: INFO/ActivityManager(74): Process abc (pid 3509)
> > > has died.
> > > [...]
> > > 11-27 19:26:00.044: INFO/ActivityManager(74): Start proc abc for
> > > service abc/.xyz.RefreshService: pid=3603 uid=10033 gids={3003, 1015}
> > > [...]
> > > 11-27 19:26:00.424: INFO/abc.xyz.RefreshService(3603): RefreshService
> > > started (abc.xyz.refreshserv...@431f1d38)
> > > [...]
> > > It seems to work now. The only difference is that the following trace
> > > does not appear:
> > > "Scheduling restart of crashed service abc/.xyz.RefreshService in
> > > 5000ms".
>
> > > Could it be a bug in your application ? or in the Android API you're
> > > using to monitor running processes ?
> > > It may prevent a service from restart. Is there any test I can do to
> > > make sure ?
>
> > > Thanks again.
>
> > > On Nov 27, 7:25 pm, Nicolas Thibaut <[email protected]> wrote:
> > > > Hi, Taskiller use ActivityManager to "kill" process (there is no kill
> > > > but uninstall process).
>
> > > > If I kill taskiller itselfs, the log are:
>
> > > > 11-27 19:16:58.952 I/ActivityManager( 75): Displayed activity
> > > > com.tni.TasKiller/.TasKiller: 2023 ms (total 2023 ms)
> > > > 11-27 19:16:59.032 I/ActivityManager( 75): Process
> > > > com.android.settings (pid 4361) has died.
> > > > 11-27 19:17:05.212 D/dalvikvm( 2816): GC freed 2448 objects / 115688
> > > > bytes in 175ms
> > > > 11-27 19:17:12.842 D/ActivityManager( 75): Uninstalling process
> > > > com.tni.TasKiller
> > > > 11-27 19:17:12.842 D/ActivityManager( 75): Force removing process
> > > > ProcessRecord{43678608 4341:com.tni.TasKiller/10030}
> > > > (com.tni.TasKiller/10030)
>
> > > > If your service die without this log, Taskiller is not guilty !
> > > > And if your service is killed by taskiller : the user HOPE it will
> > > > NEVER restart.
>
> > > > On Nov 27, 7:01 pm, Derek <[email protected]> wrote:
>
> > > > > Hi Diane,
>
> > > > > We've have exactly the same problem. We have TasKiller v2.2 installed
> > > > > but we DO NOT use it to kill our app.
> > > > > However, our service (running every one minute thanks to AlarmManager)
> > > > > never restarts after process has died.
> > > > > Here are the log extracted today on my HTC device under 1.6:
> > > > > [...]
> > > > > 11-27 18:14:00.463: INFO/abc.RefreshService(1482): Alarm planned in
> > > > > 60000 milliseconds at 1259342100000 (abc.refreshserv...@431e8178 -
> > > > > PendingIntent{431f71f8: android.os.binderpr...@431f71b0})
> > > > > 11-27 18:14:00.463: INFO/abc.RefreshService(1482): RefreshService
> > > > > stopping (abc.refreshserv...@431e8178)
> > > > > 11-27 18:14:00.463: INFO/ActivityManager(74): Stopping service:
> > > > > abc/.xyz.RefreshService
> > > > > [...]
> > > > > 11-27 18:15:07.629: INFO/ActivityManager(74): Process abc (pid 1482)
> > > > > has died.
> > > > > 11-27 18:15:07.679: WARN/ActivityManager(74): Scheduling restart of
> > > > > crashed service abc/.xyz.RefreshService in 5000ms
> > > > > [...]
> > > > > 11-27 18:19:26.131: INFO/ActivityManager(74): Start proc abc for
> > > > > service abc/.xyz.RefreshService: pid=1536 uid=10033 gids={3003, 1015}
> > > > > 11-27 18:19:26.241: INFO/dalvikvm(1536): Debugger thread not active,
> > > > > ignoring DDM send (t=0x41504e4d l=38)
> > > > > [...]
>
> > > > > Do you mean that the problem could come from TaskKiller application ?
> > > > > Once problem has occurred I still can see our app in TasKiller as
> > > > > Italic/grayed (which means that a service is running in background) or
> > > > > yellow.
>
> > > > > Thanks.
>
> > > > > On Nov 22, 8:53 pm, Dianne Hackborn <[email protected]> wrote:
>
> > > > > > That's what the task killers do. Don't use them if you don't want
> > > this to
> > > > > > happen. You can't get around this. The API they are using is
> > > intended for
> > > > > > the user to explicitly stop everything about an app.
>
> > > > > > On Sat, Nov 21, 2009 at 6:53 PM, shahzad ahmad <
> > > [email protected]>wrote:
>
> > > > > > > Hi,
> > > > > > > I'm just investing how crashed services are restarted. I've
> > > developed a
> > > > > > > simple service and use a taskkiller from market place to kill the
> > > > > > > application. Following are the logs after application is killed
>
> > > > > > > "Uninstalling the process test.sys"
> > > > > > > "Force removing process ProcessRecord{432d6ad0 252:test.sys/10041}
> > > > > > > (test.sys/10041)"
> > > > > > > "Scheduling restart of crashed service test.sys/.testservice in
> > > 5000ms"
> > > > > > > "Sending signal. PID: 252 SIG: 9"
>
> > > > > > > But the service is never started. Can anybody tell why service is
> > > not
> > > > > > > starting? Do i need to put any flag in manifest file for service
> > > restart to
> > > > > > > work?
>
> > > > > > > Regards,
> > > > > > > shaz
>
> > > > > > > --
> > > > > > > You received this message because you are subscribed to the Google
> > > > > > > Groups "Android Developers" group.
> > > > > > > To post to this group, send email to
> > > [email protected]
> > > > > > > To unsubscribe from this group, send email to
> > > > > > > [email protected]<android-developers%[email protected]>
> > > <android-developers%[email protected]<android-developers%[email protected]>
>
> > > > > > > For more options, visit this group at
> > > > > > >http://groups.google.com/group/android-developers?hl=en
>
> > > > > > --
> > > > > > Dianne Hackborn
> > > > > > Android framework engineer
> > > > > > [email protected]
>
> > > > > > Note: please don't send private questions to me, as I don't have
> > > > > > time
> > > to
> > > > > > provide private support, and so won't reply to such e-mails. All
> > > such
> > > > > > questions should be posted on public forums, where I and others can
> > > see and
> > > > > > answer them.
>
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Developers" group.
> > > To post to this group, send email to [email protected]
> > > To unsubscribe from this group, send email to
> > > [email protected]<android-developers%[email protected]>
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en
>
> > --
> > Dianne Hackborn
> > Android framework engineer
> > [email protected]
>
> > Note: please don't send private questions to me, as I don't have time to
> > provide private support, and so won't reply to such e-mails. All such
> > questions should be posted on public forums, where I and others can see and
> > answer them.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en