Skip to content

Fix channel_combine test race condition on ARM#27

Merged
zsoerenm merged 1 commit into
mainfrom
ss/fix-channel-combine-tests
Feb 10, 2026
Merged

Fix channel_combine test race condition on ARM#27
zsoerenm merged 1 commit into
mainfrom
ss/fix-channel-combine-tests

Conversation

@zsoerenm

Copy link
Copy Markdown
Member

Summary

  • Replace collect() with eager value reading in channel_combine tests
  • Tests now read chunk values immediately during iteration instead of accumulating FixedSizeMatrixDefault references via collect()
  • Fixes intermittent test failure on macOS ARM (aarch64) CI where the "Order preserved" mux test saw ch2 values in ch1 buffer slots

Context

The mux and add functions use pre-allocated buffer pools for allocation-free steady-state operation. When tests used collect(), they accumulated references to these buffer pool Memory objects across all chunks. On ARM, this triggered a suspected memory ordering issue where collected references pointed to stale data.

The fix reads values eagerly during iteration, matching production usage where each chunk is consumed immediately.

Test plan

  • All 38 channel_combine tests pass locally with 4 threads
  • CI passes on macOS ARM (aarch64)

🤖 Generated with Claude Code

Replace collect() with eager iteration that reads values immediately
from each chunk. This avoids holding references to pre-allocated buffer
pool Memory objects across multiple chunks, which caused intermittent
test failures on ARM (macOS aarch64) due to a suspected memory ordering
issue with FixedSizeArray/Memory references in PipeChannel ring buffers.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codecov

codecov Bot commented Feb 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.21%. Comparing base (a8667f5) to head (ca33689).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #27   +/-   ##
=======================================
  Coverage   74.21%   74.21%           
=======================================
  Files           8        8           
  Lines         543      543           
=======================================
  Hits          403      403           
  Misses        140      140           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@zsoerenm
zsoerenm merged commit 92dae31 into main Feb 10, 2026
7 checks passed
@zsoerenm
zsoerenm deleted the ss/fix-channel-combine-tests branch February 10, 2026 11:56
@github-actions

Copy link
Copy Markdown

Benchmark Results (Julia v1)

Time benchmarks
main ca33689... main / ca33689...
channel/buffer=1 3.96 ± 0.045 ms 3.9 ± 0.042 ms 1.01 ± 0.016
channel/buffer=1024 0.185 ± 0.0087 ms 0.186 ± 0.015 ms 0.99 ± 0.092
channel/buffer=16 0.421 ± 0.012 ms 0.424 ± 0.013 ms 0.993 ± 0.042
channel/buffer=256 0.197 ± 0.0072 ms 0.208 ± 0.01 ms 0.951 ± 0.057
channel/buffer=4 1.12 ± 0.023 ms 1.11 ± 0.018 ms 1.01 ± 0.027
channel/buffer=64 0.247 ± 0.009 ms 0.246 ± 0.0076 ms 1 ± 0.048
rechunk/10000_to_2048/buffer=1 6.51 ± 0.26 ms 6.65 ± 0.21 ms 0.978 ± 0.051
rechunk/10000_to_2048/buffer=16 4.35 ± 0.2 ms 4.38 ± 0.27 ms 0.992 ± 0.075
rechunk/10000_to_2048/buffer=4 4.73 ± 0.24 ms 4.58 ± 0.22 ms 1.03 ± 0.072
rechunk/10000_to_2048/buffer=64 4.68 ± 0.36 ms 4.71 ± 1 ms 0.994 ± 0.23
rechunk/2048_to_10000/buffer=1 0.991 ± 0.073 ms 0.968 ± 0.053 ms 1.02 ± 0.095
rechunk/2048_to_10000/buffer=16 1.04 ± 0.067 ms 1.02 ± 0.076 ms 1.02 ± 0.1
rechunk/2048_to_10000/buffer=4 1.01 ± 0.075 ms 0.975 ± 0.051 ms 1.03 ± 0.094
rechunk/2048_to_10000/buffer=64 1.27 ± 0.33 ms 1.2 ± 0.78 ms 1.06 ± 0.74
rechunk_state/batch/batch_2048_to_512_1ch 1.42 ± 0.14 ms 1.5 ± 0.11 ms 0.951 ± 0.12
rechunk_state/batch/batch_2048_to_512_4ch 6.04 ± 0.25 ms 6.02 ± 0.15 ms 1 ± 0.049
rechunk_state/batch/batch_512_to_2048_1ch 0.223 ± 0.09 ms 0.268 ± 0.056 ms 0.834 ± 0.38
rechunk_state/batch/batch_passthrough_2048_1ch 3.83 ± 0.26 μs 3.79 ± 0.3 μs 1.01 ± 0.1
rechunk_state/batch/iterative_2048_to_512_1ch 1.43 ± 0.13 ms 1.48 ± 0.12 ms 0.967 ± 0.12
rechunk_state/batch/iterative_2048_to_512_4ch 5.95 ± 0.21 ms 6.07 ± 0.17 ms 0.98 ± 0.045
rechunk_state/batch/iterative_512_to_2048_1ch 0.22 ± 0.085 ms 0.247 ± 0.069 ms 0.889 ± 0.43
rechunk_state/batch/iterative_passthrough_2048_1ch 3.85 ± 0.24 μs 3.77 ± 0.27 μs 1.02 ± 0.096
rechunk_state/channels/2048_to_1024_1ch 1.51 ± 0.13 ms 1.41 ± 0.1 ms 1.08 ± 0.12
rechunk_state/channels/2048_to_1024_2ch 2.99 ± 0.25 ms 2.92 ± 0.15 ms 1.02 ± 0.1
rechunk_state/channels/2048_to_1024_4ch 6.09 ± 0.42 ms 6.12 ± 0.2 ms 0.996 ± 0.075
rechunk_state/channels/2048_to_1024_8ch 12.1 ± 0.41 ms 12.3 ± 0.2 ms 0.986 ± 0.037
rechunk_state/downsample/10000_to_1024_1ch 7.5 ± 0.41 ms 7.58 ± 0.32 ms 0.99 ± 0.069
rechunk_state/downsample/2048_to_512_1ch 1.56 ± 0.13 ms 1.55 ± 0.13 ms 1.01 ± 0.12
rechunk_state/downsample/2048_to_512_4ch 6.16 ± 0.4 ms 6.33 ± 0.32 ms 0.974 ± 0.08
rechunk_state/passthrough/2048_to_2048_1ch 3.8 ± 0.24 μs 3.94 ± 0.43 μs 0.964 ± 0.12
rechunk_state/passthrough/2048_to_2048_4ch 3.84 ± 0.67 μs 4.05 ± 0.43 μs 0.948 ± 0.19
rechunk_state/types/ComplexF64_2048_to_1024 2.46 ± 0.19 ms 2.46 ± 0.12 ms 0.998 ± 0.089
rechunk_state/types/Float32_2048_to_1024 0.685 ± 0.071 ms 0.673 ± 0.065 ms 1.02 ± 0.14
rechunk_state/types/Float64_2048_to_1024 1.4 ± 0.13 ms 1.42 ± 0.1 ms 0.983 ± 0.11
rechunk_state/types/Int16_2048_to_1024 0.311 ± 0.037 ms 0.312 ± 0.039 ms 0.998 ± 0.17
rechunk_state/upsample/1024_to_10000_1ch 0.706 ± 0.14 ms 0.642 ± 0.048 ms 1.1 ± 0.24
rechunk_state/upsample/512_to_2048_1ch 0.303 ± 0.09 ms 0.238 ± 0.05 ms 1.27 ± 0.46
rechunk_state/upsample/512_to_2048_4ch 1.69 ± 0.36 ms 1.52 ± 0.13 ms 1.11 ± 0.25
rechunk_state/zero_copy/near_passthrough_2048_1ch 1.35 ± 0.17 ms 1.46 ± 0.12 ms 0.927 ± 0.14
rechunk_state/zero_copy/near_passthrough_2048_4ch 6.7 ± 0.42 ms 6.92 ± 0.26 ms 0.969 ± 0.07
rechunk_state/zero_copy/near_passthrough_8192_4ch 0.0519 ± 0.08 s 0.0353 ± 0.028 s 1.47 ± 2.5
rechunk_state/zero_copy/passthrough_2048_1ch 3.82 ± 0.2 μs 3.77 ± 0.36 μs 1.01 ± 0.11
rechunk_state/zero_copy/passthrough_2048_4ch 4.04 ± 0.62 μs 4.64 ± 0.61 μs 0.872 ± 0.18
rechunk_state/zero_copy/passthrough_8192_4ch 5.04 ± 0.84 μs 5.5 ± 1.1 μs 0.917 ± 0.23
tee/buffer=1 0.619 ± 0.014 ms 0.617 ± 0.014 ms 1 ± 0.031
tee/buffer=16 0.095 ± 0.0018 ms 0.095 ± 0.0026 ms 1 ± 0.033
tee/buffer=4 0.198 ± 0.0076 ms 0.197 ± 0.0072 ms 1.01 ± 0.053
tee/buffer=64 0.0783 ± 0.014 ms 0.0686 ± 0.0014 ms 1.14 ± 0.21
time_to_load 1.5 ± 0.0077 s 1.49 ± 0.0096 s 1.01 ± 0.0083
Memory benchmarks
main ca33689... main / ca33689...
channel/buffer=1 16 allocs: 1.09 kB 16 allocs: 1.09 kB 1
channel/buffer=1024 16 allocs: 1.09 kB 16 allocs: 1.09 kB 1
channel/buffer=16 16 allocs: 1.09 kB 16 allocs: 1.09 kB 1
channel/buffer=256 16 allocs: 1.09 kB 16 allocs: 1.09 kB 1
channel/buffer=4 16 allocs: 1.09 kB 16 allocs: 1.09 kB 1
channel/buffer=64 16 allocs: 1.09 kB 16 allocs: 1.09 kB 1
rechunk/10000_to_2048/buffer=1 12 allocs: 0.75 kB 12 allocs: 0.75 kB 1
rechunk/10000_to_2048/buffer=16 12 allocs: 0.75 kB 12 allocs: 0.75 kB 1
rechunk/10000_to_2048/buffer=4 12 allocs: 0.75 kB 12 allocs: 0.75 kB 1
rechunk/10000_to_2048/buffer=64 12 allocs: 0.75 kB 12 allocs: 0.75 kB 1
rechunk/2048_to_10000/buffer=1 13 allocs: 0.781 kB 12 allocs: 0.75 kB 1.04
rechunk/2048_to_10000/buffer=16 13 allocs: 0.781 kB 13 allocs: 0.781 kB 1
rechunk/2048_to_10000/buffer=4 13 allocs: 0.781 kB 12 allocs: 0.75 kB 1.04
rechunk/2048_to_10000/buffer=64 13 allocs: 0.781 kB 13 allocs: 0.781 kB 1
rechunk_state/batch/batch_2048_to_512_1ch 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/batch/batch_2048_to_512_4ch 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/batch/batch_512_to_2048_1ch 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/batch/batch_passthrough_2048_1ch 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/batch/iterative_2048_to_512_1ch 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/batch/iterative_2048_to_512_4ch 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/batch/iterative_512_to_2048_1ch 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/batch/iterative_passthrough_2048_1ch 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/channels/2048_to_1024_1ch 1 allocs: 16 B 1 allocs: 16 B 1
rechunk_state/channels/2048_to_1024_2ch 1 allocs: 16 B 1 allocs: 16 B 1
rechunk_state/channels/2048_to_1024_4ch 1 allocs: 16 B 1 allocs: 16 B 1
rechunk_state/channels/2048_to_1024_8ch 1 allocs: 16 B 1 allocs: 16 B 1
rechunk_state/downsample/10000_to_1024_1ch 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/downsample/2048_to_512_1ch 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/downsample/2048_to_512_4ch 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/passthrough/2048_to_2048_1ch 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/passthrough/2048_to_2048_4ch 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/types/ComplexF64_2048_to_1024 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/types/Float32_2048_to_1024 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/types/Float64_2048_to_1024 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/types/Int16_2048_to_1024 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/upsample/1024_to_10000_1ch 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/upsample/512_to_2048_1ch 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/upsample/512_to_2048_4ch 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/zero_copy/near_passthrough_2048_1ch 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/zero_copy/near_passthrough_2048_4ch 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/zero_copy/near_passthrough_8192_4ch 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/zero_copy/passthrough_2048_1ch 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/zero_copy/passthrough_2048_4ch 0 allocs: 0 B 0 allocs: 0 B
rechunk_state/zero_copy/passthrough_8192_4ch 0 allocs: 0 B 0 allocs: 0 B
tee/buffer=1 26 allocs: 1.48 kB 26 allocs: 1.48 kB 1
tee/buffer=16 26 allocs: 1.48 kB 26 allocs: 1.48 kB 1
tee/buffer=4 26 allocs: 1.48 kB 26 allocs: 1.48 kB 1
tee/buffer=64 26 allocs: 1.48 kB 26 allocs: 1.48 kB 1
time_to_load 0.145 k allocs: 11 kB 0.145 k allocs: 11 kB 1

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.

1 participant