• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

hyperledger / fabric-x-committer / 23287433166
91%

Build:
DEFAULT BRANCH: main
Ran 19 Mar 2026 09:07AM UTC
Jobs 2
Files 122
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

19 Mar 2026 09:02AM UTC coverage: 90.33%. First build
23287433166

push

github

web-flow
[channel] Fix race condition on channel.Ready.Reset() (#446)

#### Type of change

- Bug fix

#### Description

**Root cause:** The `Ready.Reset()` method was experiencing a race
condition due to non-atomic struct field replacement. The original
implementation used `*r = *NewReady()` to reset the struct, which
performs a multi-step memory copy operation that replaces all fields
(channels `ready`, `closed`, and `once`). This struct copy is not
atomic.

Concurrently, other goroutines calling `WaitForReady()` or
`WaitForAllReady()` would read from the same channel fields (`r.ready`
and `r.closed`) via select statements. This created a classic data race
where one goroutine was writing to struct fields while others were
simultaneously reading from them.

**Race scenario:**
1. Goroutine A calls `Reset()` and begins copying new struct fields
(non-atomic multi-step operation)
2. Goroutine B calls `WaitForReady()` and attempts to read `r.ready` or
`r.closed` channels
3. Data race occurs: Goroutine A writes to memory while Goroutine B
reads from the same memory locations

**The fix:** Uses atomic pointer indirection by moving channels into an
inner `ready` struct and storing only an `atomic.Pointer[ready]` in the
outer `Ready` struct. This enables atomic swapping of the entire
internal state via `CompareAndSwap()`, eliminating the race condition
while maintaining the same external API.

#### Related issues

- discovered by #442

Signed-off-by: Liran Funaro <liran.funaro@gmail.com>

20 of 20 new or added lines in 1 file covered. (100.0%)

9491 of 10507 relevant lines covered (90.33%)

1.32 hits per line

Jobs
ID Job ID Ran Files Coverage
1 db-test - 23287433166.1 19 Mar 2026 09:25AM UTC 122
83.9
GitHub Action Run
2 unit-test - 23287433166.2 19 Mar 2026 09:07AM UTC 78
69.14
GitHub Action Run
Source Files on build 23287433166
  • Tree
  • List 122
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • cf13f9f4 on github
  • Prev Build on main (#23287424403)
  • Next Build on main (#23298088174)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc