SUT agent: java.lang.NullPointerException in DoCommand.GetProcessInfo

RESOLVED FIXED in mozilla14

Status

defect
RESOLVED FIXED
7 years ago
7 years ago

People

(Reporter: gbrown, Assigned: gbrown)

Tracking

unspecified
mozilla14
x86
macOS
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite -

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

SUT agent crashed during a Robocop test - see the log at https://bugzilla.mozilla.org/show_bug.cgi?id=734715#c46:

04-16 12:05:55.779 E/AndroidRuntime( 1453): FATAL EXCEPTION: CmdWorkerThread
04-16 12:05:55.779 E/AndroidRuntime( 1453): java.lang.NullPointerException
04-16 12:05:55.779 E/AndroidRuntime( 1453): 	at com.mozilla.SUTAgentAndroid.service.DoCommand.GetProcessInfo(DoCommand.java:2527)
04-16 12:05:55.779 E/AndroidRuntime( 1453): 	at com.mozilla.SUTAgentAndroid.service.DoCommand.processCommand(DoCommand.java:332)
04-16 12:05:55.779 E/AndroidRuntime( 1453): 	at com.mozilla.SUTAgentAndroid.service.CmdWorkerThread.run(CmdWorkerThread.java:164)
04-16 12:05:55.789 E/AndroidRuntime( 1453): Error reporting crash
04-16 12:05:55.789 E/AndroidRuntime( 1453): android.os.DeadObjectException
04-16 12:05:55.789 E/AndroidRuntime( 1453): 	at android.os.BinderProxy.transact(Native Method)
04-16 12:05:55.789 E/AndroidRuntime( 1453): 	at android.app.ActivityManagerProxy.handleApplicationCrash(ActivityManagerNative.java:2514)
04-16 12:05:55.789 E/AndroidRuntime( 1453): 	at com.android.internal.os.RuntimeInit$UncaughtHandler.uncaughtException(RuntimeInit.java:76)
04-16 12:05:55.789 E/AndroidRuntime( 1453): 	at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:887)
04-16 12:05:55.789 E/AndroidRuntime( 1453): 	at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:884)
Blocks: 734715
Easy! ActivityManager.getRunningAppProcesses may return null:

http://developer.android.com/reference/android/app/ActivityManager.html#getRunningAppProcesses%28%29
I found several other places where the return value from getRunningAppProcesses was assumed non-null; I have tried to guard against the null case in every instance.
Attachment #615454 - Flags: review?(ctalbert)
Comment on attachment 615454 [details] [diff] [review]
avoid NullPointerException in sutagent and watcher when no running app processes

Nice catch.

Once we land this we may want to bump the version number (unless you have some more of these).  This way we can tell the difference between agents with these stability fixes and agents without them.
Attachment #615454 - Flags: review?(ctalbert) → review+
That's all the changes I have for now (but I will keep scanning logs for more stack traces!)
Keywords: checkin-needed
https://hg.mozilla.org/integration/mozilla-inbound/rev/8f52882518b6
Flags: in-testsuite-
Keywords: checkin-needed
Target Milestone: --- → mozilla14
https://hg.mozilla.org/mozilla-central/rev/8f52882518b6
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.