mojira.dev
BDS-3989

Default server port is used even if another port is defined

Summary
When non-standard ports are available, BDS will use the standard ports as the "additional" automatic ports (BDS-1094) rather than ones from the normal random range.

Steps to Reproduce:

  1. Modify server-port and server-portv6 to 19131 and 19134 respectively

  2. Start server

  3. Note that the additional open ports are 19132 and 19133 rather than from the usual random range

What I expected to happen:
The additional ports should be from a higher, unused range

How this impacts server owners:
If you have 2 servers, one that is configured to run on 19132 and 19133 (BDS A) and another to run on 19134 and 19135 (BDS B). If when starting the server, BDS B starts before BDS A it will consume 19132 and 33 as its random ports preventing BDS A from starting (due to ports being in use)

Original description moved to comments for clarity

Linked issues

Comments 25

I am having this issue in 1.14 as well. If I start the server on 19132 first, starting the one on 19134 doesn't try to use 19132, however, the server is not able to be connected to.

I am having this issue in 1.14 as well. If I start the server on 19132 first, starting the one on 19134 doesn't try to use 19132, however, the server is not able to be connected to.

Original Description by @unknown:
From server.properties:

server-port=19131
server-portv6=19134

When server is ran:

{{… }}INFO] IPv4 supported, port: 19131
{{… }}INFO] IPv6 supported, port: 19134
{{… }}INFO] IPv4 supported, port: 19132
{{… }}INFO] IPv6 supported, port: 19133
{{… }}INFO] Server started.

As you can see, the server ran on defined ports, but also on default ones.

It looks like the server always runs 2 other ports after running on the ones defined in server.properties.

In instance, if you set default ports in server.properties, the server adds two random ports.

Example:

{{… }}INFO] IPv4 supported, port: 19131
{{… }}INFO] IPv6 supported, port: 19134
{{… }}INFO] IPv4 supported, port: 42484
{{… }}INFO] IPv6 supported, port: 54985
{{… }}INFO] Server started.

I don't see why it should do such a thing. Especially that if the ports are random, we can't create a proper firewall rule for them.

Finally, I want to point out that this behavior is new and wasn't present in 1.11.2.1. Here is a typical output from the latter:

{{… }}INFO] IPv4 supported, port: 19131
{{… }}INFO] IPv6 supported, port: 19134
{{… }}INFO] Server started.

This issue is preventing me from launching 2 servers as services; one on default ports (needed) and another on other ports because the one that doesn't use default port may occupy default ports if ran first. This would make the other server unable to run because the ports are already in use.

Original Description by @unknown:
From server.properties:

server-port=19131
server-portv6=19134

When server is ran:

{{… }}INFO] IPv4 supported, port: 19131
{{… }}INFO] IPv6 supported, port: 19134
{{… }}INFO] IPv4 supported, port: 19132
{{… }}INFO] IPv6 supported, port: 19133
{{… }}INFO] Server started.

As you can see, the server ran on defined ports, but also on default ones.

It looks like the server always runs 2 other ports after running on the ones defined in server.properties.

In instance, if you set default ports in server.properties, the server adds two random ports.

Example:

{{… }}INFO] IPv4 supported, port: 19131
{{… }}INFO] IPv6 supported, port: 19134
{{… }}INFO] IPv4 supported, port: 42484
{{… }}INFO] IPv6 supported, port: 54985
{{… }}INFO] Server started.

I don't see why it should do such a thing. Especially that if the ports are random, we can't create a proper firewall rule for them.

Finally, I want to point out that this behavior is new and wasn't present in 1.11.2.1. Here is a typical output from the latter:

{{… }}INFO] IPv4 supported, port: 19131
{{… }}INFO] IPv6 supported, port: 19134
{{… }}INFO] Server started.

This issue is preventing me from launching 2 servers as services; one on default ports (needed) and another on other ports because the one that doesn't use default port may occupy default ports if ran first. This would make the other server unable to run because the ports are already in use.

I can confirm the issue in 1.16 as well

15 more comments

@Mods, I guess this issue can be closed as there is now the option to turn the default port discovery on and off since 1.19.50 (See BDS-1094)

 

@Kai, do you confirm that the port is not used if the new option is toggled?

@Kai, do you confirm that the port is not used if the new option is toggled?

This issue is still a problem and causes severe issues when running multiple servers on the same machine. If BDS finds the default port open it will automatically bind to that port, however, when people try to connect to that port, it will show that the server is popular which makes no sense.

This is a serious issue and needs to be fixed, its a shame this has been open for as long as it has.

EDIT:

Set `enable-lan-visibility=false` in `server.properties`.

This issue is still a problem and causes severe issues when running multiple servers on the same machine. If BDS finds the default port open it will automatically bind to that port, however, when people try to connect to that port, it will show that the server is popular which makes no sense.

This is a serious issue and needs to be fixed, its a shame this has been open for as long as it has.

EDIT:

Set `enable-lan-visibility=false` in `server.properties`.

migrated

(Unassigned)

Confirmed

Retrieved