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

dashbitco / broadway
93%
main: 93%

Build:
Build:
LAST BUILD BRANCH: fix-graceful-shutdown
DEFAULT BRANCH: main
Repo Added 29 Nov 2020 04:15PM UTC
Token jLgy3mySgaR0foZZUvZGffwEZFLD1SgXT regen
Build 235 Last
Files 21
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

LAST BUILD ON BRANCH fix-graceful-shutdown
branch: fix-graceful-shutdown
CHANGE BRANCH
x
Reset
Sync Branches
  • fix-graceful-shutdown
  • 225-skipped-with-dummy-producer
  • 245-adding-context-to-telemtry-events
  • FEATURE/add-configurable-ack
  • acco/add-reset-opt-to-update_rate_limiting
  • adding_supervisor_init_telemetry_event
  • al/1.18
  • al/minor-doc-improvements
  • al/more-types
  • al/rename
  • al/update-deps-and-ci
  • al/update-elixir
  • andrea/fix-process-name-callback
  • andrea/more-nimble-options
  • andrea/nimble
  • andrea/rpdoucers
  • andrea/speed-up-ci
  • byte-size-batching
  • cg/improve-prepare-docs
  • change-failed-typespec
  • code-coverage-on-coveralls
  • concurrency_setting_notes
  • default-batcher
  • demand-dispatcher-shuffle-demands
  • docs
  • edits
  • fan-in-producer
  • feat/add-credo-and-fix-issues
  • feat/add-is-full-to-batch-info
  • feat/config-storage-behaviour
  • feat/telemetry-span
  • fix-crash_reason-for-erlang-errors
  • fix-telemetry-docs
  • fix-typo
  • fix-typos
  • fix/batcher-fullsweep-after
  • fix/ensure-ets-table-exists
  • fix_typos
  • labels
  • main
  • master
  • patch-1
  • ps-add-batcher-key-telemetry-md
  • ps-add-more-telemetry-metadata
  • ps-add-topology-function
  • ps-change-persistent-term-key-value
  • ps-fix-intermittent-test
  • ps-fix-telemetry-events-and-docs
  • ps-topology-fun-from-process
  • ps-update-telemetry-docs-2
  • refs/pull/328/merge
  • refs/pull/329/merge
  • sdc/add-producer
  • subscriber-remove-shuffle
  • switching_to_counters
  • telemetry-failed-messages
  • wm-ci

30 Jul 2025 10:41AM UTC coverage: 92.982% (-0.1%) from 93.119%
0160e33666b8ae8fdfb245bb0ac3b8d5d0a49817-PR-362

Pull #362

github

rslota
Fix graceful shutdown race condition

Currently, when `Topology` is shutting down, it calls `Terminator.trap_exit/1` to allow it to handle `terminate/2` callback and shutdown producers gracefully.
However, `Terminator.trap_exit/1` is using `GenServer.cast/2` which makes it fully asynchronous, making it possible for `Topology`'s
terminate callback to return before `Terminator` starts trapping exits, allowing `Terminator` to be shut down without putting producers into "draining" state.

In my system when we're running ~50-100 Broadway instances we're seeing ~50% of them shutting down properly and the rest of them get stuck with producers
going full blast unaware of the shutdown.

This change simply changes `Terminator.trap_exit/1` to use `GenServer.call/2` instead of `GenServer.cast/2` to make it fully synchronous, which fixed the issue.
Since I don't know Broadway internals at all, please let me know if there is a better way to fix this.
Pull Request #362: Fix graceful shutdown race condition

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

2 existing lines in 2 files now uncovered.

636 of 684 relevant lines covered (92.98%)

144.42 hits per line

Relevant lines Covered
Build:
Build:
684 RELEVANT LINES 636 COVERED LINES
144.42 HITS PER LINE
Source Files on fix-graceful-shutdown
  • Tree
  • List 21
  • Changed 2
  • Source Changed 0
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line

Recent builds

Builds Branch Commit Type Ran Committer Via Coverage
0160e336... fix-graceful-shutdown Fix graceful shutdown race condition Currently, when `Topology` is shutting down, it calls `Terminator.trap_exit/1` to allow it to handle `terminate/2` callback and shutdown producers gracefully. However, `Terminator.trap_exit/1` is using `GenSer... Pull #362 30 Jul 2025 01:58PM UTC rslota github
92.98
See All Builds (126)

Badge your Repo: broadway

We detected this repo isn’t badged! Grab the embed code to the right, add it to your repo to show off your code coverage, and when the badge is live hit the refresh button to remove this message.

Could not find badge in README.

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

Refresh
  • Settings
  • Repo on GitHub
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

© 2025 Coveralls, Inc