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
mon: do crushtool test with fork and timeout, but w/o exec of crushtool #16025
Conversation
2b169fe
to
093415d
Compare
src/common/fork_function.h
Outdated
return 128 + WTERMSIG(status); | ||
} | ||
if (WIFEXITED(status)) { | ||
int r = WEXITSTATUS(status); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@liewegas
WEXITSTATUS(status) evaluates to the low-order 8 bits of the argument passed to exit() by the child.
We could make the std::function int8_t
, and change this to:
int8_t r = WEXITSTATUS(status);
I suppose this would allow to avoid "unsigned awkwardness".
src/common/fork_function.h
Outdated
errstr << ": timed out\n"; | ||
return -ETIMEDOUT; | ||
} | ||
errstr << ": exit status: " << r << "\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably it is better to output r -1
value?
After |
Updated, mind looking? Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
otherwise LGTM
src/common/fork_function.h
Outdated
|
||
// Run a function post-fork, with a timeout. The exit code encoding | ||
// weirdness does seem to want me to allow negative values, so we make | ||
// the std::function unsigned. fork_function() itself is signed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@liewegas need to update the comment and the commit log message?
Signed-off-by: Sage Weil <sage@redhat.com>
Not strictly necessary, but a tidier. Signed-off-by: Sage Weil <sage@redhat.com>
We see timeouts here, but I very much suspect they are due to the overhead of launching the crushtool process and not the test itself. We have perfectly code already in our process, though; we just want to isolate failure and time out reliably. So, fork and timeout, without executing a new binary. Hopefully-fixes: http://tracker.ceph.com/issues/19964 Signed-off-by: Sage Weil <sage@redhat.com>
test_with_fork is superior in all ways :) Signed-off-by: Sage Weil <sage@redhat.com>
Signed-off-by: Sage Weil <sage@redhat.com>
made a few changes, will test again. |
This basically copies the Subprocess hackery for the timeout of the forked
subprocess, but operates on a lamba (in this case, CrushTester::test()) instead
of running crushtool via exec(2).