jmestwa-coder opened a new pull request, #674:
URL: https://github.com/apache/logging-log4cxx/pull/674
## Summary
Synchronize `AsyncAppender` getter access to shared mutable state already
protected by `bufferMutex` in the corresponding setters.
## Changes
* Lock `bufferMutex` in:
* `AsyncAppender::getBufferSize()`
* `AsyncAppender::getBlocking()`
* Add a focused concurrency stress test:
* `asyncappenderracestress`
## Why
`bufferSize` and `blocking` are non-atomic shared fields.
Before this change:
* `setBufferSize()` / `setBlocking()` updated the fields under `bufferMutex`
* `getBufferSize()` / `getBlocking()` accessed the same fields without
synchronization
Under concurrent getter/setter access, ThreadSanitizer reports data races
between the unsynchronized reads and mutex-protected writes.
## Validation
Verified with a deterministic stress test running concurrent:
* `setBufferSize()` ↔ `getBufferSize()`
* `setBlocking()` ↔ `getBlocking()`
Results:
* Pre-patch: TSAN reports data races in both getters
* Post-patch: same test runs clean under TSAN
Also verified existing tests with:
```powershell
ctest --test-dir build_codex_vs -C Debug -R "^asyncappendertestcase$"
--output-on-failure
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]