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

Unhelpful error when trying to bind to an unknown address #48001

Closed
DaveCTurner opened this issue Oct 14, 2019 · 2 comments · Fixed by #51269
Closed

Unhelpful error when trying to bind to an unknown address #48001

DaveCTurner opened this issue Oct 14, 2019 · 2 comments · Fixed by #51269
Labels
>bug :Distributed Coordination/Network Http and internode communication implementations help wanted adoptme

Comments

@DaveCTurner
Copy link
Contributor

If I set network.host to an address that doesn't belong to my laptop then I get the message Failed to bind to [9300-9400] which is pretty mysterious. I think we should show the address to which we are trying to bind too.

$ cat elasticsearch-7.4.0/config/elasticsearch.yml | grep -ve '^#'
network.host: 192.168.0.1 # that's not my name
$ ifconfig | grep 192.168
	inet 192.168.1.139 netmask 0xffffff00 broadcast 192.168.1.255
	inet 192.168.1.179 netmask 0xffffff00 broadcast 192.168.1.255
$ elasticsearch-7.4.0/bin/elasticsearch
... snip
[2019-10-14T15:00:53,592][ERROR][o.e.b.Bootstrap          ] [Davids-MacBook-Pro-3.local] Exception
org.elasticsearch.transport.BindTransportException: Failed to bind to [9300-9400]
	at org.elasticsearch.transport.TcpTransport.bindToPort(TcpTransport.java:389) ~[elasticsearch-7.4.0.jar:7.4.0]
	at org.elasticsearch.transport.TcpTransport.bindServer(TcpTransport.java:355) ~[elasticsearch-7.4.0.jar:7.4.0]
	at org.elasticsearch.transport.netty4.Netty4Transport.doStart(Netty4Transport.java:139) ~[?:?]
	at org.elasticsearch.xpack.core.security.transport.netty4.SecurityNetty4Transport.doStart(SecurityNetty4Transport.java:81) ~[?:?]
	at org.elasticsearch.xpack.security.transport.netty4.SecurityNetty4ServerTransport.doStart(SecurityNetty4ServerTransport.java:43) ~[?:?]
	at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:59) ~[elasticsearch-7.4.0.jar:7.4.0]
	at org.elasticsearch.transport.TransportService.doStart(TransportService.java:230) ~[elasticsearch-7.4.0.jar:7.4.0]
	at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:59) ~[elasticsearch-7.4.0.jar:7.4.0]
	at org.elasticsearch.node.Node.start(Node.java:695) ~[elasticsearch-7.4.0.jar:7.4.0]
	at org.elasticsearch.bootstrap.Bootstrap.start(Bootstrap.java:273) ~[elasticsearch-7.4.0.jar:7.4.0]
	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:358) [elasticsearch-7.4.0.jar:7.4.0]
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) [elasticsearch-7.4.0.jar:7.4.0]
	at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) [elasticsearch-7.4.0.jar:7.4.0]
	at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) [elasticsearch-7.4.0.jar:7.4.0]
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:125) [elasticsearch-cli-7.4.0.jar:7.4.0]
	at org.elasticsearch.cli.Command.main(Command.java:90) [elasticsearch-cli-7.4.0.jar:7.4.0]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:115) [elasticsearch-7.4.0.jar:7.4.0]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) [elasticsearch-7.4.0.jar:7.4.0]
Caused by: java.net.BindException: Can't assign requested address
	at sun.nio.ch.Net.bind0(Native Method) ~[?:?]
	at sun.nio.ch.Net.bind(Net.java:455) ~[?:?]
	at sun.nio.ch.Net.bind(Net.java:447) ~[?:?]
	at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:219) ~[?:?]
	at io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:132) ~[?:?]
	at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:551) ~[?:?]
	at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1345) ~[?:?]
	at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:503) ~[?:?]
	at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:488) ~[?:?]
	at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:984) ~[?:?]
	at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:247) ~[?:?]
	at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:355) ~[?:?]
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163) ~[?:?]
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:416) ~[?:?]
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:515) ~[?:?]
	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:918) ~[?:?]
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[?:?]
	at java.lang.Thread.run(Thread.java:835) ~[?:?]
...
@DaveCTurner DaveCTurner added >bug :Distributed Coordination/Network Http and internode communication implementations v7.4.0 labels Oct 14, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed (:Distributed/Network)

@ywelsch ywelsch added help wanted adoptme and removed v7.4.0 labels Dec 2, 2019
mariaral added a commit to mariaral/elasticsearch that referenced this issue Jan 21, 2020
When bind fails, show the host address in addition to the port. This
helps debugging cases with wrong "network.host" values.

Closes elastic#48001
@mariaral
Copy link
Contributor

Hi @DaveCTurner, @ywelsch ,

I submitted PR #51269 fixing this. Please take a look.

DaveCTurner pushed a commit that referenced this issue Feb 4, 2020
When bind fails, show the host address in addition to the port. This
helps debugging cases with wrong "network.host" values.

Closes #48001
DaveCTurner pushed a commit that referenced this issue Feb 4, 2020
When bind fails, show the host address in addition to the port. This
helps debugging cases with wrong "network.host" values.

Closes #48001
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Distributed Coordination/Network Http and internode communication implementations help wanted adoptme
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants