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

lock domain socket and remove on last arbiter exit #1185

Closed
wants to merge 1 commit into from

Conversation

paulnivin
Copy link
Contributor

This fixes a bug where during a hot restart, any unix domain sockets are removed when the original arbiter is TERM'd.

Sequence:

  • First arbiter starts (socket file created)
  • New arbiter starts via USR2 (all is well)
  • First arbiter exits via TERM (socket file is removed)

For the fix, every arbiter grabs a read lock on startup. On exit, every arbiter attempts to grab a write lock -- if successful, we're the only arbiter running and the socket file can be safely removed.

@benoitc
Copy link
Owner

benoitc commented Jan 22, 2016

the fix looks fine for me. Any idea how we could have a test for it though? Would be better.

@benoitc
Copy link
Owner

benoitc commented Feb 9, 2016

@tilgovi @berkerpeksag ok for you?

@paulnivin
Copy link
Contributor Author

I haven't had time to look into how we could write a test for this case, but I can do so within the next week or so.

@tilgovi
Copy link
Collaborator

tilgovi commented Feb 25, 2016

Probably a new file, tests/test_socket.py, with a simple test would suffice. Mock out fcntl and unlink and verify that fcntl is called during the constructor and that unlink is not called if fcntl raises.

👍 this is a good patch

@tilgovi
Copy link
Collaborator

tilgovi commented Mar 13, 2016

Closing in favor of #1220, which adds tests to this.

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

Successfully merging this pull request may close these issues.

None yet

3 participants