Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArrayOutOfBoundsException when using Field.getName #241

Closed
kaeawc opened this issue Jul 26, 2015 · 5 comments · Fixed by #653
Closed

ArrayOutOfBoundsException when using Field.getName #241

kaeawc opened this issue Jul 26, 2015 · 5 comments · Fixed by #653
Labels

Comments

@kaeawc
Copy link

kaeawc commented Jul 26, 2015

During initialization the SDK users some reflection here

I've observed a couple occurrences where this can result in an ArrayOutOfBoundsException. I have very little insight or understanding of the internals of Art, but it seems like it could be safe to catch that exception as well.

Here's the stacktrace from an app using Mixpanel SDK 4.6.1

java.lang.RuntimeException: Unable to create application <redacted>: java.lang.ArrayIndexOutOfBoundsException: length=15; index=56585
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4720)
at android.app.ActivityThread.access$1600(ActivityThread.java:163)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1419)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5536)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1397)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1192)
Caused by: java.lang.ArrayIndexOutOfBoundsException: length=15; index=56585
at java.lang.reflect.ArtField.getNameNative(Native Method)
at java.lang.reflect.ArtField.getName(ArtField.java:91)
at java.lang.reflect.Field.getName(Field.java:122)
at com.mixpanel.android.mpmetrics.ResourceReader.readClassIds(ResourceReader.java:89)
at com.mixpanel.android.mpmetrics.ResourceReader.initialize(ResourceReader.java:120)
at com.mixpanel.android.mpmetrics.ResourceReader$Ids.<init>(ResourceReader.java:23)
at com.mixpanel.android.viewcrawler.ViewCrawler$ViewCrawlerHandler.<init>(ViewCrawler.java:283)
at com.mixpanel.android.viewcrawler.ViewCrawler.<init>(ViewCrawler.java:78)
at com.mixpanel.android.mpmetrics.MixpanelAPI.constructUpdatesFromMixpanel(MixpanelAPI.java:1330)
at com.mixpanel.android.mpmetrics.MixpanelAPI.<init>(MixpanelAPI.java:218)
at com.mixpanel.android.mpmetrics.MixpanelAPI.getInstance(MixpanelAPI.java:288)
@yinfeiru yinfeiru added the bug label Jan 26, 2016
@sandy-8925
Copy link

sandy-8925 commented Jul 20, 2016

Some of our users also face the same issue, with the same stacktrace as above (Mixpanel version 4.5.3)

java.lang.ArrayIndexOutOfBoundsException: length=0; index=67894
1   at java.lang.reflect.ArtField.getNameNative(Native Method)
2   at java.lang.reflect.ArtField.getName(ArtField.java:91)
3   at java.lang.reflect.Field.getName(Field.java:122)
4   at com.mixpanel.android.mpmetrics.ResourceReader.readClassIds(ResourceReader.java:85)
5   at com.mixpanel.android.mpmetrics.ResourceReader.initialize(ResourceReader.java:116)
6   at com.mixpanel.android.mpmetrics.ResourceReader$Ids.&lt;init&gt;(ResourceReader.java:19)
7   at com.mixpanel.android.viewcrawler.ViewCrawler.&lt;init&gt;(ViewCrawler.java:66)
8   at com.mixpanel.android.mpmetrics.MixpanelAPI.constructUpdatesFromMixpanel(MixpanelAPI.java:1094)
9   at com.mixpanel.android.mpmetrics.MixpanelAPI.&lt;init&gt;(MixpanelAPI.java:147)
10  at com.mixpanel.android.mpmetrics.MixpanelAPI.getInstance(MixpanelAPI.java:211)

@fcduarte
Copy link

fcduarte commented Nov 3, 2016

Here's another one, from 4.6.4:

java.lang.RuntimeException: Unable to start receiver com.a.b.c.d.e: java.lang.ArrayIndexOutOfBoundsException: length=14; index=31289
        at android.app.ActivityThread.handleReceiver(ActivityThread.java:3487)
        at android.app.ActivityThread.access$1900(ActivityThread.java:198)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1753)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:145)
        at android.app.ActivityThread.main(ActivityThread.java:6838)
        at java.lang.reflect.Method.invoke(Method.java:-2)
        at java.lang.reflect.Method.invoke(Method.java:372)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
Caused by: java.lang.ArrayIndexOutOfBoundsException: length=14; index=31289
        at java.lang.reflect.ArtField.getNameNative(ArtField.java:-2)
        at java.lang.reflect.ArtField.getName(ArtField.java:91)
        at java.lang.reflect.Field.getName(Field.java:122)
        at com.mixpanel.android.mpmetrics.ResourceReader.readClassIds(SourceFile:89)
        at com.mixpanel.android.mpmetrics.ResourceReader.initialize(SourceFile:120)
        at com.mixpanel.android.mpmetrics.ResourceReader$Ids.<init>(SourceFile:23)
        at com.mixpanel.android.viewcrawler.ViewCrawler$ViewCrawlerHandler.<init>(SourceFile:264)
        at com.mixpanel.android.viewcrawler.ViewCrawler.<init>(SourceFile:74)
        at com.mixpanel.android.mpmetrics.MixpanelAPI.constructUpdatesFromMixpanel(SourceFile:1331)
        at com.mixpanel.android.mpmetrics.MixpanelAPI.<init>(SourceFile:219)
        at com.mixpanel.android.mpmetrics.MixpanelAPI.getInstance(SourceFile:289)

If it's worth to mention it happened on a 5.1.1 device, Samsung SM-G360T

The bug has been here for a year, any plans to fix it?

@Smbat888
Copy link

hi all,

any plans to fix this? this bug even hasn't assigned to someone!
can you please fix this? there are many issues that our users always faced!

@patedit
Copy link
Contributor

patedit commented Nov 21, 2019

Hi folks, this is a system crash and not caused by the library, so we can't recover from it. I've added a try/catch so the app doesn't crash in the future

@patedit patedit closed this as completed Nov 21, 2019
@patedit
Copy link
Contributor

patedit commented Nov 23, 2019

Available on v5.6.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants