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

job-info: avoid error response on failed rpc #6502

Merged
merged 2 commits into from
Dec 13, 2024

Conversation

chu11
Copy link
Member

@chu11 chu11 commented Dec 12, 2024

Problem: Common usage in flux-core is to not respond with an RPC error
(such as through flux_respond_error()) if a prior RPC attempt fails (such
as through flux_respond_pack()). This pattern is violated in several
places in job-info.

Solution: If flux_respond_pack() fails, do not call flux_respond_error()
in error handling paths.

Fixes #6498

Problem: Some function parameter indentation is not aligned.

Fix the tabbing.
Copy link
Member

@garlick garlick left a comment

Choose a reason for hiding this comment

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

LGTM although I suggested a little cleanup to make the code more readable.

@@ -763,7 +768,7 @@ static void main_namespace_lookup_continuation (flux_future_t *f, void *arg)
"event", tok, toklen) < 0) {
flux_log_error (ctx->h, "%s: flux_respond_pack",
__FUNCTION__);
goto error;
goto cleanup;
}
}

Copy link
Member

Choose a reason for hiding this comment

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

Good catch! Though maybe the skip_respond_error flag could be avoided if you just moved the error_cancel: code into the one block that uses it and goto cleanup from there?

Comment on lines 143 to 146
json_t *context = NULL;
const char *errmsg = NULL;
const flux_msg_t *msg;
bool skip_respond_error = false;

Copy link
Member

Choose a reason for hiding this comment

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

Same comment on this one. Just call eventlog_watch_cancel() at each goto error_cancel site and goto error or goto cleanup from there as appropriate

Problem: Common usage in flux-core is to not respond with an RPC error
(such as through flux_respond_error()) if a prior RPC attempt fails (such
as through flux_respond_pack()).  This pattern is violated in several
places in job-info.

Solution: If flux_respond_pack() fails, do not call flux_respond_error()
in error handling paths.

Fixes flux-framework#6498
@chu11 chu11 force-pushed the issue6498_job_info_failed_rpc branch from 2354a68 to 15aad44 Compare December 12, 2024 23:24
@chu11
Copy link
Member Author

chu11 commented Dec 12, 2024

thanks! Re-pushed with those tweeks, will set MWP

@mergify mergify bot merged commit fd8afd5 into flux-framework:master Dec 13, 2024
33 checks passed
Copy link

codecov bot commented Dec 13, 2024

Codecov Report

Attention: Patch coverage is 4.16667% with 23 lines in your changes missing coverage. Please review.

Project coverage is 83.61%. Comparing base (8ee6a97) to head (15aad44).
Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
src/modules/job-info/update.c 9.09% 10 Missing ⚠️
src/modules/job-info/watch.c 0.00% 9 Missing ⚠️
src/modules/job-info/guest_watch.c 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6502      +/-   ##
==========================================
- Coverage   83.63%   83.61%   -0.02%     
==========================================
  Files         525      525              
  Lines       87682    87682              
==========================================
- Hits        73334    73317      -17     
- Misses      14348    14365      +17     
Files with missing lines Coverage Δ
src/modules/job-info/guest_watch.c 75.00% <0.00%> (+0.88%) ⬆️
src/modules/job-info/watch.c 65.70% <0.00%> (+0.41%) ⬆️
src/modules/job-info/update.c 76.72% <9.09%> (-0.42%) ⬇️

... and 8 files with indirect coverage changes

@chu11 chu11 deleted the issue6498_job_info_failed_rpc branch December 13, 2024 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

job-info: avoid error response on failed rpc
2 participants