mlkit icon indicating copy to clipboard operation
mlkit copied to clipboard

[Bug report] ML Kit Crash on RK3588 Devices – SIGSEGV (SEGV_ACCERR) from scanner.process(InputImage.fromBitmap(...))

Open topxebec opened this issue 6 months ago • 0 comments

Describe the bug On RK3588-based Android devices, repeatedly invoking ML Kit’s barcode scanner with a statically initialized Bitmap leads to a native crash after several minutes, with SIGSEGV and SEGV_ACCERR signals. This appears to be caused by the bitmap’s pixel buffer becoming inaccessible, likely due to GPU-backed memory being unmapped or invalidated during native processing. The issue occurs more frequently when adaptive brightness is enabled in the system settings. On other devices (non-Rockchip), the same code runs without issue.

Crash Info

Fatal signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0xb4000075aee46018 in tid 21735 (pool-3-thread-7)
#00 pc 000000000010d4c8  /data/app/com.example.myapp/.../libbarhopper_v3.so

Memory mapping at crash time shows the address falls in a ---p (no-access) region, indicating that the bitmap's pixel buffer has been unmapped or is GPU-only.

To Reproduce

  1. Decode a bitmap from res/raw/barcode.png using BitmapFactory.decodeStream()
  2. Wrap it once using InputImage.fromBitmap(...)
  3. Inside a coroutine loop, repeatedly call scanner.process(image).await()
  4. After a few minutes, the app crashes with signal 11

Expected behavior Work consistently without crashing

SDK Info: com.google.mlkit:barcode-scanning:17.3.0

topxebec avatar Jul 08 '25 08:07 topxebec