Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 IllegalStateException: maxImages (6) has already been acquired, call #close before acquiring more. #3205

Open
4 of 5 tasks
TryRevilo opened this issue Sep 20, 2024 · 4 comments
Labels
🐛 bug Something isn't working

Comments

@TryRevilo
Copy link

What's happening?

App Crashes when I start Capturing Frames ie : in my Example below , when I set isActive to true

Reproduceable Code

<Camera
  ref={revCameraRef}
  style={StyleSheet.absoluteFill}
  device={revDevicesArr[revSelectedDeviceId]}
  isActive={isRevCameraActive}
  frameProcessor={revFrameProcessor}
/>

const revFrameProcessor = useFrameProcessor(frame => {
  'worklet';

  frame.close();
}, []);

Relevant log output

09-20 19:04:14.825   906 18275 E PDTblGen: [getTbl] dev(1) scenario(0) : Table is not generated. Please check error log during generating table (1st time lunch sensor mode(0))
09-20 19:04:14.825   906 18275 E PDTblGen:  (getTbl){#778:vendor/mediatek/proprietary/hardware/mtkcam/aaa/source/common/utils/PDTblGen/PDTblGen.cpp}
09-20 19:04:14.825   906 18275 E isp_mgr_bnr: apply(): Fail to Gen PDC Table, SensorDev(1), SensorMode(0), FrontBin(0)
09-20 19:04:14.825   906 18275 E isp_mgr_bnr:  (apply){#266:vendor/mediatek/proprietary/hardware/mtkcam/aaa/source/mt6765/isp_mgr/isp_mgr_bnr.cpp}
09-20 19:04:14.827 18105 18387 E ImageAnalysisAnalyzer: Failed to acquire image.
09-20 19:04:14.827 18105 18387 E ImageAnalysisAnalyzer: java.lang.IllegalStateException: maxImages (6) has already been acquired, call #close before acquiring more.
09-20 19:04:14.827 18105 18387 E ImageAnalysisAnalyzer:   at android.media.ImageReader.acquireNextImage(ImageReader.java:527)
09-20 19:04:14.827 18105 18387 E ImageAnalysisAnalyzer:   at androidx.camera.core.AndroidImageReaderProxy.acquireNextImage(AndroidImageReaderProxy.java:86)
09-20 19:04:14.827 18105 18387 E ImageAnalysisAnalyzer:   at androidx.camera.core.SafeCloseImageReaderProxy.acquireNextImage(SafeCloseImageReaderProxy.java:86)
09-20 19:04:14.827 18105 18387 E ImageAnalysisAnalyzer:   at androidx.camera.core.ImageAnalysisBlockingAnalyzer.acquireImage(ImageAnalysisBlockingAnalyzer.java:39)
09-20 19:04:14.827 18105 18387 E ImageAnalysisAnalyzer:   at androidx.camera.core.ImageAnalysisAbstractAnalyzer.onImageAvailable(ImageAnalysisAbstractAnalyzer.java:126)
09-20 19:04:14.827 18105 18387 E ImageAnalysisAnalyzer:   at androidx.camera.core.SafeCloseImageReaderProxy.lambda$setOnImageAvailableListener$1$androidx-camera-core-SafeCloseImageReaderProxy(SafeCloseImageReaderProxy.java:211)
09-20 19:04:14.827 18105 18387 E ImageAnalysisAnalyzer:   at androidx.camera.core.SafeCloseImageReaderProxy$$ExternalSyntheticLambda0.onImageAvailable(D8$$SyntheticClass:0)
09-20 19:04:14.827 18105 18387 E ImageAnalysisAnalyzer:   at androidx.camera.core.AndroidImageReaderProxy.lambda$setOnImageAvailableListener$0$androidx-camera-core-AndroidImageReaderProxy(AndroidImageReaderProxy.java:167)
09-20 19:04:14.827 18105 18387 E ImageAnalysisAnalyzer:   at androidx.camera.core.AndroidImageReaderProxy$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
09-20 19:04:14.827 18105 18387 E ImageAnalysisAnalyzer:   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
09-20 19:04:14.827 18105 18387 E ImageAnalysisAnalyzer:   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
09-20 19:04:14.827 18105 18387 E ImageAnalysisAnalyzer:   at java.lang.Thread.run(Thread.java:923)
09-20 19:04:14.858   906 18275 E PDTblGen: [getTbl] dev(1) scenario(0) : Table is not generated. Please check error log during generating table (1st time lunch sensor mode(0))
09-20 19:04:14.858   906 18275 E PDTblGen:  (getTbl){#778:vendor/mediatek/proprietary/hardware/mtkcam/aaa/source/common/utils/PDTblGen/PDTblGen.cpp}
09-20 19:04:14.858   906 18275 E isp_mgr_bnr: apply(): Fail to Gen PDC Table, SensorDev(1), SensorMode(0), FrontBin(0)
09-20 19:04:14.858   906 18275 E isp_mgr_bnr:  (apply){#266:vendor/mediatek/proprietary/hardware/mtkcam/aaa/source/mt6765/isp_mgr/isp_mgr_bnr.cpp}
09-20 19:04:14.863 18105 18387 E ImageAnalysisAnalyzer: Failed to acquire image.
09-20 19:04:14.863 18105 18387 E ImageAnalysisAnalyzer: java.lang.IllegalStateException: maxImages (6) has already been acquired, call #close before acquiring more.
09-20 19:04:14.863 18105 18387 E ImageAnalysisAnalyzer:   at android.media.ImageReader.acquireNextImage(ImageReader.java:527)
09-20 19:04:14.863 18105 18387 E ImageAnalysisAnalyzer:   at androidx.camera.core.AndroidImageReaderProxy.acquireNextImage(AndroidImageReaderProxy.java:86)
09-20 19:04:14.863 18105 18387 E ImageAnalysisAnalyzer:   at androidx.camera.core.SafeCloseImageReaderProxy.acquireNextImage(SafeCloseImageReaderProxy.java:86)
09-20 19:04:14.863 18105 18387 E ImageAnalysisAnalyzer:   at androidx.camera.core.ImageAnalysisBlockingAnalyzer.acquireImage(ImageAnalysisBlockingAnalyzer.java:39)
09-20 19:04:14.863 18105 18387 E ImageAnalysisAnalyzer:   at androidx.camera.core.ImageAnalysisAbstractAnalyzer.onImageAvailable(ImageAnalysisAbstractAnalyzer.java:126)
09-20 19:04:14.863 18105 18387 E ImageAnalysisAnalyzer:   at androidx.camera.core.SafeCloseImageReaderProxy.lambda$setOnImageAvailableListener$1$androidx-camera-core-SafeCloseImageReaderProxy(SafeCloseImageReaderProxy.java:211)
09-20 19:04:14.863 18105 18387 E ImageAnalysisAnalyzer:   at androidx.camera.core.SafeCloseImageReaderProxy$$ExternalSyntheticLambda0.onImageAvailable(D8$$SyntheticClass:0)
09-20 19:04:14.863 18105 18387 E ImageAnalysisAnalyzer:   at androidx.camera.core.AndroidImageReaderProxy.lambda$setOnImageAvailableListener$0$androidx-camera-core-AndroidImageReaderProxy(AndroidImageReaderProxy.java:167)
09-20 19:04:14.863 18105 18387 E ImageAnalysisAnalyzer:   at androidx.camera.core.AndroidImageReaderProxy$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
09-20 19:04:14.863 18105 18387 E ImageAnalysisAnalyzer:   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
09-20 19:04:14.863 18105 18387 E ImageAnalysisAnalyzer:   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
09-20 19:04:14.863 18105 18387 E ImageAnalysisAnalyzer:   at java.lang.Thread.run(Thread.java:923)

Camera Device

{
  "formats": [],
  "sensorOrientation": "landscape-left",
  "hardwareLevel": "full",
  "maxZoom": 10,
  "minZoom": 1,
  "maxExposure": 20,
  "supportsLowLightBoost": false,
  "neutralZoom": 1,
  "physicalDevices": [
    "wide-angle-camera"
  ],
  "supportsFocus": true,
  "supportsRawCapture": false,
  "isMultiCam": false,
  "minFocusDistance": 5,
  "minExposure": -20,
  "name": "0 (BACK) androidx.camera.camera2",
  "hasFlash": true,
  "hasTorch": true,
  "position": "back",
  "id": "0"
}

Device

Android

VisionCamera Version

"react-native-vision-camera": "^4.5.3",

Can you reproduce this issue in the VisionCamera Example app?

I didn't try (⚠️ your issue might get ignored & closed if you don't try this)

Additional information

@TryRevilo TryRevilo added the 🐛 bug Something isn't working label Sep 20, 2024
Copy link

maintenance-hans bot commented Sep 20, 2024

Guten Tag, Hans here! 🍻

It looks like you're encountering an IllegalStateException when capturing frames. Make sure you are properly closing images after processing them with frame.close() in your revFrameProcessor. If you're still having issues, please provide more details about your setup. Also, have you tried reproducing this issue in the VisionCamera Example app? This can help narrow down the problem.

If you want to keep supporting this project, consider sponsoring mrousavy! It helps keep ze project maintained.

Note: If you think I made a mistake, please ping @mrousavy to take a look.

@TryRevilo
Copy link
Author

Hi @maintenance-hans . Thanks for the reply . How do I go about closing each image properly before acquiring more

Copy link

it ain't much, but it's honest work

@TryRevilo
Copy link
Author

I think I already am with :

const revFrameProcessor = useFrameProcessor(frame => {
  'worklet';

  frame.close();
}, []);

@mrousavy mrousavy changed the title 🐛 09-20 19:04:14.827 18105 18387 E ImageAnalysisAnalyzer: java.lang.IllegalStateException: maxImages (6) has already been acquired, call #close before acquiring more. 🐛 IllegalStateException: maxImages (6) has already been acquired, call #close before acquiring more. Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant