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

libflux/msg_handler: improve lookup of message handlers for RPCs #1807

Merged
merged 8 commits into from Nov 7, 2018

Conversation

Projects
None yet
3 participants
@garlick
Copy link
Member

garlick commented Nov 7, 2018

As discussed in #1804, this PR simplifies the mechanism used to look up message handlers (by integer matchtag) for received request messages. The current mechanism is hand-coded table lookup. The replacement is zhashx_t, a well tested container.

There is some additional cleanup of errno handling and handling of invalid arguments.

A trivial test was added to ensure invalid arguments cause functions to fail with EINVAL.

Also I tossed in @grondo's build system fix to AM_TESTS_ENVIRONMENT usage suggested in #1803.

garlick added some commits Nov 6, 2018

libflux/msg_handler: replace "fastpath" with zhashx
Instead of maintaining an array indexed by matchtag
to quickly locate message handlers for RPCs, use a
zhashx configured to use matchtags as hash keys.

This should scale just as well with less complexity.
libflux/msg_handler: preserve errno in delvec
Problem: flux_msg_handler_delvec() calls functions
like free() which might overwrite errno.

Save and restore errno inside the function, and then
remove save/restore in flux_msg_handler_addvec()
error path.
libflux/msg_handler: cleanup errno in flux_msg_handler_create()
Save/restore errno in internal free_msg_handler(), then
eliminate awkward errno preserving code in flux_msg_handler_create()
error paths.
libflux/msg_handler: preserve errno in flux_msg_handler_destory
Problem: flux_msg_handler_destroy() calls functions that
might overwrite errno.

Save/restore errno.
libflux/msg_handler: flux_msg_handler_create handle invalid args
Problem: flux_msg_handler_create() segfaults on a NULL
flux_t handle.

Add an EINVAL check.
libflux/msg_handler: flux_dispatch_requeue handle invalid args
Problem: flux_dispatch_requeue() segfaults on a NULL argument.

Return EINVAL flux_t argument is NULL
@codecov-io

This comment has been minimized.

Copy link

codecov-io commented Nov 7, 2018

Codecov Report

Merging #1807 into master will increase coverage by 0.02%.
The diff coverage is 92.68%.

@@            Coverage Diff             @@
##           master    #1807      +/-   ##
==========================================
+ Coverage   79.65%   79.68%   +0.02%     
==========================================
  Files         187      187              
  Lines       34599    34575      -24     
==========================================
- Hits        27561    27552       -9     
+ Misses       7038     7023      -15
Impacted Files Coverage Δ
src/common/libflux/msg_handler.c 90.23% <92.68%> (+4.16%) ⬆️
src/common/libflux/message.c 81.39% <0%> (ø) ⬆️
src/cmd/flux-module.c 85.88% <0%> (+0.3%) ⬆️

@grondo grondo merged commit 3040798 into flux-framework:master Nov 7, 2018

3 checks passed

codecov/patch 92.68% of diff hit (target 79.65%)
Details
codecov/project 79.68% (+0.02%) compared to 31ce43a
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@grondo

This comment has been minimized.

Copy link
Contributor

grondo commented Nov 7, 2018

Nice improvement!

@garlick

This comment has been minimized.

Copy link
Member Author

garlick commented Nov 7, 2018

Thanks!

@garlick garlick deleted the garlick:dispatch_fastpath branch Nov 7, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.