Skip to content

fix: resolve concurrency races and overhaul test diagnostics#22

Merged
Sam-Si merged 7 commits into
mainfrom
fix/test-infrastructure-and-concurrency-races
May 3, 2026
Merged

fix: resolve concurrency races and overhaul test diagnostics#22
Sam-Si merged 7 commits into
mainfrom
fix/test-infrastructure-and-concurrency-races

Conversation

@Sam-Si

@Sam-Si Sam-Si commented Apr 30, 2026

Copy link
Copy Markdown
Owner

Thread Safety Fixes:

  • warm_worker_pool.cpp: Fix Shutdown() data race — was accessing workers_ vector without mutex_ lock, racing with AcquireWorker(). Now collects worker pointers under lock, signals/joins outside to avoid deadlock. Upgraded all memory_order_relaxed → acquire/release for proper visibility.

  • dynamic_worker_coordinator.cpp: Fix recycling→shutdown race — after DoRecycle(), if NotifyShutdown() changed state to kShutdown during recycling, the worker was still scanning the pool queue and could dequeue a request it would never execute (causing caller hangs). Now breaks immediately when CAS fails.

  • dynamic_worker_coordinator_test.cc: Fix LeaseTimeout test taking 60s by changing recycle_duration from 60s to 200ms. The gate mechanism already keeps the worker busy; the recycle duration was only blocking shutdown unnecessarily.

Test Infrastructure (dcodex-setup.sh):

  • Add dump_test_logs() — extracts and prints bazel test.log content on failure (was completely invisible before)
  • Run specific targets per sanitizer instead of //... which caused one failure to abort all others as NO STATUS
  • Skip MSan (matches CI — system libstdc++ not instrumented)
  • Add --verbose_failures and --sandbox_debug always
  • Add RUN_MSAN=1 env var to force-run MSan with suppressions
  • Separate TSan sandbox_test with constrained resources (--jobs=1)
  • Print color-coded summary table: PASS/FAIL/SKIPPED per sanitizer

CI Workflow (linux_ci.yml):

  • Add dcodex-setup.sh --test as environment verification step
  • Add --verbose_failures to all existing test steps
  • Upload /tmp/dcodex-test-*.log alongside bazel-testlogs on failure

Sam-Si added 7 commits May 1, 2026 00:48
Thread Safety Fixes:
- warm_worker_pool.cpp: Fix Shutdown() data race — was accessing workers_
  vector without mutex_ lock, racing with AcquireWorker(). Now collects
  worker pointers under lock, signals/joins outside to avoid deadlock.
  Upgraded all memory_order_relaxed → acquire/release for proper visibility.

- dynamic_worker_coordinator.cpp: Fix recycling→shutdown race — after
  DoRecycle(), if NotifyShutdown() changed state to kShutdown during
  recycling, the worker was still scanning the pool queue and could
  dequeue a request it would never execute (causing caller hangs).
  Now breaks immediately when CAS fails.

- dynamic_worker_coordinator_test.cc: Fix LeaseTimeout test taking 60s
  by changing recycle_duration from 60s to 200ms. The gate mechanism
  already keeps the worker busy; the recycle duration was only blocking
  shutdown unnecessarily.

Test Infrastructure (dcodex-setup.sh):
- Add dump_test_logs() — extracts and prints bazel test.log content on
  failure (was completely invisible before)
- Run specific targets per sanitizer instead of //... which caused one
  failure to abort all others as NO STATUS
- Skip MSan (matches CI — system libstdc++ not instrumented)
- Add --verbose_failures and --sandbox_debug always
- Add RUN_MSAN=1 env var to force-run MSan with suppressions
- Separate TSan sandbox_test with constrained resources (--jobs=1)
- Print color-coded summary table: PASS/FAIL/SKIPPED per sanitizer

CI Workflow (linux_ci.yml):
- Add dcodex-setup.sh --test as environment verification step
- Add --verbose_failures to all existing test steps
- Upload /tmp/dcodex-test-*.log alongside bazel-testlogs on failure
Ubuntu 24.04's system pip is installed via apt and refuses
'pip install --upgrade pip' with 'RECORD file not found'.
Skip the upgrade (unnecessary) and add --break-system-packages
to pip install since we're running as root in CI/Docker.
…te transitions and update setup script accordingly
@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@Sam-Si Sam-Si merged commit 774bb80 into main May 3, 2026
3 checks passed
@Sam-Si Sam-Si deleted the fix/test-infrastructure-and-concurrency-races branch May 3, 2026 18:19
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