Skip to content

pm/hydra: clean up pending PMI2 requests on client exit - #8085

Merged
hzhou merged 2 commits into
pmodels:mainfrom
Johnny-Kao:fix/hydra-pmi2-pending-request-disconnect
Nov 9, 2026
Merged

hzhou merged 2 commits into
pmodels:mainfrom
Johnny-Kao:fix/hydra-pmi2-pending-request-disconnect

Conversation

@Johnny-Kao

Copy link
Copy Markdown
Contributor

Pull Request Description

If a process exits while waiting for a PMI2 node attribute, Hydra can leave the request queued. When another process sets that attribute, Hydra may try to reply through the closed socket and fail.

Remove pending requests when the client disconnects, without affecting other waiters. Added a PMI2 fault test for this case.

The build and targeted PMI tests passed in GitHub Actions.

ChatGPT helped investigate the issue and prepare the patch and tests. I reviewed the changes and validation results.

Author Checklist

  • Provide Description
    Particularly focus on why, not what. Reference background, issues, test failures, xfail entries, etc.
  • Commits Follow Good Practice
    Commits are self-contained and do not do two things at once.
    Commit message is of the form: module: short description
    Commit message explains what's in the commit.
  • Passes All Tests
    Whitespace checker. Warnings test. Additional tests via comments.
  • Contribution Agreement
    For non-Argonne authors, check contribution agreement.
    If necessary, request an explicit comment from your companies PR approval manager.

@Johnny-Kao
Johnny-Kao force-pushed the fix/hydra-pmi2-pending-request-disconnect branch from 6a4dded to 6ff8e86 Compare November 1, 2026 14:21
@Johnny-Kao

Johnny-Kao commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor Author

I've sent my signed Individual Contributor License Agreement to the MPICH CLA email address.
Please let me know if anything else is needed. Thanks!

@hzhou

hzhou commented Nov 1, 2026

Copy link
Copy Markdown
Collaborator

I've sent my signed Individual Contributor License Agreement to the MPICH CLA email address. Please let me know if anything else is needed. Thanks!

Yes, we received your CLA. Thank you!

@Johnny-Kao
Johnny-Kao marked this pull request as ready for review November 1, 2026 14:59

@hzhou hzhou left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The PR looks good. Just some comments on improving the error messages when the test fails.

Comment thread test/mpi/impls/pmi/test_pmi2_nodeattr.c Resolved
Comment thread test/mpi/impls/pmi/test_pmi2_nodeattr.c Resolved
Comment thread test/mpi/impls/pmi/test_pmi2_nodeattr.c Resolved
@Johnny-Kao
Johnny-Kao force-pushed the fix/hydra-pmi2-pending-request-disconnect branch from 2560702 to 4b0823d Compare November 1, 2026 22:44
@hzhou
hzhou force-pushed the fix/hydra-pmi2-pending-request-disconnect branch from 3004702 to 1091a47 Compare November 8, 2026 04:01
@hzhou

hzhou commented Nov 8, 2026

Copy link
Copy Markdown
Collaborator

test:mpich/ch4/ofi
test:mpich/ch3/tcp

@hzhou

hzhou commented Nov 8, 2026

Copy link
Copy Markdown
Collaborator

test:mpich/ch4/most
test:mpich/warnings

@hzhou hzhou left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good. A couple small changes needed. In addition, squash the last commits and revase to the main branch.

Comment thread test/mpi/impls/pmi/testlist Outdated
@@ -1,2 +1,4 @@
test_pmi1 2
test_pmi2 2
test_pmi2_nodeattr 4

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Need the same mpiexecarg=-ppn mpiexecarg=4 option to force the 4 ranks on the same node for the test to work.

@@ -0,0 +1,98 @@
#define _POSIX_C_SOURCE 200809L

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Drop this. It won't work with some testing setup which defines -D_POSIX_C_SOURCE=200112L via compiler flags. Simply declare -

int kill(pid_t pid, int sig);

should work.

Separately, The copyright line should always be at the top

@Johnny-Kao
Johnny-Kao force-pushed the fix/hydra-pmi2-pending-request-disconnect branch from 1091a47 to 7356e29 Compare November 8, 2026 23:44
@Johnny-Kao

Copy link
Copy Markdown
Contributor Author

Thanks @hzhou. I added -ppn 4 for the four-rank test, removed the _POSIX_C_SOURCE override, and declared kill() as suggested. The copyright header is now at the top.

I also squashed the commits and rebased on main. The updated version passed my staging build and targeted PMI tests, including the fault case. Upstream checks are running again now.

@hzhou

hzhou commented Nov 8, 2026

Copy link
Copy Markdown
Collaborator

I also squashed the commits

Oops, I didn't mean to squash all commits. I was only referring to the previous merge commits. Sorry about that. Could you at least split the tests into a separate commit?

When a client exits during PMI2_Info_GetNodeAttr(wait=true), Hydra
can keep a pending reply for its closed socket. A later PutNodeAttr
may try to use that socket and disrupt the remaining processes.

Remove only requests owned by the disconnected client and release
the queued command state when each request completes.
Add a normal multiple-waiter test and a forced-exit regression test
for deferred PMI2 node-attribute replies. Include useful failure
diagnostics, keep the test ranks on one node, and avoid overriding
the build POSIX feature-test macro.
@Johnny-Kao
Johnny-Kao force-pushed the fix/hydra-pmi2-pending-request-disconnect branch from 7356e29 to 432862e Compare November 8, 2026 23:57
@Johnny-Kao

Johnny-Kao commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor Author

No problem, thanks for clarifying @hzhou. I have split it back into two commits now: one for the Hydra fix, and one for the PMI2 regression tests (including the diagnostics and review adjustments). Both are based on the latest main. No code changes from the tested version.

Let me know if you need any revision on those.

@hzhou

hzhou commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

test:mpich/authorship

@hzhou
hzhou merged commit 31a45ab into pmodels:main Nov 9, 2026
5 checks passed
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.

2 participants