googlesamples / googlesamples/mlkit

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

Open
#958 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
4.3k
Forks
3.1k
PR merge metrics
No merged PRs in 30d

Description

**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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.