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

Gracefully terminate server process when requested #9

Open
rutsky opened this issue Feb 1, 2016 · 3 comments
Open

Gracefully terminate server process when requested #9

rutsky opened this issue Feb 1, 2016 · 3 comments

Comments

@rutsky
Copy link
Contributor

rutsky commented Feb 1, 2016

I think the only correct way of terminating BUSE-based NBD server is to disconnect the NBD device:

nbd-client -d /dev/nbd0

It would be nice to properly handle Ctrl+C to achieve same result (currently Ctrl+C leads to exit code 130, i.e. terminated with SIGINT),

@bandi13
Copy link

bandi13 commented Feb 1, 2016

In my C++ version, I've put in some wrappers to handle this problem. It should exit gracefully when a SIGINT happens (either via Ctrl+C or kill). Take a look at those.

@rutsky
Copy link
Contributor Author

rutsky commented Feb 1, 2016

Thanks for the info @bandi13!

So generally it can be implemented as

nbd = open(dev_file, O_RDWR);
...
ioctl(nbd, NBD_DISCONNECT);

in SIGINT signal handler: https://github.com/bandi13/BUSE-CPP/blob/master/buse.cpp#L208

@bandi13, I checked your implementation and think that issue #4 is related to your version too.
Just don't do stuff that always should be done inside assert() macro.

@SupraSummus
Copy link
Contributor

@acozzette can you please close this issue? In my opinion it has been resolved. Thanks ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants