Skip to content

fix: wait_for_termination returns actual exit status - #1265

Open
sweb wants to merge 3 commits into
mainfrom
fix/wait-for-term-exit-code
Open

fix: wait_for_termination returns actual exit status#1265
sweb wants to merge 3 commits into
mainfrom
fix/wait-for-term-exit-code

Conversation

@sweb

@sweb sweb commented Aug 21, 2026

Copy link
Copy Markdown
Member

Description

since set -e is the last part of wait_for_termination it always has exit code 0. With this, it returns the exit code of the process it is waiting for instead. [ "${term_child_pid}" ] blows up when the child pid is not set yet, so gets changed to [ -n "${term_child_pid:-}" ].

Definition of Done Checklist

  • Not all of these items are applicable to all PRs, the author should update this template to only leave the boxes in that are relevant
  • Please make sure all these things are done and tick the boxes

Author

  • Changes are OpenShift compatible
  • CRD changes approved
  • CRD documentation for all fields, following the style guide.
  • Integration tests passed (for non trivial changes)
  • Changes need to be "offline" compatible

Reviewer

  • Code contains useful comments
  • Code contains useful logging statements
  • (Integration-)Test cases added
  • Documentation added or updated. Follows the style guide.
  • Changelog updated
  • Cargo.toml only contains references to git tags (not specific commits or branches)

Acceptance

  • Feature Tracker has been updated
  • Proper release label has been added

@sweb
sweb force-pushed the fix/wait-for-term-exit-code branch from 84f3d65 to 399c93f Compare August 21, 2026 11:42
@sweb
sweb force-pushed the fix/wait-for-term-exit-code branch from dd6cb82 to 4e5b186 Compare August 21, 2026 12:27
@sweb sweb moved this to Development: Waiting for Review in Stackable Engineering Aug 21, 2026
@lfrancke

Copy link
Copy Markdown
Member

Ah...we just had the same/similar in stackabletech/stackable-utils#130

It's an annoying trap.

@sweb

sweb commented Aug 21, 2026

Copy link
Copy Markdown
Member Author

Ah...we just had the same/similar in stackabletech/stackable-utils#130

It's an annoying trap.

in this context, it is not a huge deal - from what I checked it does not interfere with OOM based restarts or something like that - but getting the actual exit codes may be nice and should be an improvement.

@maltesander
maltesander self-requested a review September 1, 2026 13:04
@maltesander maltesander moved this from Development: Waiting for Review to Development: In Review in Stackable Engineering Sep 1, 2026

@maltesander maltesander left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of things. Almost all downstream products require changes:

Will abort under set -e with non-zero code, neither create_vector_shutdown_file_command or other lines after that will be executed (e.g. the vector shutdown file etc.). So || product_exit_code=$? should be added and rolled out with an operator-rs release properly?

And i think a similar problem for git-sync containers


It could make sense to stop that test script duplication (i think its in over 10 places) and e.g. use insta (already in the repo) as dev/test dependency? Something like:

insta::assert_snapshot!(
    serde_yaml::to_string(&git_sync_resources.git_sync_containers.first()).unwrap()
);

term_child_status=$?
trap - TERM
wait ${term_child_pid} 2>/dev/null
if [ "${term_child_status}" -gt 128 ]; then

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a flag / comment for the 128?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed here: f3a4fee

still looking into insta.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Development: In Review

Development

Successfully merging this pull request may close these issues.

3 participants