mirror of
https://github.com/binwiederhier/ntfy.git
synced 2026-05-10 00:08:52 +02:00
[GH-ISSUE #474] Android: notifications with large images attached crash the app #363
Labels
No labels
ai-generated
android-app
android-app
android-app
🪲 bug
build
build
dependencies
docs
enhancement
enhancement
🔥 HOT
in-progress 🏃
ios
prio:low
prio:low
pull-request
question
🔒 security
server
server
unified-push
web-app
website
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ntfy#363
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @daedric7 on GitHub (Nov 8, 2022).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/474
Hello
I've noticed this for a while but has it's only trigger by very large images, it's difficult to find a case.
A notification sent via curl with a very large image attached to a topic makes the app crash when opening that topic.
All other topics keep working, the app keeps receiving more notifications on that topic although unable to display them.
The last image to cause this was this: (WARNING: NSFW!)
https://i.imgur.com/pKiQk6l.jpg , 4.4mb 4480x6720
Android creates a log report and sends it somewhere, but i cannot intercept it.
The only error i found was:
java.lang.RuntimeException: Canvas: trying to draw too large(120422400bytes) bitmap.@binwiederhier commented on GitHub (Nov 8, 2022):
I have experienced crashes with large photos as well, so I can confirm this happens. I think this should be one of the next Android tickets to be worked on. The app should never crash.
(Side note: You could have linked any other large photo ... Like, one from NASA or Wikipedia...)
@binwiederhier commented on GitHub (Nov 19, 2022):
This is a little trickier than expected, because I cannot catch a
RuntimeException, and whether the exception is raised depends on your system and your available RAM. Figuring out whether an image is too large is non-trivial, because a JPG of 4480x6720 (as you posted) expends to 120 MB in memory. I could limit previews to 1 MB JPG files, or to certain dimensions, but it's not a sure thing.The only way to solve this would be to bring in a library that intelligently does the image loading in a memory efficient way. And I' not sure I want to bring in a library just for that.
(I am working on this though, and will hopefully have a solution soon)
@daedric7 commented on GitHub (Nov 19, 2022):
Perhaps the server, upon receiving a image could create a thumbnail. The whole file and the thumbnail could be passed to the Android app, but only the thumb would be previewed.
In anycase, i find this issue peculiar. The tested smartphone is not weak on memory, 8GB.
@binwiederhier commented on GitHub (Nov 27, 2022):
This is the corresponding stack trace I got from the Google Play console for this issue; and from reproducing it locally:
@binwiederhier commented on GitHub (Nov 27, 2022):
I managed to monkey patch this using this fix:
github.com/binwiederhier/ntfy-android@d09fdb2ff2- The workaround is from here: https://stackoverflow.com/a/53334563/1440785It works by checking if the loaded image is > 100 MB in memory and exits out gracefully if it does. The image is not rendered in that case. I could have gone for a "resize and display" option, but I think this is sufficient for now.
Will be in the next Android release.