diff --git a/NEXT_CHANGELOG.md b/NEXT_CHANGELOG.md index 28a2d4ab..d4f1aadb 100644 --- a/NEXT_CHANGELOG.md +++ b/NEXT_CHANGELOG.md @@ -11,6 +11,24 @@ changes go in their respective binding's NEXT_CHANGELOG. ### Added +- C ABI: `kernel_session_config_set_retry_config()` — expose the crate's existing + HTTP retry knobs (`HttpConfig::retry_min_wait` / `retry_max_wait` / + `retry_max_retries` / `overall_timeout`) over the C ABI so a host can make its own + `RetryWaitMin` / `RetryWaitMax` / `RetryMax` / retry-budget policy authoritative + instead of the kernel default; `max_retries=0` disables retries, and + `overall_timeout_ms=0` keeps the kernel's default budget (non-zero overrides it). + The retry budget is always bounded — a large `max_retries` is still capped by it. + Benefits ODBC too. (Consumed by the Go driver via `WithRetries`, + databricks/databricks-sql-go#412.) +- C ABI: client-only `session_conf` key `cloudfetch_max_chunks_in_memory` — carried + by the existing `kernel_session_config_set_session_conf()` setter (no new symbol), + it bounds how many decompressed CloudFetch chunks the kernel holds in memory at + once (peak RSS on large result sets; default 16). Accepts a positive integer; + a value above the kernel ceiling (256) is clamped, and a non-numeric / non-positive + value is ignored (default preserved) with a warning rather than failing session + creation. The key is client-only — it is consumed before session creation and never + reaches the SEA wire. Benefits ODBC too. + ### Updated ### Fixed diff --git a/include/databricks_kernel.h b/include/databricks_kernel.h index cf42e4e6..c235cd14 100644 --- a/include/databricks_kernel.h +++ b/include/databricks_kernel.h @@ -249,7 +249,17 @@ KernelStatusCode kernel_session_config_set_auth_u2m(KernelSessionConfig* config, uint16_t redirect_port, const char* scopes); -/* Add (or overwrite) one server-bound session-conf entry. */ +/* Add (or overwrite) one session-conf entry. Keys are normally server SET + * parameters forwarded on the SEA wire (allowlist-filtered). A small set of + * reserved keys are instead CLIENT-ONLY: they tune the kernel locally, are + * consumed before session creation, and NEVER reach the wire. Client-only keys + * (matched case-insensitively): + * + * cloudfetch_max_chunks_in_memory — positive integer; how many decompressed + * CloudFetch chunks the kernel holds in memory at once (bounds peak RSS on + * large result sets; default 16). A value above the kernel ceiling (256) is + * clamped; a non-numeric / non-positive value is ignored (default kept) with + * a warning — a bad tuning value never fails session open. */ KernelStatusCode kernel_session_config_set_session_conf(KernelSessionConfig* config, const char* key, const char* value); @@ -303,6 +313,31 @@ KernelStatusCode kernel_session_config_set_tls_allow_self_signed(KernelSessionCo KernelStatusCode kernel_session_config_set_tls_skip_hostname_verification(KernelSessionConfig* config, bool skip); +/* Configure the HTTP retry / backoff policy. `min_wait_ms` / `max_wait_ms` + * are the backoff-wait bounds between attempts (the wait is exponential + * with jitter, clamped to this range); `max_retries` is the number of + * retries AFTER the initial attempt (so at most `max_retries + 1` total + * attempts, and `0` disables retries); `overall_timeout_ms` is the cumulative + * retry budget across all attempts (`0` keeps the kernel default — pass + * non-zero to override it). Lets a host's RetryWaitMin / RetryWaitMax / + * RetryMax / retry-timeout surface override the kernel's built-in policy + * (default 5 retries, 1s..60s, 900s budget) when this setter is not called. + * + * The retry budget is ALWAYS bounded — there is no "unlimited" value. A large + * `max_retries` is still capped by the (default or overridden) budget: if the + * exponential backoff sums past `overall_timeout_ms` the remaining attempts do + * not run, so raise `overall_timeout_ms` alongside a large `max_retries` if you + * want them all to fire. A non-zero `overall_timeout_ms` smaller than + * `min_wait_ms` guarantees ZERO retries (the first backoff already exceeds the + * budget); it is accepted but the kernel logs a warning. + * + * `min_wait_ms == 0` or `max_wait_ms < min_wait_ms` returns InvalidArgument. + * Benefits ODBC too. */ +KernelStatusCode kernel_session_config_set_retry_config(KernelSessionConfig* config, + uint64_t min_wait_ms, uint64_t max_wait_ms, + uint32_t max_retries, + uint64_t overall_timeout_ms); + /* ─── Session lifecycle ───────────────────────────────────────────────*/ /* diff --git a/src/c_abi/session.rs b/src/c_abi/session.rs index 24a18ef1..573bbf29 100644 --- a/src/c_abi/session.rs +++ b/src/c_abi/session.rs @@ -28,6 +28,7 @@ use crate::kernel_error::Error; use crate::session::Session; use std::collections::HashMap; use std::ffi::{c_char, CStr}; +use std::time::Duration; /// Opaque session handle. Boxed [`Session`] on the Rust side. #[repr(C)] @@ -95,6 +96,12 @@ pub struct KernelSessionConfig { /// Extra HTTP headers sent on every request (accumulated by /// `..._set_custom_header`, one `(name, value)` pair per call). custom_headers: Vec<(String, String)>, + /// HTTP retry / backoff knobs (populated by `..._set_retry_config`). + /// `None` keeps the kernel default policy (exponential backoff with + /// jitter; see [`HttpConfig::default`] for the concrete values); `Some` + /// lets a host make its own backoff/attempt policy authoritative (a + /// JDBC-style `RetryWaitMin` / `RetryWaitMax` / `RetryMax` surface). + retry: Option, } /// C-side proxy config captured from `kernel_session_config_set_proxy`. @@ -105,6 +112,19 @@ struct ProxySpec { bypass_hosts: Option, } +/// C-side HTTP retry config captured from +/// `kernel_session_config_set_retry_config`. The JDBC-style backoff/attempt +/// knobs a host tunes, plus the cumulative retry budget (`overall_timeout`); +/// every other `HttpConfig` field (per-request timeout, pool size) keeps its +/// default when a retry spec is set. `overall_timeout` is `None` when the host +/// left it 0, so [`HttpConfig::default`]'s budget is preserved. +struct RetrySpec { + min_wait: Duration, + max_wait: Duration, + max_retries: u32, + overall_timeout: Option, +} + /// C-side TLS config captured from the `..._set_tls_*` setters. #[derive(Default)] struct TlsSpec { @@ -156,6 +176,7 @@ pub unsafe extern "C" fn kernel_session_config_new( proxy: None, tls: TlsSpec::default(), custom_headers: Vec::new(), + retry: None, }); std::ptr::write(out, Box::into_raw(config)); KernelStatusCode::Success @@ -319,6 +340,85 @@ pub unsafe extern "C" fn kernel_session_config_set_custom_header( }) } +/// Configure the HTTP retry / backoff policy: the minimum and maximum +/// backoff wait between attempts (milliseconds), the maximum number of +/// retries after the initial attempt (so a request is tried at most +/// `max_retries + 1` times), and the cumulative retry budget +/// (`overall_timeout_ms`) across all attempts. Lets a host make its own +/// `RetryWaitMin` / `RetryWaitMax` / `RetryMax` / retry-timeout surface +/// authoritative instead of the kernel's built-in default policy (see +/// [`HttpConfig::default`] for the values that apply when this setter is not +/// called). `max_retries == 0` disables retries (single attempt); the backoff +/// between attempts is still exponential with jitter, clamped to +/// `[min_wait_ms, max_wait_ms]`. +/// +/// `overall_timeout_ms == 0` keeps the kernel's default budget — pass a +/// non-zero value to override it (matching the pyo3/napi `retry_overall_timeout` +/// knob). There is no sentinel for "no budget": the retry budget is *always* +/// bounded, so a large `max_retries` is still capped by the (default or +/// overridden) budget. If exponential backoff sums past the budget before +/// `max_retries` is reached, the remaining attempts do not run — raise +/// `overall_timeout_ms` alongside a large `max_retries` if you want them all to +/// fire. In particular a non-zero `overall_timeout_ms` smaller than +/// `min_wait_ms` guarantees zero retries (the first backoff already exceeds the +/// budget); this is accepted but logged at `warn`. +/// +/// `min_wait_ms == 0` and `max_wait_ms < min_wait_ms` are rejected as +/// `InvalidArgument`. Maps to `HttpConfig::retry_min_wait` / +/// `retry_max_wait` / `retry_max_retries` / `overall_timeout`. +/// +/// # Safety +/// `config` must be a live config handle. +#[no_mangle] +pub unsafe extern "C" fn kernel_session_config_set_retry_config( + config: *mut KernelSessionConfig, + min_wait_ms: u64, + max_wait_ms: u64, + max_retries: u32, + overall_timeout_ms: u64, +) -> KernelStatusCode { + set_on_config(config, |c| { + if min_wait_ms == 0 { + return Err(Error::invalid_argument().message("retry min_wait_ms must be > 0")); + } + if max_wait_ms < min_wait_ms { + return Err( + Error::invalid_argument().message("retry max_wait_ms must be >= min_wait_ms") + ); + } + // A non-zero budget below the first backoff wait guarantees zero + // retries (the client stops before the first sleep — src/client/http.rs). + // Accept it (the single attempt is still coherent, and a valid-looking + // config must not hard-fail a host's connect) but warn: the host has + // asked for retries that can never fire. + if overall_timeout_ms != 0 && overall_timeout_ms < min_wait_ms { + crate::klog::warn!( + overall_timeout_ms, + min_wait_ms, + max_retries, + "retry overall_timeout_ms is below min_wait_ms; the retry budget is \ + exhausted before the first backoff, so no retries will run", + ); + } + c.retry = Some(RetrySpec { + min_wait: Duration::from_millis(min_wait_ms), + max_wait: Duration::from_millis(max_wait_ms), + // Clamp to `u32::MAX - 1` so the HTTP client's `max_retries + 1` + // total-attempts computation (src/client/http.rs) can never + // overflow — a debug build would panic and a release build would + // wrap to 0, silently disabling all retries. This matches the + // effective ceiling the napi/pyo3 bindings already enforce (they + // derive the field via `saturating_sub(1)`); the C ABI is the only + // path that could otherwise hand the client an unclamped u32. + max_retries: max_retries.min(u32::MAX - 1), + // 0 => keep the kernel default budget; any non-zero value overrides it. + overall_timeout: (overall_timeout_ms != 0) + .then(|| Duration::from_millis(overall_timeout_ms)), + }); + Ok(()) + }) +} + /// Initialize kernel logging, **process-wide and once**. `level` is one /// of "OFF"/"ERROR"/"WARN"/"INFO"/"DEBUG"/"TRACE" (NULL ⇒ honour /// `RUST_LOG`, default `warn`); `file_path` is a log file (NULL ⇒ stderr). @@ -579,6 +679,36 @@ fn parse_scopes(s: &str) -> Option> { (!v.is_empty()).then_some(v) } +/// Fold the C-side custom headers and optional [`RetrySpec`] onto a fresh +/// [`HttpConfig`]. Both live on `HttpConfig`, so we start from defaults and set +/// only the fields a setter populated — every other HTTP default (per-request +/// timeout, pool size, and the retry knobs when no `RetrySpec` was set) is +/// preserved. +/// +/// This is the code that actually configures live retries (called from +/// `build_session` whenever headers or a retry spec were set), so it is a pure +/// helper kept unit-testable without a live session. +fn merge_http_config( + custom_headers: Vec<(String, String)>, + retry: Option, +) -> HttpConfig { + let mut http = HttpConfig { + custom_headers, + ..HttpConfig::default() + }; + if let Some(r) = retry { + http.retry_min_wait = r.min_wait; + http.retry_max_wait = r.max_wait; + http.retry_max_retries = r.max_retries; + // Only override the cumulative budget when the host set it; otherwise + // HttpConfig::default()'s budget is preserved. + if let Some(t) = r.overall_timeout { + http.overall_timeout = t; + } + } + http +} + /// Translate the C-side config into a [`Session`], driving the async /// `Session::open` on the process-wide runtime. Errors are stored in the /// thread-local buffer; the returned `KernelStatusCode` is the mapped @@ -591,6 +721,7 @@ fn build_session(config: KernelSessionConfig) -> Result Result Result { + pub async fn open(mut config: SessionConfig) -> Result { // Fetch the runtime handle up-front so a misconfigured // caller (e.g. running outside a tokio context) gets a clear // error instead of a panic deep in the transport setup. @@ -227,6 +227,12 @@ impl Session { )) })?; + // Fold client-only result knobs (e.g. cloudfetch_max_chunks_in_memory) + // carried in session_conf into the typed ResultConfig and strip them + // from session_conf, before either the reader factory reads + // config.result (below) or filter_session_conf runs on the wire body. + apply_client_result_overrides(&mut config); + let host = config.connection.host.clone(); let warehouse_id = config.connection.warehouse_id.clone(); let org_id = config.connection.org_id.clone(); @@ -785,6 +791,104 @@ fn build_retry_configs_for_session( build_retry_configs(&global, &overrides) } +/// Client-only `session_conf` key that tunes how many decompressed +/// CloudFetch chunks the kernel holds in memory at once (peak RSS on +/// large result sets). It is a **client** knob, not a server SET +/// parameter: it is read by [`apply_client_result_overrides`] before +/// session creation and is deliberately absent from +/// [`SESSION_CONF_ALLOWLIST`](crate::config), so `filter_session_conf` +/// drops it and it never reaches the SEA wire. Exposed this way (rather +/// than as a new C-ABI symbol) so the Go/ODBC consumers can set it +/// through the existing `set_session_conf` entry point. +pub(crate) const CLIENT_CONF_CLOUDFETCH_MAX_CHUNKS: &str = "cloudfetch_max_chunks_in_memory"; + +/// Upper bound applied to a host-supplied +/// [`CLIENT_CONF_CLOUDFETCH_MAX_CHUNKS`] value. Peak RSS grows roughly +/// linearly with this knob (each in-memory chunk is tens of MB), so an +/// unbounded value — a typo like `"1000000"` meant as `"100"`, or a host bug — +/// risks OOM on large result sets. This ceiling (16× the default of 16, and 8× +/// the most aggressive value we've measured) is comfortably above any real +/// tuning yet bounds the blast radius of a fat-fingered value; a request above +/// it is clamped with a `warn!`, mirroring the retry setter's clamp discipline. +pub(crate) const CLOUDFETCH_MAX_CHUNKS_CEILING: usize = 256; + +/// Fold client-only result-management knobs carried in `session_conf` +/// into the typed [`ResultConfig`], then remove them from `session_conf` +/// so they cannot leak onto the SEA wire. +/// +/// Today this handles only [`CLIENT_CONF_CLOUDFETCH_MAX_CHUNKS`]. A key +/// that is absent leaves the field at its `ResultConfig` default (16); a +/// present-but-unparseable or zero value is ignored (default preserved) +/// with a warning rather than failing session creation — a +/// best-effort tuning knob should never turn a typo into a connect +/// error. A value above [`CLOUDFETCH_MAX_CHUNKS_CEILING`] is clamped to +/// that ceiling (with a warning) so a fat-fingered value can't drive peak +/// RSS toward OOM. Matched case-insensitively, consistent with the rest of +/// the `session_conf` handling; if a host sets two spellings that differ only +/// in case the lexicographically-last one wins deterministically (and all +/// variants are stripped). +fn apply_client_result_overrides(config: &mut SessionConfig) { + // Collect EVERY case-insensitive spelling of the key, not just the first + // one `HashMap` iteration happens to yield. Two variants that differ only + // in case (e.g. `cloudfetch_max_chunks_in_memory` and + // `CloudFetch_Max_Chunks_In_Memory`) would otherwise resolve + // nondeterministically across runs. We sort the matches and let the + // lexicographically-last spelling win — a stable, run-independent rule — + // and remove all of them regardless of parse outcome, so no client-only + // key survives into `filter_session_conf` / the wire. + let mut keys: Vec = config + .session_conf + .keys() + .filter(|k| k.eq_ignore_ascii_case(CLIENT_CONF_CLOUDFETCH_MAX_CHUNKS)) + .cloned() + .collect(); + if keys.is_empty() { + return; + } + keys.sort_unstable(); + if keys.len() > 1 { + crate::klog::warn!( + variants = keys.len(), + "multiple case-variant cloudfetch_max_chunks_in_memory keys set; \ + applying the lexicographically-last spelling deterministically", + ); + } + // Remove every variant; the winner's value drives the override. + let mut raw = String::new(); + for k in &keys { + if let Some(v) = config.session_conf.remove(k) { + raw = v; + } + } + match raw.trim().parse::() { + Ok(n) if n > 0 => { + // Clamp to a sane ceiling: peak RSS scales with this knob, so an + // absurd value (typo / host bug) would otherwise risk OOM. + let clamped = n.min(CLOUDFETCH_MAX_CHUNKS_CEILING); + if clamped != n { + crate::klog::warn!( + requested = n, + ceiling = CLOUDFETCH_MAX_CHUNKS_CEILING, + "clamping cloudfetch_max_chunks_in_memory to the ceiling \ + (peak RSS scales with this knob)", + ); + } + config.result.cloudfetch_max_chunks_in_memory = clamped; + crate::klog::debug!( + max_chunks_in_memory = clamped, + "applied client cloudfetch_max_chunks_in_memory override", + ); + } + _ => { + crate::klog::warn!( + value = %raw, + "ignoring invalid cloudfetch_max_chunks_in_memory (want a positive integer); \ + keeping the default", + ); + } + } +} + /// Project the public [`ResultConfig`] (today only carries /// CloudFetch knobs; future result-management options slot in here /// too) onto the internal `CloudFetchConfig`. @@ -1008,6 +1112,165 @@ mod retry_config_tests { let hcc = build_http_client_config(&config_with_http(http), None); assert_eq!(hcc.read_timeout, Duration::from_millis(4500)); } + + // ─── Client result-config override (cloudfetch_max_chunks_in_memory) ─── + + /// Build a minimal config carrying the given session_conf, for + /// exercising `apply_client_result_overrides` in isolation. + fn config_with_session_conf(conf: HashMap) -> SessionConfig { + let mut cfg = config_with_http(HttpConfig::default()); + cfg.session_conf = conf; + cfg + } + + /// A valid positive value folds into ResultConfig and the key is + /// stripped from session_conf so it can never reach the SEA wire. + #[test] + fn cloudfetch_max_chunks_override_applies_and_is_stripped() { + let mut cfg = config_with_session_conf(HashMap::from([( + CLIENT_CONF_CLOUDFETCH_MAX_CHUNKS.to_string(), + "4".to_string(), + )])); + apply_client_result_overrides(&mut cfg); + assert_eq!(cfg.result.cloudfetch_max_chunks_in_memory, 4); + assert!( + cfg.session_conf.is_empty(), + "client knob must be removed from session_conf, got {:?}", + cfg.session_conf + ); + } + + /// The key is matched case-insensitively, like the rest of the + /// session_conf handling, and still stripped. + #[test] + fn cloudfetch_max_chunks_override_is_case_insensitive() { + let mut cfg = config_with_session_conf(HashMap::from([( + "CloudFetch_Max_Chunks_In_Memory".to_string(), + "8".to_string(), + )])); + apply_client_result_overrides(&mut cfg); + assert_eq!(cfg.result.cloudfetch_max_chunks_in_memory, 8); + assert!(cfg.session_conf.is_empty()); + } + + /// Two spellings differing only in case resolve deterministically to the + /// lexicographically-last one (not whichever HashMap iteration yields + /// first), every variant is stripped, and an unrelated server key survives + /// untouched. Guards against both the nondeterministic-winner bug and an + /// over-broad removal that would wipe legitimate server SET params. + #[test] + fn cloudfetch_max_chunks_duplicate_case_variants_are_deterministic() { + // "cloudfetch_..." (lowercase 'c') sorts after "CloudFetch_..." + // (uppercase 'C') in ASCII, so the lowercase spelling's value (200) + // wins regardless of insertion order; 200 clamps to the ceiling. + let mut cfg = config_with_session_conf(HashMap::from([ + ( + "CloudFetch_Max_Chunks_In_Memory".to_string(), + "8".to_string(), + ), + ( + "cloudfetch_max_chunks_in_memory".to_string(), + "200".to_string(), + ), + // A benign, allowlisted server param that must NOT be removed. + ("ansi_mode".to_string(), "true".to_string()), + ])); + apply_client_result_overrides(&mut cfg); + assert_eq!( + cfg.result.cloudfetch_max_chunks_in_memory, 200, + "the lexicographically-last case variant must win deterministically" + ); + assert!( + !cfg.session_conf + .keys() + .any(|k| k.eq_ignore_ascii_case(CLIENT_CONF_CLOUDFETCH_MAX_CHUNKS)), + "every case variant of the client knob must be stripped, got {:?}", + cfg.session_conf + ); + assert_eq!( + cfg.session_conf.get("ansi_mode").map(String::as_str), + Some("true"), + "an unrelated server param must survive untouched, got {:?}", + cfg.session_conf + ); + } + + /// Absent key ⇒ the ResultConfig default (16) is preserved. + #[test] + fn cloudfetch_max_chunks_absent_keeps_default() { + let mut cfg = config_with_session_conf(HashMap::new()); + apply_client_result_overrides(&mut cfg); + assert_eq!( + cfg.result.cloudfetch_max_chunks_in_memory, + ResultConfig::default().cloudfetch_max_chunks_in_memory + ); + } + + /// A non-numeric or zero value is ignored (default preserved, no + /// connect error) but still stripped from session_conf. + #[test] + fn cloudfetch_max_chunks_invalid_is_ignored_but_stripped() { + for bad in ["0", "-1", "abc", ""] { + let mut cfg = config_with_session_conf(HashMap::from([( + CLIENT_CONF_CLOUDFETCH_MAX_CHUNKS.to_string(), + bad.to_string(), + )])); + apply_client_result_overrides(&mut cfg); + assert_eq!( + cfg.result.cloudfetch_max_chunks_in_memory, 16, + "value {bad:?} should keep the default", + ); + assert!( + cfg.session_conf.is_empty(), + "value {bad:?} should still be stripped", + ); + } + } + + /// A value above the ceiling is clamped (not rejected) so a fat-fingered + /// value can't drive peak RSS toward OOM; the just-at-ceiling value passes + /// through unclamped. Both are still stripped from session_conf. + #[test] + fn cloudfetch_max_chunks_above_ceiling_is_clamped() { + // Well above the ceiling → clamped down. + let mut cfg = config_with_session_conf(HashMap::from([( + CLIENT_CONF_CLOUDFETCH_MAX_CHUNKS.to_string(), + "1000000".to_string(), + )])); + apply_client_result_overrides(&mut cfg); + assert_eq!( + cfg.result.cloudfetch_max_chunks_in_memory, CLOUDFETCH_MAX_CHUNKS_CEILING, + "an absurd value must clamp to the ceiling" + ); + assert!(cfg.session_conf.is_empty()); + + // Exactly at the ceiling → unchanged (boundary is inclusive). + let mut cfg = config_with_session_conf(HashMap::from([( + CLIENT_CONF_CLOUDFETCH_MAX_CHUNKS.to_string(), + CLOUDFETCH_MAX_CHUNKS_CEILING.to_string(), + )])); + apply_client_result_overrides(&mut cfg); + assert_eq!( + cfg.result.cloudfetch_max_chunks_in_memory, + CLOUDFETCH_MAX_CHUNKS_CEILING, + ); + } + + /// The client knob is NOT in the server allowlist, so even if it were + /// left in session_conf it would be filtered before the wire. This + /// pins that invariant so a future allowlist edit can't accidentally + /// promote it to a server SET parameter. + #[test] + fn cloudfetch_max_chunks_key_is_not_server_allowlisted() { + let filtered = crate::config::filter_session_conf(HashMap::from([( + CLIENT_CONF_CLOUDFETCH_MAX_CHUNKS.to_string(), + "4".to_string(), + )])); + assert!( + filtered.is_empty(), + "client knob must not survive the server allowlist, got {filtered:?}", + ); + } } #[cfg(test)] diff --git a/tests/c/session_smoke.c b/tests/c/session_smoke.c index 1b721723..fbb87540 100644 --- a/tests/c/session_smoke.c +++ b/tests/c/session_smoke.c @@ -164,6 +164,19 @@ static void test_proxy_and_tls_setters(void) { CHECK(rc == KernelStatusCode_Success, "set_tls_allow_self_signed succeeds"); rc = kernel_session_config_set_tls_skip_hostname_verification(config, true); CHECK(rc == KernelStatusCode_Success, "set_tls_skip_hostname_verification succeeds"); + + /* Retry config: a valid range (incl. max_retries=0 to disable, overall + * timeout 0 = keep default) succeeds; a non-zero overall timeout also + * succeeds; a zero min_wait or an inverted range is rejected. */ + rc = kernel_session_config_set_retry_config(config, 500, 30000, 0, 0); + CHECK(rc == KernelStatusCode_Success, "set_retry_config (valid, disable, default budget) succeeds"); + rc = kernel_session_config_set_retry_config(config, 500, 30000, 3, 120000); + CHECK(rc == KernelStatusCode_Success, "set_retry_config (valid, overall_timeout=120s) succeeds"); + rc = kernel_session_config_set_retry_config(config, 0, 1000, 3, 0); + CHECK(rc == KernelStatusCode_InvalidArgument, "set_retry_config(min=0) → InvalidArgument"); + rc = kernel_session_config_set_retry_config(config, 5000, 1000, 3, 0); + CHECK(rc == KernelStatusCode_InvalidArgument, "set_retry_config(max