mgr: refresh registered client list to monitor on mgr shutdown/respawn#33272
mgr: refresh registered client list to monitor on mgr shutdown/respawn#33272vshankar wants to merge 5 commits intoceph:masterfrom
Conversation
| self.fs.mount(filesystem_name=self.fs_name.encode('utf-8')) | ||
| log.debug("Connection to cephfs '{0}' complete".format(self.fs_name)) | ||
| self.mgr._ceph_register_client(self.fs.get_addrs()) | ||
| r = self.mgr._ceph_register_client(self.fs.get_addrs()) |
There was a problem hiding this comment.
@batrick commit 969b660 adds a guard in _ceph_register_client() to deny registering a client when manager waits for ack from mon for the last sent beacon. between handling this failure and calling disconnect, the ack could arrive and the manager would either shutdown (exit(0)) or respawn (active -> standby). For the shutdown case its not a problem since sending the last beacon (and waiting for an ack) is executed from singal handler context, but, when respawning, manager modules could still be executing when manager waits for the last beacon ack.
There was a problem hiding this comment.
There is an issue even when shutting down from a signal handler -- a module could instantiate a cephfs connection (init, mount) and before registering the handles addrs, a termination signal would never send the just instantiated client addrs resulting in the same problem. As a workaround/fix, the whole fs init/mount and register should happen when signals are blocked.
For the respawn case (comment above) -- mgr could send a SIGTERM to iself and we could execv() from the signal handler (execv is a async-singnal-safe syscall).
There was a problem hiding this comment.
I don't think closing this race is possible without looking at this a different way. I see in 4bfa4fc that you removed a lot of the tear down code in MgrStandby::shutdown. This was de facto dead code due to 3363a10, by @liewegas?
Using the shutdown hook is the most attractive way to resolve this race because modules should stop all operations so the Mgr can then fire off the final beacon including all of the latest clients. Unfortunately I think that bridge has burned down with all of the havoc it caused with the dashboard. In particular, tearing down the Python interpreter "correctly" is just not worth the effort.
So, I would suggest we add another hook named stop which generically just says: "stop the module and tear down all your state". Or alternatively, we could call all the shutdown hooks but not do any other cleanup. What do you think @liewegas @tchaikov @LenzGr
batrick
left a comment
There was a problem hiding this comment.
Thought I posted this review but found it pending. Sorry for the delay...
| self.fs.mount(filesystem_name=self.fs_name.encode('utf-8')) | ||
| log.debug("Connection to cephfs '{0}' complete".format(self.fs_name)) | ||
| self.mgr._ceph_register_client(self.fs.get_addrs()) | ||
| r = self.mgr._ceph_register_client(self.fs.get_addrs()) |
There was a problem hiding this comment.
I don't think closing this race is possible without looking at this a different way. I see in 4bfa4fc that you removed a lot of the tear down code in MgrStandby::shutdown. This was de facto dead code due to 3363a10, by @liewegas?
Using the shutdown hook is the most attractive way to resolve this race because modules should stop all operations so the Mgr can then fire off the final beacon including all of the latest clients. Unfortunately I think that bridge has burned down with all of the havoc it caused with the dashboard. In particular, tearing down the Python interpreter "correctly" is just not worth the effort.
So, I would suggest we add another hook named stop which generically just says: "stop the module and tear down all your state". Or alternatively, we could call all the shutdown hooks but not do any other cleanup. What do you think @liewegas @tchaikov @LenzGr
|
@batrick -- apologies for delay -- I'll get to this in a day or two... |
|
@vshankar looks like this still needs some work? |
right -- testing now -- will push when done. |
|
@gregsfortytwo @tchaikov please take a look |
|
a minor update addressing Patrick's comment to reorganize header file |
`stop` service request will be invoked by manager during termination or respawn. This is currently designed to stop dispatching commands to modules with returning -ESHUTDOWN error code. Signed-off-by: Venky Shankar <vshankar@redhat.com>
Signed-off-by: Venky Shankar <vshankar@redhat.com>
cleanup helper threads (purge and async cloner) when stop service request is invoked. Signed-off-by: Venky Shankar <vshankar@redhat.com>
beacon messages from manager to monitor carries a sequence number which the monitor piggybacks in the beacon reply messages. this machinary would be required to send and wait on sequence number when manager restarts or respawns and has to transmit and updated client list to the monitor for blacklisting. Signed-off-by: Venky Shankar <vshankar@redhat.com>
.. and wait for beacon ack from monitor. The last beacon message sends the updated client list to monitor for potential blacklisting. Fixes: http://tracker.ceph.com/issues/43943 Signed-off-by: Venky Shankar <vshankar@redhat.com>
|
@batrick please take a look EDIT: update is just a rebase |
taking a look |
|
this pr went through the cephfs suites without issue |
The issue is seen when running rados:mgr suite which loads the selftest mgr plugin leading to mgr restart. ceph-mgr does not restart as expected due to the following sequence (seen on a vstart cluster via vstart_runner):
The shutdown part in Client makes me recall this tracker: https://tracker.ceph.com/issues/44276 Need to see if Client::shutdown can be effectively handled. Will post when I get something. EDIT: Note that Client::shutdown() gets called after Client::mount() times out (i.e., call is not initiated by mgr/volumes). |
Is it as simple as just adding timeouts for the Client shutdown? |
That's probably the safest way to go about this or some messenger config options that times out when no reply is received. |
|
(just note that the MGR modules won't be cleaned up when the MGRs is shutting down. They'll be killed instead) |
right -- this pr implements "soft shutdown" for plugins to perform minimal cleanup. Right now, even soft shutdown is pretty delicate. I'll post an update w/ the fixes. |
|
Couple of issues with the current pr:
|
Ya I don't think this is a situation we can resolve in a satisfying way. We have a similar but unresolveable issue with the mgr getting removed via However, that means we'll still see these warnings in QA. Maybe it's time to throw in the towel and whitelist the warning. |
|
Right -- I'll close this pr for now and whitelist the warning. There are some (general) fixes in mgr/volumes though. I'll push a separate pr for that. |
|
Maybe we could open these issues up to a broader discussion so we have maximum chance of getting helpful feedback? Could one of you send an email to the dev list outlining the issues and the problems with currently known solutions? At the least this will help to make the issue more broadly known and that, in itself, may lead to a more satisfying resolution sooner. |
ACK -- I'll initiate a discussion in devel list. |
…mgr client getting backlisted"" This reverts commit a7994a0. Failed attempt at solving the issue is in PR ceph#33272. Until we find a clean solution for this, whiltelisting the warning is probably the best thing for now. Fixes: http://tracker.ceph.com/issues/43943 Signed-off-by: Venky Shankar <vshankar@redhat.com>
…mgr client getting backlisted"" This reverts commit a7994a0. Failed attempt at solving the issue is in PR ceph#33272. Until we find a clean solution for this, whiltelisting the warning is probably the best thing for now. Fixes: http://tracker.ceph.com/issues/43943 Signed-off-by: Venky Shankar <vshankar@redhat.com> (cherry picked from commit 60b8f7a)
…mgr client getting backlisted"" This reverts commit a7994a0. Failed attempt at solving the issue is in PR ceph#33272. Until we find a clean solution for this, whiltelisting the warning is probably the best thing for now. Fixes: http://tracker.ceph.com/issues/43943 Signed-off-by: Venky Shankar <vshankar@redhat.com> (cherry picked from commit 60b8f7a)
…mgr client getting backlisted"" This reverts commit a7994a0. Failed attempt at solving the issue is in PR ceph#33272. Until we find a clean solution for this, whiltelisting the warning is probably the best thing for now. Fixes: http://tracker.ceph.com/issues/43943 Signed-off-by: Venky Shankar <vshankar@redhat.com>
…mgr client getting backlisted"" This reverts commit a7994a0. Failed attempt at solving the issue is in PR ceph#33272. Until we find a clean solution for this, whiltelisting the warning is probably the best thing for now. Fixes: http://tracker.ceph.com/issues/43943 Signed-off-by: Venky Shankar <vshankar@redhat.com>
No description provided.