Skip to content

test: add concurrent dump/checkPoint stress test for Profiler#716

Merged
ar merged 1 commit into
jpos:mainfrom
TransactilityInc:test/profiler-concurrent-dump-checkpoint
May 11, 2026
Merged

test: add concurrent dump/checkPoint stress test for Profiler#716
ar merged 1 commit into
jpos:mainfrom
TransactilityInc:test/profiler-concurrent-dump-checkpoint

Conversation

@chhil
Copy link
Copy Markdown
Contributor

@chhil chhil commented May 10, 2026

Summary

Add a multi-threaded stress test that verifies Profiler.dump() and Profiler.checkPoint() can be called concurrently without triggering ConcurrentModificationException.

Test Details

The test spawns 4 writer threads (2000 checkpoints each) alongside a single dumper thread (2000 dumps), all starting simultaneously via CountDownLatch to maximize the chance of catching race conditions.

Test strategy

  • Multiple threads call checkPoint() with unique event names, modifying the shared events map
  • A separate thread continuously calls dump(), which iterates over the same map
  • Thread.yield() calls every 10 iterations increase lock contention between threads
  • Any exception (including ConcurrentModificationException) is captured via an AtomicBoolean flag

Motivation

This test validates the fix from PR #715 (Avoid concurrent modification while dumping Profiler) by simulating the real-world scenario where one thread is logging/dumping profiler results while other threads are simultaneously recording checkpoints.

Test Plan

  • Test compiles and passes locally
  • CI checks pass

Assisted-by: Hermes Agent:qwen36

Add a multi-threaded stress test that verifies Profiler.dump() and
Profiler.checkPoint() can be called concurrently without triggering
ConcurrentModificationException.

The test spawns 4 writer threads (2000 checkpoints each) alongside a
single dumper thread (2000 dumps), all starting simultaneously via
CountDownLatch to maximize the chance of catching race conditions.

Assisted-by: Hermes Agent:qwen36
@ar ar merged commit 6d304c2 into jpos:main May 11, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants