CleverTap / clevertap-android-sdk

CleverTap Android SDK
MIT License
80 stars 74 forks source link

Crash on InAppNotificationActivity when we try to set a large image #665

Closed bhanu-rapido closed 1 month ago

bhanu-rapido commented 2 months ago

Describe the bug App is crash with exception "Fatal Exception: java.lang.RuntimeException Canvas: trying to draw too large(105827460bytes) bitmap."

To Reproduce we are using clevertap android sdk version: 6.1.1

Expected behavior app shouldn't crash, due to this crash our app health degraded very badly, Note: marketing used to setup any banners from clevertap dashboard for inapp notification.

Screenshots/Logs

Environment (please complete the following information): attached a screenshot

Additional context

attached the stack trace here com.rapido.rider_issue_0ece7b0990753a4805cb2b2f577ff592_crash_session_66E2B6A80393000159CF506CA9DB4B76_DNE_0_v2_stacktrace.txt

Screenshot 2024-09-12 at 3 47 31 PM
CTLalit commented 2 months ago

@bhanu-rapido I checked the stack trace and it seems it is due to trying to loading a large asset. In stack trace i did not find any logs pertaining to clevertap sdk which might have lead to this crash. Can you provide more details on crash/data to show its rooting from clevertap.

bhanu-rapido commented 2 months ago

@CTLalit the firebase crashlytics shows the clevertap activity name. and after stopping the in-app notification, the crash count came to Zero.

do you have any compression logic on sdk side? or sdk directly render the what ever the image setup in dashboard?

Screenshot 2024-09-12 at 4 43 53 PM
CTLalit commented 2 months ago

Limits are enforced on dashboard and CMS, there is a possibility or media being provided as url (which can be possibly be a large image). We do not provide any compression and it is upon client to upload proper assets and compression might not provide best results and customisation, we do have recommended asset sizes. In the above crash log the asset size seems ~100MB

Please raise an issue to our support team for this via this link. We can discuss the campaign which caused the crash and look into it further.

bhanu-rapido commented 2 months ago

agree, but sdk should have basic checks, if client uploads 1GB image, sdk shouldn't try to download and render. and these inApp notifications used by different teams across our organisation, it prone to upload large images by them.

and the Clevertap sdk should not be the reason to block the user to open our app ( it impacted almost 100k users on prod with repeative crash ). or atleast a give a option to catch these types of exceptions from sdk.

CTLalit commented 2 months ago

@bhanu-rapido we do not allow uploading large assets from dashboard/other ui component. Maybe url with large image was used which caused the crash.

CleverTap SDK is not the reason to block app open, the guidelines for android image size are not followed which might be causing the crash. I would suggest you guys can do phased rollout and even provide that functionality as control group to start things.

We will check if anything can be done to prevent this and if any checks can be added on our side.

Please feel free to open a ticket from above link if you want to discuss further.

bhanu-rapido commented 1 month ago

@CTLalit this the image we set from url. image size is less than 2MB.

https://imgur.com/yJ4SlSF

CTLalit commented 1 month ago

@bhanu-rapido as per the stack trace posted by you : App is crash with exception "Fatal Exception: java.lang.RuntimeException Canvas: trying to draw too large(105827460bytes) bitmap." This is ~100MB image.

Also a 2MB image should not cause a crash ideally. Maybe you have pointed to wrong campaign and image. If 2MB image loading is causing the crash then you should consider memory footprint of your app and optimise it.

bhanu-rapido commented 1 month ago

No. Check the image dimensions

bhanu-rapido commented 1 month ago

Before closing the issue, first check in the sample app and then close

CTLalit commented 1 month ago

@bhanu-rapido i copied from the stack trace which you have provided in comment. You can raise a support ticket further if you want to share campaign from your account which is causing the issue as i mentioned and hence the issue is closed.