Skip to content

[CI] Add semaphore isolation helper to avoid hangs#2308

Merged
mhalk merged 1 commit into
ROCm:aomp-devfrom
mhalk:amd/dev/mhalkenh/fix/ci-smoke-semaphore-hang
Jul 1, 2026
Merged

[CI] Add semaphore isolation helper to avoid hangs#2308
mhalk merged 1 commit into
ROCm:aomp-devfrom
mhalk:amd/dev/mhalkenh/fix/ci-smoke-semaphore-hang

Conversation

@mhalk

@mhalk mhalk commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Motivation

Observed hangs during smoke suite on CI machine (with hostname being all uppercase letters).
Traced issue to stale semaphores created by previous run's parallel invocation.
Probable cause could be a reboot of the machine during run or TERM / KILL of corresponding process(es).

Technical Details

Semaphores including hostnames, which in turn include uppercase letters, are not reaped correctly.
Stale semaphores can block indefinitely, until cleaned (e.g. manually).

Approach avoids hanging of CI runs by:

  • isolating semaphores per test run
  • stealing semaphores after timeout (default: 30m)

Very recent parallel versions 20260522 and newer handle this case by converting hostname to lowercase:
https://cgit.git.savannah.gnu.org/cgit/parallel.git/tree/src/parallel?h=20260522#n7565

Test Plan

Ran corresponding CI script for smoke tests.

Test Result

No hangs observed, no stealing (since nothing was aborted).
Run completed successfully.

Submission Checklist

@Kewen12 Kewen12 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

do we need to apply this to other scripts?

@Kewen12

Kewen12 commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

The lint seems failed due to double quote.

@estewart08

Copy link
Copy Markdown
Collaborator

do we need to apply this to other scripts?

I think this is the only spot needed. The other check_* scripts should symlink to test/smoke/check_smoke.sh.

@mhalk

mhalk commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks for the feedback and clarification!
(IIRC there's one exception to the symlinks, which is not changed by this PR: check_smoke_fails.sh)

FYI in coordination with JP: I'll open a NFC(I) PR which fixes the shellcheck issues of check_smoke.sh, once that's landed the plan is to rebase and land this PR.

Comment thread bin/semaphore_isolation.src
@mhalk mhalk force-pushed the amd/dev/mhalkenh/fix/ci-smoke-semaphore-hang branch from 34cdb90 to 34d68fb Compare July 1, 2026 12:11
Fix possible stale semaphores during parallel runs
 - isolate semaphores per test run
 - steal semaphore after timeout

Issue:
Semaphores including hostnames, which in turn include uppercase
letters, are not reaped correctly. This lead to hangs of CI runs.

Very recent parallel versions 20260522 and newer handle this case
by converting hostname to lowercase:
https://cgit.git.savannah.gnu.org/cgit/parallel.git/tree/src/parallel?h=20260522#n7565
@mhalk mhalk force-pushed the amd/dev/mhalkenh/fix/ci-smoke-semaphore-hang branch from 34d68fb to 3aab18f Compare July 1, 2026 12:20
@mhalk mhalk merged commit 5d338cf into ROCm:aomp-dev Jul 1, 2026
1 check passed
@mhalk mhalk deleted the amd/dev/mhalkenh/fix/ci-smoke-semaphore-hang branch July 1, 2026 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants