Skip to content

Fix FI_EINTR (interrupted) corrupting internal state for no reason - #628

Open
jonasohland wants to merge 3 commits into
dmf-mxl:mainfrom
jonasohland:fix/fabrics/handle-interrupt
Open

Fix FI_EINTR (interrupted) corrupting internal state for no reason#628
jonasohland wants to merge 3 commits into
dmf-mxl:mainfrom
jonasohland:fix/fabrics/handle-interrupt

Conversation

@jonasohland

@jonasohland jonasohland commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Some providers return FI_EINTR from blocking completion or event queue reads. This was (almost correctly) forwarded to the user through an exception, but leave our internal state variant in valueless_by_exception.
FI_EINTR is a recoverable error, so the user should be able to continue making progress it they choose to do so.
This PR fixes that by catching FI_EINTR early and returning it as a valid result.

Fixes #624

@jonasohland jonasohland self-assigned this Jul 24, 2026
@jonasohland jonasohland added the backport/v1.1 This PR should be back ported to the release branch of version 1.1. label Jul 24, 2026

@vt-tv vt-tv 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.

LGTM.

@mlefebvre1 mlefebvre1 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.

LGTM

@KimonHoffmann KimonHoffmann 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, but the handling of the new status in the demo app appears off to me.

Comment thread tools/mxl-fabrics-demo/demo.cpp Outdated
Comment thread tools/mxl-fabrics-demo/demo.cpp Outdated
jonasohland and others added 2 commits July 29, 2026 19:54
Co-authored-by: Jonas Ohland <jonas.ohland@gmail.com>
Signed-off-by: Jonas Ohland (Riedel) <jonas.ohland@riedel.net>
Co-authored-by: Jonas Ohland <jonas.ohland@gmail.com>
Signed-off-by: Jonas Ohland (Riedel) <jonas.ohland@riedel.net>
@jonasohland
jonasohland force-pushed the fix/fabrics/handle-interrupt branch from c29626e to 1ba1df9 Compare July 29, 2026 17:54

@KimonHoffmann KimonHoffmann 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.

A few subtleties regarding the handling of interruptions.

Comment thread tools/mxl-fabrics-demo/demo.cpp Outdated
Comment thread tools/mxl-fabrics-demo/demo.cpp Outdated
continue;
}

if (status != MXL_ERR_NOT_READY && status != MXL_STATUS_OK)

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.

Could use parentheses around the binary sub-expressions.

return status;
}
}
while (status == MXL_ERR_NOT_READY && deadline > std::chrono::steady_clock::now());

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.

Could use parentheses around the binary sub-expressions.

continue;
}

if (status != MXL_ERR_NOT_READY && status != MXL_STATUS_OK)

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.

Could use parentheses around the binary sub-expressions.

Comment thread tools/mxl-fabrics-demo/demo.cpp Outdated
if (g_exit_requested)
{
return MXL_STATUS_OK;
}

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.

While I understand that there is some cost to setup and teardown of this run-loop I think it'd be more appropriate to just return with MXL_ERR_INTERRUPTED and let the caller decide how to go about this.

Comment thread tools/mxl-fabrics-demo/demo.cpp Outdated
if (g_exit_requested)
{
return MXL_STATUS_OK;
}

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.

As above wrt to forwarding the error to the caller.

@jonasohland

jonasohland commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

@KimonHoffmann I am going to re-write this demo app anyway (#627), so I just want to get this fix merged with not too many other changes that will conflict with my rewrite... So maybe we can just merge this as-is? I removed the superfluous g_exit_requested check.

Co-authored-by: Jonas Ohland <jonas.ohland@gmail.com>
Signed-off-by: Jonas Ohland (Riedel) <jonas.ohland@riedel.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/v1.1 This PR should be back ported to the release branch of version 1.1.

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

[Small Improvement] Gracefully handle signal interruptions on blocking completion queue reads

4 participants