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

server helper: Fix IPv6 dual stack mode issue for tcp socket. #2697

Merged
merged 4 commits into from
Nov 15, 2019

Conversation

repeatedly
Copy link
Member

Signed-off-by: Masahiro Nakagawa repeatedly@gmail.com

Which issue(s) this PR fixes:
Fixes #2682

What this PR does / why we need it:
Use other socket method to set IPV6_V6ONLY.
See also treasure-data/serverengine#101

Docs Changes:
No need

Release Note:
Same as title

Signed-off-by: Masahiro Nakagawa <repeatedly@gmail.com>
@repeatedly repeatedly added the bug Something isn't working label Nov 14, 2019
@repeatedly repeatedly self-assigned this Nov 14, 2019
@ganmacs
Copy link
Member

ganmacs commented Nov 15, 2019

Don't you add a test for this?

Signed-off-by: Masahiro Nakagawa <repeatedly@gmail.com>
Signed-off-by: Masahiro Nakagawa <repeatedly@gmail.com>
@repeatedly
Copy link
Member Author

Just added test.

Copy link
Member

@ganmacs ganmacs left a comment

Choose a reason for hiding this comment

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

LGTM if the CI passes. And left a question.

@@ -355,7 +355,11 @@ def server_create_tcp_socket(shared, bind, port)
sock = if shared
server_socket_manager_client.listen_tcp(bind, port)
else
TCPServer.new(bind, port) # this method call can create sockets for AF_INET6
# TCPServer.new doesn't set IPV6_V6ONLY flag, so use Addrinfo class instead.
# backlog will be set correctly so use listen's default here
Copy link
Member

Choose a reason for hiding this comment

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

backlog will be set correctly

What does this mean? who sets backlog?

Copy link
Member Author

@repeatedly repeatedly Nov 15, 2019

Choose a reason for hiding this comment

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

server_create_tcp_socket is used in other API, e.g. server_create, and such APIs set backlog from plugins.

Copy link
Member

Choose a reason for hiding this comment

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

This one? https://github.com/fluent/fluentd/blob/master/lib/fluent/plugin_helper/server.rb#L222
How about "backlog will be set by the caller, we don't set backlog here", then? (it's IMO. so it's ok for me to leave as it is)

Signed-off-by: Masahiro Nakagawa <repeatedly@gmail.com>
@repeatedly repeatedly merged commit 39e8b77 into master Nov 15, 2019
@repeatedly repeatedly deleted the fix-dual-stack-ipv6-issue branch November 15, 2019 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When using the same port number, the td-agent fails to bind to IPv4 alongside IPv6
2 participants