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

rbd-mirror: fix long termination due to 30sec wait in Mirror::run loop #8185

Merged
merged 1 commit into from Mar 19, 2016

Conversation

trociny
Copy link
Contributor

@trociny trociny commented Mar 17, 2016

Signed-off-by: Mykola Golub mgolub@mirantis.com

mirror->run();
while (!stopping.read()) {
struct timeval sleep_time{1, 0};
::select(0, NULL, NULL, NULL, &sleep_time);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rather use c++11's sleep_for or a plain sleep() (no need for hi-res here)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used select() here because I knew it would interrupt if signal were received (so no delay before shutdown). I will check sleep()/sleep_for.

Signed-off-by: Mykola Golub <mgolub@mirantis.com>
@trociny
Copy link
Contributor Author

trociny commented Mar 19, 2016

Ah, actually, I should have looked how SignalHandler framework work first! I thought register_async_signal_handler() is just a wrapper for sigaction(), but actually we have a thread for handling signals.

So it looks it is safe to just signal the condition in Mirror::handle_signal(). I have rebased the PR.

@dillaman
Copy link

lgtm

@dillaman dillaman added this to the jewel milestone Mar 19, 2016
dillaman pushed a commit that referenced this pull request Mar 19, 2016
rbd-mirror: fix long termination due to 30sec wait in main loop

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
@dillaman dillaman merged commit 4a83b20 into ceph:master Mar 19, 2016
@trociny trociny deleted the wip-rbd-mirror-faster-exit branch March 21, 2016 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants