Repository navigation
c-abi: thread_stack_size(2 MiB) is a cap, not a floor — it shrinks workers when RUST_MIN_STACK is larger (#328) - #329
Merged
Merged
Conversation
…rkers when RUST_MIN_STACK is larger (#328) Signed-off-by: peco-engineer-bot[bot] <3815206+peco-engineer-bot[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Verdict: 1 Nit
Looks good — correct floor-not-cap fix with matching red→green unit coverage. c_abi_runtime_thread_stack_size (ambient.unwrap_or(0).max(2 MiB)) preserves a larger RUST_MIN_STACK while still clamping small/unset values up to 2 MiB, and the existing subprocess test (RUST_MIN_STACK=16384) remains valid. One nit about a now-slightly-misleading pre-existing test name, noted inline.
Other findings
- ⚪ Nit — The pre-existing test
c_abi_runtime_ignores_ambient_rust_min_stackis now a slight misnomer: the runtime no longer ignoresRUST_MIN_STACK, it treats 2 MiB as a floor and honors larger ambient values. The test itself still probes correct behavior (16384 < floor → clamps up), so it's valid; only the name/docstring reads as if the ambient value is always disregarded. Consider renaming to something likec_abi_runtime_clamps_small_rust_min_stack_up_to_floorfor consistency with the new helper tests. Nit only.
vikrantpuppala
enabled auto-merge
September 9, 2026 10:30
|
Kernel integration tests triggered. View status. Results post back here as the "Kernel Integration Tests" check. |
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Automated fix for #328 — c-abi: thread_stack_size(2 MiB) is a cap, not a floor — it shrinks workers when RUST_MIN_STACK is larger.
The C-ABI runtime now resolves worker stack size as max(ambient RUST_MIN_STACK, 2 MiB) via the pure helper c_abi_runtime_thread_stack_size, so 2 MiB is a floor rather than a cap: a host asking for more than 2 MiB (e.g. the partner's 3194880) keeps its larger stack instead of being shrunk, while a too-small or unset RUST_MIN_STACK still clamps up to 2 MiB (preserving #326). Both unit tests pass and fmt/clippy are clean. This is an offline-only fix (client-side stack-size arithmetic anchored in the issue's stated expectation), which cannot be observed via a live-server round-trip, so unit coverage over the extracted helper is the appropriate red→green evidence.
Root cause & plan
Root cause: In
src/c_abi/mod.rs, the C-ABI Tokio runtime is built with.thread_stack_size(C_ABI_RUNTIME_THREAD_STACK_SIZE)where the constant is a fixed 2 MiB.thread_stack_sizeis an ABSOLUTE value and makes the underlying std thread builder ignoreRUST_MIN_STACKentirely, so a host whose ambientRUST_MIN_STACKexceeds 2 MiB (e.g. the databricks-odbc partner at 3194880) has its kernel-c-abi worker stacks SHRUNK to 2 MiB — the opposite of #326's stated intent to prevent a smallRUST_MIN_STACKfrom shrinking workers. 2 MiB must act as a floor, not a cap: the effective size should be max(ambient RUST_MIN_STACK, 2 MiB).Files:
src/c_abi/mod.rsPlanned coverage:
Files changed
src/c_abi/mod.rsTest plan
c_abi::tests::c_abi_runtime_stack_size_preserves_larger_rust_min_stack— fails (red) against the original code, passes (green) after the fixc_abi::tests::c_abi_runtime_stack_size_clamps_small_rust_min_stack_up_to_floor— fails (red) against the original code, passes (green) after the fix🤖 Generated by engineer-bot (bug-fix flow) — review before merge.