Repository navigation
common/admin_socket: add a command to raise a signal - #53689
Conversation
|
jenkins test api |
dd94048 to
927f8a7
Compare
927f8a7 to
e54477b
Compare
batrick
left a comment
There was a problem hiding this comment.
I like it! Some proposed changes:
- Find a suitable place in
docs/for the new asok command. Note it's available for all Ceph processes (event clients). - Note in the
ReleaseNotes - Add a test. I think a good starting test would be to check that
SIGHUPcauses the daemons to reopen their log files: first delete the log file then check it's recreated after SIGHUP.
There was a problem hiding this comment.
Probably should add a wait for the pid (WNOHANG) in the poll loop in AdminSocket::entry.
There was a problem hiding this comment.
I'm not sure. That child will be killed anyway, and I'm forking another one. If any race we can't really prevent it fully so why bother?
There was a problem hiding this comment.
If you don't wait for the child then you create zombie processes.
There was a problem hiding this comment.
Fixed with a note: I decided not to add code to the general admin_socket polling loop. That means we will have at most one zombie child per daemon if this command is used, which I thought was a reasonable tradeoff
e54477b to
eba5482
Compare
eba5482 to
b6fe695
Compare
There was a problem hiding this comment.
Suggestion: add an containerized example where the .asok file is under /var/lib/something
There was a problem hiding this comment.
There is an example at line 622
ceph daemon /var/run/ceph/ceph-osd.0.asok foo
Isn't that sufficient?
There was a problem hiding this comment.
Someone running containerized will find nothing under /var/run/ceph
There was a problem hiding this comment.
My plan was to only mention the new command while leaving the rest without modifications. If you'd like to use this as an opportunity to improve the adjacent text, be my guest, but I'd have to ask you to suggest the actual edits. Thanks!
b6fe695 to
6e3c162
Compare
|
jenkins test api |
1 similar comment
|
jenkins test api |
6e3c162 to
308614b
Compare
There was a problem hiding this comment.
We use this polling due to the pid check below? Would it not suffice to sleep for the entire duration and then check the pids post the sleep? (pid reuse issue?)
There was a problem hiding this comment.
I wanted to avoid having the forked child pin all that memory beyond the parent's lifetime to only find out about it after the timeout, so this loop was the simplest mitigation I could think of.
The timeout could be arbitrarily large, so some kind of mitigation is required.
There was a problem hiding this comment.
Have you considered using prctl w/ PR_SET_PDEATHSIG?
There was a problem hiding this comment.
No, I didn't know about this one, thanks!
I mean, I suspected there was a more elegant way to handle this case, but again, decided to go with a simpler solution thinking that it would be easier to manage.
For example, this solution you suggested which I liked, is not available on MacOS :/.
There was a problem hiding this comment.
We could use the prctl for Linux and fallback to polling for other systems.
There was a problem hiding this comment.
Which means #ifdef conditionals, so, I'm probably fine with using a single solution that works across 🤷
There was a problem hiding this comment.
right.. i already had to contaminate this code with some WIN32 ifdefs :/ and here I'd really prefer a simple portable solution given that it has no performance or other constraints.
ef90ba9 to
80bf336
Compare
80bf336 to
0cf07ce
Compare
|
jenkins test make check |
|
jenkins test api |
Signed-off-by: Leonid Usov <[email protected]>
The new command "raise <signal> [--after X]" accepts signals in the forms: '9', '-9', 'kill', '-KILL' When --after is specified, the program will fork to wait for the timeout The forked instance will bail out if it detects that the parent PID has changed which would indicate that the original parent has terminated. Forking an instance allows to schedule delivery of signals even if the original process is suspended, e.g.: ceph tell mds.a raise CONT --after 10 ceph tell mds.a raise STOP Signed-off-by: Leonid Usov <[email protected]> Fixes: https://tracker.ceph.com/issues/62882
0cf07ce to
7cc54b2
Compare
|
jenkins test api |
|
|
||
| static const std::map<std::string, int> known_signals = { | ||
| // the following 6 signals are recognized in windows according to | ||
| // https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/raise?view=msvc-170 |
There was a problem hiding this comment.
These come from ANSI C actually.
There was a problem hiding this comment.
i.e. C89 required these signals so windows apparently must support it.
The new command "raise [--after X]" accepts signals in the forms: '9', '-9', 'kill', '-KILL'
When --after is specified, the program will fork to wait for the timeout
The forked instance will bail out if it detects that the parent PID has changed which would indicate that the original parent has terminated.
Forking an instance allows to schedule delivery of signals even if the original process is suspended, e.g.:
Fixes: https://tracker.ceph.com/issues/62882
Show available Jenkins commands
jenkins retest this pleasejenkins test classic perfjenkins test crimson perfjenkins test signedjenkins test make checkjenkins test make check arm64jenkins test submodulesjenkins test dashboardjenkins test dashboard cephadmjenkins test apijenkins test docsjenkins render docsjenkins test ceph-volume alljenkins test ceph-volume toxjenkins test windows