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

Make SO_REUSEPORT Optional #1669

Merged
merged 5 commits into from
Jan 2, 2018
Merged

Conversation

martinbroadhurst
Copy link
Contributor

I'm open to opinions as to whether SO_REUSEPORT should be the default or not.
Also, would appreciate some advice about unit testing this change.

@tilgovi
Copy link
Collaborator

tilgovi commented Dec 28, 2017

I am slightly in favor of a False default. This option matters most for users seeking the performance benefits, I think. Those users may know that they want this and they are likely to read through the server options for tweaks. New users, however, can sometimes be killing and restarting their server over and over while testing out code in development and reusing the port can sometimes lead to having two instances of Gunicorn running on a development machine, serving different code. To minimize confusion, I would make it False by default. I'm open to arguments for True, though.

No strong opinion on how to test this.

@martinbroadhurst
Copy link
Contributor Author

I agree with you about the default being False. I have changed the code accordingly.

Copy link
Collaborator

@tilgovi tilgovi left a comment

Choose a reason for hiding this comment

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

This looks great to me. Thank you for opening a PR. I'll give others a chance to weigh in on whether we want to test this at all, otherwise I'll merge in the next day or so.

@martinbroadhurst
Copy link
Contributor Author

Thanks. I have updated the documentation.

reuse_port
~~~~~~~~~~

* ``--reuse-port``
Copy link
Collaborator

Choose a reason for hiding this comment

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

Documentation for the new option will be generated automatically from gunicorn/config.py when you run make html in docs/ directory.

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'm not sure I understand your comment, @berkerpeksag. I generated this change by running make -C docs html. Am I not supposed to commit settings.rst?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I thought you manually edited it because I didn't see the "Set the SO_REUSEPORT flag on the listening socket." part in the generated file. Now I don't know why make html didn't get the documentation in the desc attribute.

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 generated it, but then edited it because running it also brought in logconfig_dict (which presumably was omitted previously and should be in its own PR), and also changed chdir, user and group. I must have got the edit wrong. Sorry about that. It's all there now.

default = False

desc = """\
Set the ``SO_REUSEPORT`` flag on the listening socket.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add .. versionadded:: 19.8.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I always forget this and you always catch it. Thanks! :-D

@benoitc benoitc mentioned this pull request Jan 2, 2018
@berkerpeksag
Copy link
Collaborator

The cause of build failure is prospector-dev/prospector#200. All tests passed and I don't think we need a test case for this since testing the actual change reliably would be hard.

@berkerpeksag berkerpeksag merged commit 6171ac4 into benoitc:master Jan 2, 2018
@berkerpeksag
Copy link
Collaborator

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

Successfully merging this pull request may close these issues.

3 participants