qualaroo / android-sdk

Android SDK for Qualaroo
https://qualaroo.com
BSD 3-Clause "New" or "Revised" License
3 stars 2 forks source link

IllegalAccessError (in org.apache.commons) when trying to use custom property in survey targeting #16

Closed jonikarppinen closed 4 years ago

jonikarppinen commented 4 years ago

We have implemented a system to target a percentage of daily users, via setting a custom property.

Now, as soon as I configured a live survey to make use of that property, we started getting massive amounts of production crashes (affecting 1000+ users in less than half an hour) caused by Qualaroo SDK. This is the first time we are seeing these crashes, which leads me to believe the crash is probably related to Qualaroo SDK trying to read/use custom properties.

Stack trace from Crashlytics:

Fatal Exception: java.lang.IllegalAccessError: Field 'org.apache.commons.jexl3.c$e1.d' is inaccessible to class 'org.apache.commons.jexl3.c.cc' (declaration of 'org.apache.commons.jexl3.c.cc' appears in base.apk)
       at org.apache.commons.jexl3.c.cc.a(:93)
       at org.apache.commons.jexl3.b.h.a(:71)
       at org.apache.commons.jexl3.b.h.b(:12)
       at org.apache.commons.jexl3.b.h.a()
       at org.apache.commons.jexl3.d.a(:1)
       at com.qualaroo.internal.s.a(:15)
       at com.qualaroo.internal.s.a(:12)
       at com.qualaroo.internal.k.a(:19)
       at com.qualaroo.Qualaroo.b()
       at com.qualaroo.Qualaroo.a()
       at com.qualaroo.Qualaroo.a()
       at com.qualaroo.Qualaroo$a.run(:51)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
       at java.lang.Thread.run(Thread.java:764)

Our app is setting daily_percentile to a value between "0.0" and "100.0" using Qualaroo.getInstance().setUserProperty. But it looks like this crash is also happening in earlier app versions that don't set the property, so it's not related to the actual values we set.

[If you have some sort of corporate support, I'll also try to reach you via that...]

durgeshqualaroo commented 4 years ago

@jonikarppinen We sincerely sorry for the inconvenience. Please connect with us at mobile@qualaroo.com. We need a few information regrading the Qualaroo account to troubleshoot further. Promising you to act vary fast on it.

durgeshqualaroo commented 4 years ago

We sincerely sorry for the inconvenience. We had an infrastructural issue within our REST API server that we have handled completely. Please connect with us at mobile@qualaroo.com if you're still experiencing the same problem.

jonikarppinen commented 4 years ago

issue within our REST API server that we have handled completely

If you did some server side fix, I must point out that it did not help with this crash. Yesterday I tried enabling custom property based targeting for a Qualaroo survey, again, and immediately we started seeing hundreds of crashes within minutes. (I only enabled it for a small percentage; otherwise that would have been thousands of crashes.) So no change there.

I also got email from your customer support (after 4 months), and we're now updating qualaroo-sdk to 2.0.0 to see if that helps with this issue.

jonikarppinen commented 3 years ago

qualaroo-sdk 2.0.0 still has this bug. (This should be reopened, or do you want me to file a new issue?)

But now I know more about this issue! The root cause is setting a decimal number as user property value, and then calling showSurvey on a survey that uses the custom property as a numeric value in an expression such as daily_percentile < 2. I wasn't aware that Qualaroo allows using only integer numbers here!

Here's a complete stack trace, with NumberFormatException being the root cause (not the IllegalAccessError):

2020-12-15 11:31:41.575/fi.app W/CustomExceptionHandler: java.lang.NumberFormatException: For input string: "3.1"
        at java.lang.Long.parseLong(Long.java:594)
        at java.lang.Long.parseLong(Long.java:636)
        at org.apache.commons.jexl3.a.j(Unknown Source:56)
        at org.apache.commons.jexl3.a.a(Unknown Source:114)
        at org.apache.commons.jexl3.a.n(Unknown Source:10)
        at org.apache.commons.jexl3.b.j.a(Unknown Source:40)
        at org.apache.commons.jexl3.c.ak.a(Unknown Source:0)
        at org.apache.commons.jexl3.b.j.a(Unknown Source:31)
        at org.apache.commons.jexl3.c.ah.a(Unknown Source:0)
        at org.apache.commons.jexl3.b.j.a(Unknown Source:25)
        at org.apache.commons.jexl3.b.p.b(Unknown Source:14)
        at org.apache.commons.jexl3.b.p.a(Unknown Source:0)
        at com.qualaroo.internal.r.a(Unknown Source:81)
        at com.qualaroo.internal.r.a(Unknown Source:12)
        at com.qualaroo.internal.j.a(Unknown Source:19)
        at com.qualaroo.Qualaroo.b(Unknown Source:0)
        at com.qualaroo.Qualaroo.a(Unknown Source:0)
        at com.qualaroo.Qualaroo.a(Unknown Source:0)
        at com.qualaroo.Qualaroo$1.run(Unknown Source:51)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:923)

Sometimes Qualaroo throws NumberFormatException, sometimes it fails silently in the same situation. NB: in our app code, a simple try-catch around showSurvey does not help, as it launches a background worker. The error handling needs to be improved inside Qualaroo SDK, and it should be simple to add a try-catch around the relevant place.

Of course the fix to the root problem in our app code was simple: switch to using integer numbers as the "daily percentile". Unfortunately, it seems that old decimal user property values are cached/lingering somewhere inside Qualaroo SDK, as we are seeing crashes even in new app versions. In every case, the SDK should never crash the host application because of an NFE.

We had an infrastructural issue within our REST API server that we have handled completely. Please connect with us at mobile@qualaroo.com if you're still experiencing the same problem.

@durgeshqualaroo: I think this is something you have to fix inside the Android Qualaroo SDK, not server side. I will also contact you by email.