Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flux_respond_error: accept an errnum of 0 #3036

Closed
SteVwonder opened this issue Jul 7, 2020 · 1 comment · Fixed by #4427
Closed

flux_respond_error: accept an errnum of 0 #3036

SteVwonder opened this issue Jul 7, 2020 · 1 comment · Fixed by #4427

Comments

@SteVwonder
Copy link
Member

SteVwonder commented Jul 7, 2020

It was discussed on Slack that flux_respond_error considers errnum == 0 to be invalid and errors out with EINVAL. From the man page:

flux_respond_error() returns an error response to the sender. errnum must be non-zero. If errmsg is non-NULL, an error string payload is included in the response. The error string may be used to provide a more detailed error message than can be conveyed via errnum.

This was surprising to both @grondo and I. One suggestion was to allow an errnum of 0 for flux_respond_error since we've been shifting to using descriptive errmsgs anyways. Maybe we only allow an errnum of 0 when an errmsg is provided?

@garlick
Copy link
Member

garlick commented Jul 7, 2020

I agree this is a problem area. It's easy to encounter an error and call flux_respond_error (...errno) but find that errno wasn't actually set by the function that failed. No response is sent so someplace else hangs waiting for it. At best the flux_respond_error() failure is logged. Meanwhile stuff is hung and you don't know why.

Since RFC 3 requires the errnum field in the response to be nonzero on error, we should maybe just substitute a generic errno if it is called with errnum = 0?

garlick added a commit to garlick/flux-core that referenced this issue Jul 25, 2022
Problem: if flux_respond_error() is called with errnum of 0,
no response is sent, which can cause hard to diagnose problems.

Use EINVAL if errnum is zero.

Fixes flux-framework#3036
garlick added a commit to garlick/flux-core that referenced this issue Jul 26, 2022
Problem: if flux_respond_error() is called with errnum of 0,
no response is sent, which can cause hard to diagnose problems.

Use EINVAL if errnum is zero.

Fixes flux-framework#3036
garlick added a commit to garlick/flux-core that referenced this issue Jul 26, 2022
Problem: if flux_respond_error() is called with errnum of 0,
no response is sent, which can cause hard to diagnose problems.

Use EINVAL if errnum is zero.

Fixes flux-framework#3036
@mergify mergify bot closed this as completed in #4427 Jul 26, 2022
chu11 pushed a commit to chu11/flux-core that referenced this issue Aug 8, 2022
Problem: if flux_respond_error() is called with errnum of 0,
no response is sent, which can cause hard to diagnose problems.

Use EINVAL if errnum is zero.

Fixes flux-framework#3036
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants