Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

🐛 [Android] Each FrameOutput leaks its native thread (dispose() doesn't shut down the executor; useFrameOutput never disposes)

Open
#4,213 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 3 days

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
70/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
android, java, kotlin, react
Domain
mobile-dev

Research direction

Start from the reproduction PR #4212 and the harness-tests README in apps/simple-camera/__tests__ to get a failing test. Locate the Android FrameOutput implementation (search the android native sources for FrameOutput and its dispose()), and find where the frame-processing executor is created but never shut down; then trace the JS side useFrameOutput hook to see where disposal should be invoked on camera close. Done means the adb shell ps -T | grep -c camera.frame count returns to baseline after each open/close cycle and the harness test passes.

Written by the indexing model from the issue text.

Description

🐛 bug
Prerequisites
Reproduction

https://github.com/margelo/react-native-vision-camera/pull/4212

Steps to reproduce
  1. install simple app on an Android device or emulator
  2. Open the camera screen (uses useFrameOutput with a trivial onFrame that disposes the frame)
  3. Toggle the camera off and on
  4. After each cycle run: adb shell ps -T -p $(adb shell pidof ) | grep -c camera.frame
What did you expect to happen?

Closing the camera frees its frame thread. The count stays at 1 while the camera is open and 0 when it's closed.

What actually happened?

The count goes up by one every time the camera opens and never goes down. In our production app, in a test session reached 42 threads, and memory kept growing with each camera open. There's no crash; the app gets slower until it freezes.

Affected platforms

Android (device)

Device(s) affected

Android, Samsung s23e, Samsung galaxy AO5 and A07, Motorola G35

VisionCamera version

5.1.1

React Native version

0.86.3

React Native architecture

New Architecture (Fabric / bridgeless)

Features being used
  • Preview
  • Photo capture
  • Video capture
  • Frame Processors (worklets)
  • Skia Frame Processors
  • Code/Barcode Scanner
  • Location metadata
  • Multi-cam
  • Depth data
  • HDR / custom dynamic range
  • Custom format / FPS / resolution
Relevant logs / stack trace
# VisionCamera 5.1.1, Android 14 emulator (API 34, x86_64)
# logs captured after the app froze following repeated camera screen opens.
# No error or warning is logged by VisionCamera/CameraX; the leak is silent in logcat.

total threads: 235, "lo.camera.frame" threads: 42 (all S / futex_wait)

16143 S 27465 futex_wait com.pdvmundo
16618 S 56 futex_wait lo.camera.frame
16784 S 84 futex_wait lo.camera.frame
16956 S 123 futex_wait lo.camera.frame
17063 S 139 futex_wait lo.camera.frame
17153 S 111 futex_wait lo.camera.frame
17260 S 115 futex_wait lo.camera.frame
...  (36 more, same state)
21752 S 88 futex_wait lo.camera.frame
21918 S 103 futex_wait lo.camera.frame
Additional context

No response

Submission
  • The reproduction I linked is either (preferred) a PR against this repo that adds a failing harness test following the harness-tests README, or (fallback) a public repo that reproduces the bug on a fresh clone. I understand the issue will be closed without one.
  • I pasted logs as text (not screenshots).
  • I wrote this report in my own words. I did not paste AI-generated descriptions of the bug.
Dominant language
TypeScript
Stars
9.6k
Forks
1.4k
Avg merge
16h 53m
Merged PRs (30d)
1

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from margelo/react-native-vision-camera

All issues in margelo/react-native-vision-camera

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.