{"record":{"id":"2683a1f7883d3f8c","repo":"risingwavelabs/risingwave","slug":"time-went-backwards","errorCode":null,"errorMessage":"Time went backwards","messagePattern":"Time went backwards","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"src/connector/src/sink/snowflake_redshift/mod.rs","lineNumber":233,"sourceCode":"}\n\npub async fn build_opendal_writer_path(\n    s3_config: &S3Common,\n    operator: &Operator,\n    dir: Option<&str>,\n    target_table_name: &str,\n) -> Result<(opendal::Writer, String)> {\n    let mut base_path = s3_config.path.clone().unwrap_or(\"\".to_owned());\n    if !base_path.ends_with('/') {\n        base_path.push('/');\n    }\n    base_path.push_str(&format!(\"{}/\", target_table_name));\n    if let Some(dir) = dir {\n        base_path.push_str(&format!(\"{}/\", dir));\n    }\n    let create_time = SystemTime::now()\n        .duration_since(UNIX_EPOCH)\n        .expect(\"Time went backwards\");\n    let object_name = format!(\n        \"{}{}_{}.{}\",\n        base_path,\n        Uuid::new_v4(),\n        create_time.as_millis(),\n        \"json\",\n    );\n    let all_path = format!(\"s3://{}/{}\", s3_config.bucket_name, object_name);\n    Ok((\n        operator.writer_with(&object_name).concurrent(8).await?,\n        all_path,\n    ))\n}\n\n/// Generic JDBC writer for both Redshift and Snowflake sinks\npub struct SnowflakeRedshiftSinkJdbcWriter {\n    augmented_row: AugmentedChunk,\n    jdbc_sink_writer: CoordinatedRemoteSinkWriter,","sourceCodeStart":215,"sourceCodeEnd":251,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/connector/src/sink/snowflake_redshift/mod.rs#L215-L251","documentation":"When building the S3 object path for Snowflake/Redshift sink uploads, the code computes `SystemTime::now().duration_since(UNIX_EPOCH)` and panics with \"Time went backwards\" if the system clock is earlier than the Unix epoch. This is an expect() panic, not a recoverable error.","triggerScenarios":"`build_opendal_writer_path` is invoked (from `write_batch` or `write_manifest_to_s3`) while the host's wall clock is set before 1970-01-01.","commonSituations":"VMs resuming from suspend with a stale RTC; misconfigured NTP; containers without a proper clock; corrupted system time after reboot.","solutions":["Fix the host clock: run NTP sync (e.g. `chronyc makestep` or `systemctl restart chronyd`)","Verify the container/VM has a valid clock source and restart it if time is frozen","If the panic persists, replace the expect with a fallback (e.g. use 0 or an error) in build_opendal_writer_path"],"exampleFix":"// before\nlet create_time = SystemTime::now().duration_since(UNIX_EPOCH).expect(\"Time went backwards\");\n// after\nlet create_time = SystemTime::now().duration_since(UNIX_EPOCH).unwrap_or_default();","handlingStrategy":"validation","validationCode":"// before starting the sink process, verify host clock\nlet now = SystemTime::now().duration_since(UNIX_EPOCH);\nassert!(now.is_ok(), \"system clock is before Unix epoch; fix NTP before running sinks\");","typeGuard":"fn clock_is_sane() -> bool {\n    SystemTime::now().duration_since(UNIX_EPOCH).is_ok()\n}","tryCatchPattern":null,"preventionTips":["Run NTP/chrony on all hosts running RisingWave","Monitor system time in health checks","Avoid suspending VMs hosting the sink without clock resync"],"tags":["rust","risingwave","sink","clock","s3"],"backgroundTag":"invalid-argument-value","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}