-
Notifications
You must be signed in to change notification settings - Fork 156
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
Moved socket initialization to wroker processes if SO_REUSEPORT is available #241
Conversation
Explained at #142 |
The tests fail because We would need to get the child process PIDs with: |
eef1ea3
to
a20694a
Compare
I've assumed that on linux |
891a3e0
to
5674aef
Compare
…ailable hitch_test.sh looks for worker processes for hitch hosts.
# Print the PIDs of the children of the daemon started with `start_hitch` | ||
|
||
hitch_worker_pids() { | ||
ps --ppid "$(hitch_pid)" | grep -Eo "^[ ]*[0-9]+" |
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.
|
||
hitch_hosts() { | ||
SO_REUSEPORT_WORKS=false | ||
if test "$(python -c 'import socket; print(1 if hasattr(socket, "SO_REUSEPORT") else 0)')" = "1" |
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.
So this pulls in Python as test dependency, are you sure?
A shorter and simpler idiom would be
if python -c 'import socket; exit(not hasattr(socket, "SO_REUSEPORT"))'
or
if ! python -c 'import socket; exit(hasattr(socket, "SO_REUSEPORT"))'
depending on your taste.
@@ -252,6 +298,11 @@ curl_hitch() { | |||
if ! $HAS_SPECIFIC_ARG | |||
then | |||
HITCH_HOST=$(hitch_hosts | sed 1q) | |||
if [ -z $HITCH_HOST ]; |
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.
$HITCH_HOST
should probably be quoted here.
@@ -318,6 +369,10 @@ s_client() { | |||
if ! $HAS_CONNECT_OPT | |||
then | |||
HITCH_HOST=$(hitch_hosts | sed 1q) | |||
if [ -z $HITCH_HOST ]; |
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.
Sames as above.
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.
Thank you for the comments, i'll adjust the commit.
I'm not sure about the new python dependency. I think all machines now have some python version and this one liner would run on all of them.
@daghf mentioned that this whole thing might not work with reload, i need to investigate. |
I'm working on a fix that supersedes this one. Closing |
Many tests are failing.