{"record":{"id":"53a520ecf769d707","repo":"risingwavelabs/risingwave","slug":"wait-for-signal-0-timeout","errorCode":null,"errorMessage":"Wait for signal {0} timeout","messagePattern":"Wait for signal (.+?) timeout","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/utils/sync-point/src/lib.rs","lineNumber":24,"sourceCode":"//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nuse std::collections::HashMap;\nuse std::future::Future;\nuse std::sync::Arc;\nuse std::time::Duration;\n\nuse futures_util::future::{BoxFuture, FutureExt};\n\n#[derive(thiserror::Error, Debug)]\npub enum Error {\n    #[error(\"Wait for signal {0} timeout\")]\n    WaitTimeout(&'static str),\n}\n\npub type SyncPoint = &'static str;\ntype Action = Arc<dyn Fn() -> BoxFuture<'static, ()> + Send + Sync>;\n\nstatic SYNC_FACILITY: spin::Once<SyncFacility> = spin::Once::new();\n\nstruct SyncFacility {\n    /// `Notify` for each sync point.\n    notifies: spin::Mutex<HashMap<SyncPoint, Arc<tokio::sync::Notify>>>,\n    /// Actions for each sync point.\n    actions: spin::Mutex<HashMap<SyncPoint, Action>>,\n}\n\nimpl SyncFacility {\n    fn new() -> Self {\n        Self {","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/utils/sync-point/src/lib.rs#L6-L42","documentation":"sync-point's `Error::WaitTimeout` is returned when `wait_for_signal(name, timeout)` does not observe the registered sync-point signal within the given Duration. Sync points are test/diagnostic hooks: test code registers an action for a named point and waits for production code to hit it; a timeout means the code path never executed.","triggerScenarios":"Calling wait_for_signal with a timeout while the code under test never invokes the matching sync point (feature path not taken, env-gated sync-point disabled via RW_SYNC_POINT env, the operation completed before the wait started, or the wait timed out because the system is slow).","commonSituations":"Integration tests (e.g. barrier/pause tests in madsim or slow CI runners) that assume a code path fires; tests racing where the event happens before wait_for_signal starts; typos in the sync-point name string.","solutions":["Register the sync-point action and start waiting BEFORE triggering the operation that hits the sync point.","Verify the sync-point name string matches exactly the name used at the hit site.","Increase the timeout or confirm the code path is actually reachable (check RW_SYNC_POINT configuration / feature gating).","Check for deadlocks/upstream failures that prevent the sync point from ever executing."],"exampleFix":"// before: race — operation may finish before wait starts\nlet handle = tokio::spawn(do_work());\nsync_point::wait_for_signal(\"before-barrier\", Duration::from_secs(1)).await?;\n// after: wait first, then trigger\nsync_point::set_action(\"before-barrier\", action);\nlet handle = tokio::spawn(do_work());\nsync_point::wait_for_signal(\"before-barrier\", Duration::from_secs(30)).await?;","handlingStrategy":"try-catch","validationCode":"// Ensure sync-point is enabled and the name matches before waiting\nassert!(std::env::var(\"RW_SYNC_POINT\").is_ok(), \"sync-point not configured\");\n// Register the action before triggering the code path\nsync_point::set_action(\"before-barrier\", action);","typeGuard":null,"tryCatchPattern":"match sync_point::wait_for_signal(\"before-barrier\", Duration::from_secs(30)).await {\n    Ok(()) => {},\n    Err(sync_point::Error::WaitTimeout(name)) => {\n        eprintln!(\"sync point {name} never fired; check registration order and name\");\n    }\n}","preventionTips":["Always register actions and start waits before spawning the triggering work.","Centralize sync-point names as constants to avoid string mismatches.","Use generous timeouts on slow CI runners.","Assert the awaited code path is actually reachable in the test configuration."],"tags":["rust","testing","sync-point","timeout","async"],"backgroundTag":"request-timeout","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}