Page 1 of 1

Automatic Exception

Posted: 13 Apr 2019 08:30
by Wibbly
I occasionally see crashes with the following report. Are these symptomatic of anything in my flows or is it a genuine bug?


Version: 1.37.0
Build: P-20190311_155223_d52fd62
Package: package ch.gridvision.ppam.androidautomagic, Unknown, version 0.0

Brand: google
Device: walleye
Model: Pixel 2
Id: PQ2A.190405.003
Product: walleye

SDK: 28
Release: 9
Incremental: 5310204

Timestamp: 12.04.2019 20:55:11.320

java.lang.IllegalStateException: Too many receivers, total of 1000, registered for pid: 3039, callerPackage: ch.gridvision.ppam.androidautomagic
at android.os.Parcel.createException(Parcel.java:1958)
at android.os.Parcel.readException(Parcel.java:1918)
at android.os.Parcel.readException(Parcel.java:1868)
at android.app.IActivityManager$Stub$Proxy.registerReceiver(IActivityManager.java:3827)
at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1488)
at android.app.ContextImpl.registerReceiver(ContextImpl.java:1449)
at android.app.ContextImpl.registerReceiver(ContextImpl.java:1437)
at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:623)
at ch.gridvision.ppam.androidautomagic.model.a.gn.a(SourceFile:212)
at ch.gridvision.ppam.androidautomagic.model.flow.e.a(SourceFile:1044)
at ch.gridvision.ppam.androidautomagic.model.flow.e.b(SourceFile:1399)
at ch.gridvision.ppam.androidautomagic.model.flow.e.a(SourceFile:66)
at ch.gridvision.ppam.androidautomagic.model.flow.e$8.run(SourceFile:1207)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6718)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: android.os.RemoteException: Remote stack trace:
at com.android.server.am.ActivityManagerService.registerReceiver(ActivityManagerService.java:20978)
at android.app.IActivityManager$Stub.onTransact$registerReceiver$(IActivityManager.java:10118)
at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:154)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3297)
at android.os.Binder.execTransact(Binder.java:731)

Re: Automatic Exception

Posted: 13 Apr 2019 17:36
by Desmanto
Seems to be something with your flows. I have never got this problem, although I have more than 200 flows now, 80 enabled.

Try to look for flow with something related to receiver that can be triggered so frequently (although almost all trigger has receiver), such as Trigger HTTP request, file observer, sensor based trigger, general broadcast or anything similar.

Re: Automatic Exception

Posted: 13 Apr 2019 19:29
by Wibbly
But what's the problem with the bad flow? Is this to do with the emergency stop? A flow that runs too many times in parallel? Something else? I don't know what I'm looking for...

Re: Automatic Exception

Posted: 14 Apr 2019 12:06
by Desmanto
Too many flow execution in parallel should give automagic emergency stop. This seems to be related to be some triggers registered too many receivers on the system. It can be checked using adb in PC

Code: Select all

adb shell dumpsys activity broadcasts
However, it is very difficult to see what have gone wrong.

Since this is intermittent error, it is very difficult to trace back the problem. Look at all your flows, and start to disable one by one. Use the phone for a while and see if it gives the error. If not, the last flow you disabled is most likely the culprit. However this might render some of your automation broken (because the flow is disabled).

Re: Automatic Exception

Posted: 14 Apr 2019 13:32
by Wibbly
Thanks. Maybe @martin can provide some further insight.

Re: Automatic Exception

Posted: 15 Apr 2019 15:17
by Martin
The exception indicates that Automagic registers a broadcast receiver somewhere that is not unregistered as it should.
Are you using a flow that uses action Sleep that is interrupted often (e.g. with an action Stop Flows)?

Regards,
Martin

Re: Automatic Exception

Posted: 15 Apr 2019 15:29
by Wibbly
I have slows like that yes, will need to check how often they run. Is this cumulative (from boot) of do the broadcast recieivers 'expire'? What's the best strategy to locate and avoid this limit in my flows? I'm not familiar with broadcast receivers. Also when you say 'not unregistered as they should' is this an Automatic bug?

Re: Automatic Exception

Posted: 15 Apr 2019 15:36
by Martin
The problem is cumulative (from boot). Luckily I found the problem with your error mail and it should be fixed in the next EAP build of v1.38.

Regards,
Martin

Re: Automatic Exception

Posted: 15 Apr 2019 16:39
by Wibbly
Many thanks Martin, glad I could lead you to a bug you can squash :-)