-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Bind to all network interfaces for both IPv4 and IPv6 #4558
Comments
reproduced with v1.16.5 and v1.17.0. |
Looks like ipv6 is not supported in case of single worker. https://github.com/fluent/fluentd/blob/v1.17.0/lib/fluent/plugin_helper/server.rb#L370-L383 |
Hmm, we can't add brackets? Addrinfo.tcp("::", 20000)
=> #<Addrinfo: [::]:20000 TCP>
Addrinfo.tcp("[::]", 20000)
(irb):1:in `tcp': getaddrinfo: Name or service not known (SocketError)
from (irb):1:in `<main>'
from /home/daipom/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/irb-1.13.1/exe/irb:9:in `<top (required)>'
from /home/daipom/.rbenv/versions/3.2.2/bin/irb:25:in `load'
from /home/daipom/.rbenv/versions/3.2.2/bin/irb:25:in `<main>' |
This works. <source>
@type forward
bind "::"
port 12345
</source> |
@inistor Please try an address with no brackets. |
Already did - it only listens on IPv6: f.conf:
➜ /tmp docker run -it --rm --name fluentd-ipv6-test -v /tmp/f.conf:/f.conf fluentd:v1.16-1 -c /f.conf
fluentd -c /f.conf
2024-07-18 05:30:38 +0000 [info]: init supervisor logger path=nil rotate_age=nil rotate_size=nil
2024-07-18 05:30:38 +0000 [info]: parsing config file is succeeded path="/f.conf"
2024-07-18 05:30:38 +0000 [info]: gem 'fluentd' version '1.16.2'
2024-07-18 05:30:38 +0000 [info]: using configuration file: <ROOT>
<source>
@type forward
bind "::"
port 12345
</source>
</ROOT>
2024-07-18 05:30:38 +0000 [info]: starting fluentd-1.16.2 pid=6 ruby="3.1.5"
[...] ➜ ~ docker exec -it fluentd-ipv6-test sh
/ $ nc -vz 127.0.0.1 12345
/ $ nc -vz ::1 12345
::1 ([::1]:12345) open
/ $ And the reason appears to be the way the URL is formed. At least from
True, in the case of |
Please see my report from 2020: #3001 |
Any comments on this one? Is there any way I may be of assistance? |
I see. So we need this feature.
|
Well, it would seem that in |
Hmm, I don't think this issue is solved. <source>
@type forward
bind "[::]"
port 12345
</source>
<match test.**>
@type stdout
</match>
|
Describe the bug
Desired outcome
Run an input plugin, be it tcp or http, binding to all network interfaces, for both IPv4 and IPv6. This is a docker environment, running the latest fluentd DockerHub image (
1.16.2-1
, at the time of this writing).Configuration
Result
the error is
getaddrinfo: Name does not resolve
inlib/fluent/plugin_helper/server.rb
.Attempting to use
bind "::"
allows the server to start, but only listens on IPv6.Additional notes
The same problem error when using an http type input plugin, for instance
@type monitor_agent
, along with `bind "[::]".In this case, a slightly stranger thing happens; the stacktrace shows:
Please note that the
webrick
gem is used, for some reason, instead ofasync-http
- which, in the code, seems to be intended for compatibility with older Ruby versions - seefluentd/lib/fluent/plugin_helper/http_server.rb
Line 21 in 6d53664
For the
async-http
, at least, the "[::]" has the intended outcome (i.e. both IPv4 and IPv6 listeners on all interfaces); the following code:To Reproduce
Create a simple configuration file
fluent-test-bind.conf
:Start a container, using the newly created config file:
docker run -it --rm -v ./fluent-test-bind.conf:/fluent-test-bind.conf fluentd -c /fluent-test-bind.conf
The error (and stack traces) appear on stdout:
Expected behavior
It would be desirable to be able to use a single listener entry in the configuration file to listen on both IPv4 and IPv6 interfaces.
It is also expected that bind addresses of the type "[::]" or "[::1]" are allowed - they are permitted by
Async::HTTP::Endpoint.parse()
, as indicated above.Your Environment
Your Configuration
Your Error Log
2024-07-15 17:05:42 +0000 [debug]: #0 fluent/log.rb:341:debug: listening monitoring http server on http://[::]:12345/api/plugins for worker0
2024-07-15 17:05:42 +0000 [error]: #0 fluent/log.rb:404:error: unexpected error error_class=SocketError error="getaddrinfo: Name does not resolve"
2024-07-15 17:05:42 +0000 [error]: #0 fluent/supervisor.rb:962:main_process: /usr/lib/ruby/3.1.0/socket.rb:227:in
getaddrinfo' 2024-07-15 17:05:42 +0000 [error]: #0 fluent/supervisor.rb:962:main_process: /usr/lib/ruby/3.1.0/socket.rb:227:in
foreach'2024-07-15 17:05:42 +0000 [error]: #0 fluent/supervisor.rb:962:main_process: /usr/lib/ruby/3.1.0/socket.rb:763:in
tcp_server_sockets' 2024-07-15 17:05:42 +0000 [error]: #0 fluent/supervisor.rb:962:main_process: /usr/lib/ruby/gems/3.1.0/gems/webrick-1.7.0/lib/webrick/utils.rb:60:in
create_listeners'2024-07-15 17:05:42 +0000 [error]: #0 fluent/supervisor.rb:962:main_process: /usr/lib/ruby/gems/3.1.0/gems/webrick-1.7.0/lib/webrick/server.rb:130:in
listen' 2024-07-15 17:05:42 +0000 [error]: #0 fluent/supervisor.rb:962:main_process: /usr/lib/ruby/gems/3.1.0/gems/webrick-1.7.0/lib/webrick/server.rb:111:in
initialize'2024-07-15 17:05:42 +0000 [error]: #0 fluent/supervisor.rb:962:main_process: /usr/lib/ruby/gems/3.1.0/gems/webrick-1.7.0/lib/webrick/httpserver.rb:47:in
initialize' 2024-07-15 17:05:42 +0000 [error]: #0 fluent/supervisor.rb:962:main_process: /usr/lib/ruby/gems/3.1.0/gems/fluentd-1.16.2/lib/fluent/plugin_helper/http_server/compat/server.rb:47:in
new'2024-07-15 17:05:42 +0000 [error]: #0 fluent/supervisor.rb:962:main_process: /usr/lib/ruby/gems/3.1.0/gems/fluentd-1.16.2/lib/fluent/plugin_helper/http_server/compat/server.rb:47:in
initialize' 2024-07-15 17:05:42 +0000 [error]: #0 fluent/supervisor.rb:962:main_process: /usr/lib/ruby/gems/3.1.0/gems/fluentd-1.16.2/lib/fluent/plugin_helper/http_server.rb:69:in
new'2024-07-15 17:05:42 +0000 [error]: #0 fluent/supervisor.rb:962:main_process: /usr/lib/ruby/gems/3.1.0/gems/fluentd-1.16.2/lib/fluent/plugin_helper/http_server.rb:69:in
http_server_create_http_server' 2024-07-15 17:05:42 +0000 [error]: #0 fluent/supervisor.rb:962:main_process: /usr/lib/ruby/gems/3.1.0/gems/fluentd-1.16.2/lib/fluent/plugin/in_monitor_agent.rb:213:in
start'2024-07-15 17:05:42 +0000 [error]: #0 fluent/supervisor.rb:962:main_process: /usr/lib/ruby/gems/3.1.0/gems/fluentd-1.16.2/lib/fluent/root_agent.rb:203:in `block in start'
[...]
Also, the same problem is encountered for external plugins, such as fluentd-plugin-prometheus. Example config:
The text was updated successfully, but these errors were encountered: