facebook / facebook/litho

fix: non-volatile mutable global test flag can be stale across threads

Open
#1,081 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
7.8k
Forks
768
PR merge metrics
No merged PRs in 30d

Description

## Description

`isEndToEndTestRun` is a mutable global (`object` field) that can be changed at runtime, but it is not `@Volatile` or atomic. Reads/writes from different threads are a data race on JVM memory visibility, so one thread may not observe updates made by another. This can produce inconsistent thread-utils behavior during runtime toggles.

**Severity**: `medium`
**File**: `litho-rendercore-thread-utils/src/main/java/com/facebook/rendercore/thread/utils/RenderCoreThreadUtilsConfig.kt`

## Expected Behavior

The code should handle this case properly to avoid unexpected errors or degraded quality.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.