Closed darrenjaworski closed 3 months ago
@darrenjaworski Thank you for your report. However, when I tried, this issue did not reproduce.
printImageUri
is substituted "sample.png"
or "sample2.png"
.npx react-native run-android
command with the actual Android Device (Pixel 4a Android 12) and the virtual one.% sw_vers
ProductName: macOS
ProductVersion: 12.4
BuildVersion: 21F79
% npx react-native info
info Fetching system and libraries information...
System:
OS: macOS 12.4
CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
Memory: 47.38 MB / 8.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.13.2 - ~/.nodebrew/current/bin/node
Yarn: 1.22.19 - ~/.nodebrew/current/bin/yarn
npm: 8.14.0 - ~/.nodebrew/current/bin/npm
Watchman: 2022.07.04.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.11.3 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
Android SDK:
API Levels: 27, 29, 30, 31, 32
Build Tools: 29.0.2, 30.0.2, 30.0.3, 32.0.0, 32.1.0
System Images: android-31 | Google APIs Intel x86 Atom_64
Android NDK: Not Found
IDEs:
Android Studio: 2021.2 AI-212.5712.43.2112.8609683
Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
Languages:
Java: 11.0.11 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: 0.67.2 => 0.67.2
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
Could you please let us know how to specify the source
parameter of ImageParameter method?
Thanks for responding to the issue! It's been really stumping us and actually from your response we were able to discover more about this weird issue.
This seems to be directly related to the RAM usage of the app. Somewhere around 220MB this issue occurs. This is a big concern our RN app typically sits around that point. Where we currently are printing, this issue occurs even with a small image. (On physical device we can't even print the smallest image we have, the app crashes)
Given that the android simulators we have tested on are configured with 4 GB of RAM this should be no issue, so I'm wondering if some of the lower level java bitmap code could be the issue here.
To help make it easier to reproduce, here is a repo with a bunch of kittens and a print button. This includes a sample creating the ImageParameter like you asked
It does print a lot of images on screen... but RAM usage is close to what our actually app uses.
Reproduction Steps:
(you can use the profiler in android studio to validate the amount of RAM being used)
iOS does not exhibit this behavior, even on an iPAD with less RAM.
@KodyFintak Thank you very much for your information and sample project for this issue. I'm sure this information will be helpful in the analysis of this issue.
I'm trying to reproduce the error on your sample, but have not yet been able to reproduce the same error. The following errors may also occur and I will check them together.
LOG Running "starprinttest" with {"rootTag":1}
WARN Possible Unhandled Promise Rejection (id: 0):
StarIO10InUseError: The device is in use by another process.
construct@[native code]
construct@[native code]
_construct@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.starprinttest&modulesOnly=false&runModule=true:23519:28
Wrapper@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.starprinttest&modulesOnly=false&runModule=true:23479:64
construct@[native code]
_createSuperInternal@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.starprinttest&modulesOnly=false&runModule=true:113775:322
StarIO10Error@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.starprinttest&modulesOnly=false&runModule=true:113789:26
construct@[native code]
_createSuperInternal@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.starprinttest&modulesOnly=false&runModule=true:113980:322
StarIO10InUseError@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.starprinttest&modulesOnly=false&runModule=true:113991:26
http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.starprinttest&modulesOnly=false&runModule=true:113670:103
generatorResume@[native code]
asyncGeneratorStep@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.starprinttest&modulesOnly=false&runModule=true:24715:26
_next@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.starprinttest&modulesOnly=false&runModule=true:24737:29
http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.starprinttest&modulesOnly=false&runModule=true:24744:14
tryCallTwo@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.starprinttest&modulesOnly=false&runModule=true:28940:9
doResolve@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.starprinttest&modulesOnly=false&runModule=true:29104:25
Promise@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.starprinttest&modulesOnly=false&runModule=true:28963:14
http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.starprinttest&modulesOnly=false&runModule=true:24733:25
_buildObject@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.starprinttest&modulesOnly=false&runModule=true:113711:37
http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.starprinttest&modulesOnly=false&runModule=true:113630:60
generatorResume@[native code]
asyncGeneratorStep@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.starprinttest&modulesOnly=false&runModule=true:24715:26
_next@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.starprinttest&modulesOnly=false&runModule=true:24737:29
tryCallOne@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.starprinttest&modulesOnly=false&runModule=true:28931:16
http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.starprinttest&modulesOnly=false&runModule=true:29032:27
http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.starprinttest&modulesOnly=false&runModule=true:30196:26
_callTimer@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.starprinttest&modulesOnly=false&runModule=true:30096:17
_callReactNativeMicrotasksPass@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.starprinttest&modulesOnly=false&runModule=true:30131:17
callReactNativeMicrotasks@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.starprinttest&modulesOnly=false&runModule=true:30339:44
__callReactNativeMicrotasks@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.starprinttest&modulesOnly=false&runModule=true:3025:46
http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.starprinttest&modulesOnly=false&runModule=true:2803:45
__guard@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.starprinttest&modulesOnly=false&runModule=true:3008:15
flushedQueue@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.starprinttest&modulesOnly=false&runModule=true:2802:21
flushedQueue@[native code]
invokeCallbackAndReturnFlushedQueue@[native code]
I appreciate your patience.
@bandit-ibayashi Ah got it, let me send over the exact simulator details we are using to help recreate the issue.
Here is a screenshot of a device configuration I was able to get to crash with the linked kitten project above.
The RAM is the same as our physical device but I'm unsure of the VM Heap setting. I'm taking some time to figure that out but the issue still occurs on the simulator above.
I ran this with a profiler and figured it would be helpful to show the spike when I click "print" and show the crash of the app.
The following errors may also occur and I will check them together. StarIO10InUseError: The device is in use by another process.
This error is probably from clicking the print button multiple times. In our case that shouldn't be an issue so I think that problem is unrelated?
Thanks again for taking a look into this!
@KodyFintak Thank you for your more detailed report. But somehow I have not yet been able to reproduce this problem using an Android emulator with the same settings.
I also don't think the StarIO10InUseError
is related to this Issue either, but it also occurs on the first tap after launching the app. (I clicked the button carefully to avoid double tapping).
I will continue to analyse this Issue. I appreciate your patience.
Sounds good. Thanks again for looking into this.
If it helps we could talk for 30 over a video chat sometime next week. That way I can exactly show the issue that's going on and we can try to work through it together.
We have updated the platform and libraries, including ours, but so far we have not been able to reproduce it in our environment, and there have been no other similar reports, so please let us close this Issue for now. If you continue to experience this problem, we would greatly appreciate it if you could reopen the issue.
Description
Android application crashes on print with image (png). This same image works fine on iOS implementation. Identified in stack trace where the out of memory exception is occuring, seems to be in actionPrintImage in the underlying android star library. The image is only 0.2 MB and should not be causing out of memory exceptions.
Started using on actual android device and crashes for the same reason but with even smaller images.
stack trace included:
Your device where the bug occurs
Your printer
Your development environment
ProductName: macOS ProductVersion: 12.2 BuildVersion: 21D49
System: OS: macOS 12.2 CPU: (10) arm64 Apple M1 Pro Memory: 93.78 MB / 16.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 18.5.0 - /opt/homebrew/bin/node Yarn: 1.22.19 - ~/.nvm/versions/node/v16.16.0/bin/yarn npm: 8.12.1 - /opt/homebrew/bin/npm Watchman: Not Found Managers: CocoaPods: 1.11.3 - /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5 Android SDK: Not Found IDEs: Android Studio: 2021.2 AI-212.5712.43.2112.8609683 Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild Languages: Java: 17.0.2 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 17.0.2 => 17.0.2 react-native: 0.68.1 => 0.68.1 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Expected library to trigger print for image in android.
Screenshots
Additional context
Example images that is attempted to be printed.