Closed lingcoder closed 3 years ago
Before port being exposed, there are many steps ,like Configuration validation, Serialization initialization, Protocol initialization and so on, after random port fetch. This will cause more than one provider fetch the same port because the port is not occupied. If you want to start more than one provider at one time, it is more recommend to specify specific port for each provider.
In the production environment, is there a scenario where ports are randomly assigned?
In the production environment, is there a scenario where ports are randomly assigned?
Thanks! Even if you configure a fixed port, it is possible to deploy multiple instances on one machine,then "Address already in use: bind" is s bound to occur.
I do configure dubbo protocol port to be random because I wonder if it is possible to completely ignore the concerns about port configuration.
Before port being exposed, there are many steps ,like Configuration validation, Serialization initialization, Protocol initialization and so on, after random port fetch. This will cause more than one provider fetch the same port because the port is not occupied. If you want to start more than one provider at one time, it is more recommend to specify specific port for each provider.
Thanks! Is it possible that we completely ignore the concerns about dubbo protocol port configuration when we use dubbo
Be flexible, start one by one or specify the ports.
Large port may be used some connections But in your code , I think you may be restart at least 2 app. The code cannot promise you . Image this, app 1 finds port 20880 not use and then app2 find sport 20880 not use too. So app 1 starts fast and then app2 must failed to start. I can say dubbo may improve code to find a random port. and not release this port . So docker or k8s may be the port solution
The above answer should solve your problem, temporarily close the issue, if there is still a problem, you can reopen it
Environment
Steps to reproduce this issue
Expected Result
Two dubbo modules start normally and use two different random ports
Actual Result
One dubbo modules start normally and another not. Because they use the same dubbo protocol port.
If there is an exception, please attach the exception trace: