-
Notifications
You must be signed in to change notification settings - Fork 50
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
unwatch kvs values and gracefully return from a flux_reactor based application #75
Comments
Yeah the watch callbacks should return -1 to stop the reactor like other reactor callbacks. A workaround for now is to call Matching |
Ah, thanks -- I forgot about |
Add 'matchtag' argument to flux_response_recvmsg() and flux_json_request(). Change flux_json_rpc() to internally allocate/free a unique matchtag. Legacy request functions set 'matchtag' to zero in flux_response_recvmsg() and flux_json_request() to get the legacy behavior. Special KVS note: kvs_watch() was changed to allocate a matchtag and hold it for the life of the handle since a kvs_watch() request has multiple replies and persists until the handle is destroyed. The design of kvs_watch() will be revisited - see issue flux-framework#75.
Add 'matchtag' argument to flux_response_recvmsg() and flux_json_request(). Change flux_json_rpc() to internally allocate/free a unique matchtag. Legacy request functions set 'matchtag' to zero in flux_response_recvmsg() and flux_json_request() to get the legacy behavior. Special KVS note: kvs_watch() was changed to allocate a matchtag and hold it for the life of the handle since a kvs_watch() request has multiple replies and persists until the handle is destroyed. The design of kvs_watch() will be revisited - see issue flux-framework#75.
Revisiting this as I'd like to revamp some of the reactor interfaces. First I should note that the reactor will not return when there are no callbacks registered. There are two problems that need to be solved here:
Second, what do you think about a void type for reactor callbacks like libev's and then relying exclusively on Looking back I really made some "noob" decisions in the reactor code! |
sign: add mechanism arguments
kvs_watch()
is cumbersome to use with the flux reactor because there is no way toderegister the watch function, and no way to gracefully interrupt the reactor itself
(kvs_watch callbacks have no return value to pass up to reactor core)
If an application is using the flux_reactor interface, and wants to watch even one kvs
value or directory, it cannot use the nice idiom of deregistering all reactor handlers
indicating there is nothing left to do, because the kvs handlers do not support this
functionality.
Also since kvs handlers don't support passing error values up to flux reactor, we
can't even force an exit from the reactor by returning -1. The only solution is to
interrupt the reactor with a signal somehow, or set up a message to ourselves
that forces exit from the reactor by returning -1. (And I'm not sure the second approach
is currently possible either)
One solution is to support kvs_unwatch(), another solution is support the use of
kvs_watch_once() style single-action trigger. The user would be required to reset
the watch before returning to the reactor. The second approach sounds more
easily implemented, but probably has a race condition.
The text was updated successfully, but these errors were encountered: