mirror of
https://github.com/scylladb/scylladb.git
synced 2026-06-03 21:47:10 +00:00
The lockup: When view_builder starts all shards at some point get to a barrier waiting for each other to pass. If any shard misses this checkpoint, all others stuck forever. As this barrier lives inside the _started future, which in turn is waited on stop, the stop stucks as well. Reasons to miss the barrier -- exception in the middle of the fun^w start or explicit abort request while waiting for the schema agreement. Fix the "exception" case by unlocking the barrier promise with exception and fix the "abort request" case by turning it into an exception. The bug can be reproduced by hands if making one shard never see the schema agreement and continue looping until the abort request. The crash: If the background start up fails, then the _started future is resolved into exception. The view_builder::stop then turns this future into a real exception caught-and-rethrown by main.cc. This seems wrong that a failure in a background fiber aborts the regular shutdown that may proceed otherwise. tests: unit(dev), manual start-stop branch: https://github.com/xemul/scylla/tree/br-view-builder-shutdown-fix-3 fixes: #7077 Patch #5 leaves the seastar::async() in the 1-st phase of the start() although can also be tuned not to produce a thread. However, there's one more (painless) issue with the _sem usage, so this change appears too large for the part of the bug-fix and will come as a followup. * 'br-view-builder-shutdown-fix-3' of git://github.com/xemul/scylla: view_builder: Add comment about builder instances life-times view_builder: Do sleep abortable view_builder: Wakeup barrier on exception view_builder: Always resolve started future to success view_builder: Re-futurize start view_builder: Split calculate_shard_build_step into two view_builder: Populate the view_builder_init_state view_builder: Fix indentation after previous patch view_builder: Introduce view_builder_init_state