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
Fix systemd unix path handling #2007
Conversation
1. Move removal to launcher from single and cluster. 2. @unix_paths only contains files that Puma creates (pre-existing files are not)
1. test_binder.rb - test_pre_existing_unix 2. test_integration_cluster.rb - test_pre_existing_unix
History.md
Outdated
@@ -4,6 +4,7 @@ | |||
* Your feature goes here (#Github Number) | |||
|
|||
* Bugfixes | |||
* Fix handling of pre-existing/systemd unix binder files (#1842, #1988) |
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.
let's mention "socket activation" and "systemd" explicitly for anyone scanning the changelog
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.
Done
test/test_integration_cluster.rb
Outdated
def test_pre_existing_unix | ||
skip UNIX_SKT_MSG unless UNIX_SKT_EXIST | ||
|
||
File.open(@bind_path, mode: 'wb') { |f| f.puts 'pre eixisting' } |
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.
existing
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.
Done
test/test_integration_cluster.rb
Outdated
|
||
File.open(@bind_path, mode: 'wb') { |f| f.puts 'pre eixisting' } | ||
|
||
cli_server "-w #{WORKERS} -t 0:6 -q test/rackup/sleep_step.ru", unix: :unix |
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.
leave out the thread setting, not necessary
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.
Done
test/test_binder.rb
Outdated
skip UNIX_SKT_MSG unless UNIX_SKT_EXIST | ||
unix_path = "test/#{name}_server.sock" | ||
|
||
File.open(unix_path, mode: 'wb') { |f| f.puts 'pre eixisting' } |
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.
existing
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.
Done
assert_match %r!unix://#{unix_path}!, @events.stdout.string | ||
|
||
refute_includes @binder.instance_variable_get(:@unix_paths), unix_path | ||
|
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.
let's also call close_unix_paths
and assert that the file is not removed
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.
Done
@MSP-Greg Can you talk me through the changes to where |
c2f8a2c
to
8ad26eb
Compare
Ah, yeah, that's it. Or, I'm fixing my own mistake in a recent PR, as there's no need to have it in both cluster & single. Six months from now, I don't want myself or someone else asking "why is that being done separately?" |
Puma should not unlink pre-existing UNIXSocket files. which causes issues with systemd. See: #1842, #1988
1st Commit: 'Fix Binder @unix_paths handling'
Move removal to launcher from single and cluster.
@unix_paths only contains files that Puma creates (pre-existing files are not)
2nd Commit: 'Add tests for pre-existing unix paths'
test_binder.rb - test_pre_existing_unix
test_integration_cluster.rb - test_pre_existing_unix