Closed MV-GH closed 10 months ago
Thanks for sharing the images! Can you also post the full stacktrace?
There is no full stack trace, logcat only contained that one line
Geez that isn't helpful from Android. What device and android version are you using?
I had this happen in a stock google emulator that was either api level 26 or 33 and I had also reproduced this on my phone which is Android 11,
I made a minimum repro for this error
https://github.com/saket/telephoto/assets/67873169/df5b2d41-f27f-416f-a373-520f5d4bb4d4
I suspect it is memory issue
A reproducer is fantastic. I'll take a look soon, thanks!
I had this happen in a stock google emulator that was either api level 26 or 33 and I had also reproduced this on my phone which is Android 11,
Can you also share all the properties of your emulator? You can do this by going into Device Manager, clicking its overflow menu and selecting View details
. The details pane will have an option to Copy properties to clipboard
.
I managed to reproduce it with this
Properties
avd.ini.displayname Pixel 7 API 32
avd.ini.encoding UTF-8
AvdId Pixel_7_API_32
disk.dataPartition.size 6442450944
fastboot.chosenSnapshotFile
fastboot.forceChosenSnapshotBoot no
fastboot.forceColdBoot no
fastboot.forceFastBoot yes
hw.accelerometer yes
hw.arc false
hw.audioInput yes
hw.battery yes
hw.camera.back virtualscene
hw.camera.front emulated
hw.cpu.ncore 4
hw.device.hash2 MD5:3db3250dab5d0d93b29353040181c7e9
hw.device.manufacturer Google
hw.device.name pixel_7
hw.dPad no
hw.gps yes
hw.gpu.enabled yes
hw.gpu.mode auto
hw.initialOrientation Portrait
hw.keyboard yes
hw.lcd.density 420
hw.lcd.height 2400
hw.lcd.width 1080
hw.mainKeys no
hw.ramSize 2048
hw.sdCard yes
hw.sensors.orientation yes
hw.sensors.proximity yes
hw.trackBall no
image.androidVersion.api 32
image.sysdir.1 system-images\android-32\google_apis_playstore\x86_64\
PlayStore.enabled true
runtime.network.latency none
runtime.network.speed full
showDeviceFrame yes
skin.dynamic yes
tag.display Google Play
tag.id google_apis_playstore
vm.heapSize 228
But I don't think it is Android version specific.
On emulators I also get the following if relevant (after the crash)
ANR in com.example.reprochannelcrash (com.example.reprochannelcrash/.MainActivity) PID: 3856 Reason: Input dispatching timed out (f5f433f com.example.reprochannelcrash/com.example.reprochannelcrash.MainActivity (server) is not responding. Waited 5026ms for MotionEvent) Parent: com.example.reprochannelcrash/.MainActivity Frozen: false Load: 24.44 / 9.29 / 3.39
Oh yea this is very helpful. Its basically saying that the app is freezing. I think I need to improve the performance for large images.
@MV-GH Can you try out 0.6.0-SNAPSHOT
to see if the performance improves for you?
I can still reproduce this with the Reproducer app but now it no longer prints anything in logcat regarding the crash.
On actual device
on Emulator above
Edit:
Did manage to get the error message now:
channel '1b9baa6 com.example.reprochannelcrash/com.example.reprochannelcrash.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
Oh whoops. Turns out my fixes are actually on a different branch. Let me merge them into master.
Done! Can you try again Maarten?
Sure but I don't see the new snapshot yet
Oh it's the same 0.6.0-SNAPSHOT
version: https://oss.sonatype.org/content/repositories/snapshots/me/saket/telephoto/zoomable-image-coil/0.6.0-SNAPSHOT/
Still crashes, tested on real device and emulator
The exact steps that I do are:
also threw this one-off stacktrace that I didnt see before yet
Hmm that's weird. I am able to see significant performance gains on my Pixel 6a with the recent changes. Could you verify that gradle isn't caching a stale version of 0.6.0-SNAPSHOT
in your project? You can do this by pinning the version to the latest one:
implementation("me.saket.telephoto:zoomable-image-coil:0.6.0-20230827.201548-9")
I had deleted the cache, I just retested with the pinned version and the results are the same.
Oh hey I was able to reproduce the crash on the emulator with the second image. I was earlier only testing with the first image because it had a larger file size, but turns out the second one has a worse performance despite being smaller.
I'm disabling parallel decoding of bitmaps completely for large images which should solve this. I tested the changes on various devices including a Galaxy A20 and a Unihertz Jelly, and their performance looks good in release mode. I'll make a new release soon, but you can try out the newest snapshot once this action finishes running.
FWIW the reason these two images bring telephoto to a crawl is because Android's bitmap decoder is not super optimized for progressive JPEGs. Running multiple decoders in parallel makes the situation worse.
I can confirm it no longer crashes. But it does not seem to "subsample" or make the image sharper after zooming in.
Example now:
Example with prev version:
Amazing, just as I was about to cut a release. Is that happening on a real device? And are you able to consistently reproduce it? If so, could you help me investigate what might be happening? I'm unable to reproduce this on any of my devices or the emulator.
You can add a local build of telephoto to your project by adding this in your settings.gradle.kts
file:
includeBuild("../telephoto") {
dependencySubstitution {
substitute(module("me.saket.telephoto:zoomable-image-coil")).using(project(":zoomable-image:coil"))
}
}
My suspicion would be this line. Does anything change if you comment it out?
Could also try replacing this line:
with this:
val bitmapCache = BitmapCache(scope, decoder)
It was in a emulator, I can still reproduce it sometimes, but not consistently anymore. It happens when i load a few chunks when zoomed in a keep moving over the place and then stop on some place. Even after 10m+ it still hasn't sharpened. I have not been able to reproduce this on actual device though. I have some time in two days to test the above
Even after 10m+ it still hasn't sharpened.
Does it load if you move again?
I have some time in two days to test the above
Sounds good! Let's also move the new discussion in a new issue. I'll go ahead and close this one.
Sometimes when I rapidly zoom in a large image (~30MB) it crashes with the error below and my background turns black.
The stacktrace is one line:
channel '54b5b73 com.jerboa.debug/com.jerboa.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
The images were if relevant: