Status/Resolution/Reason: Needs Review//
Reporter/Name(from Bugbase): Bradley Wood / ()
Created: 05/22/2018
Components: Server Monitoring
Versions: 2016
Failure Type: Others
Found In Build/Fixed In Build: Final /
Priority/Frequency: Minor /
Locale/System: / Platforms All
Vote Count: 0
Problem Description:
I should be able to have more than once instance of ColdFusion use the same monitoring port so long as the jetty.xml uses a different locally-assigned IP address. However, the port check employed when the server is starting incorrectly attempts to bind to ALL IPs which is not right.
The call is incorrectly using the constructor for "java.net.ServerSocket" that only accepts a port, which by default binds on all IPs. Instead, that code should be testing the port with the overloaded constructor that accepts an inetAddress as well that should represent the host being used for the MonitoringService.
https://docs.oracle.com/javase/8/docs/api/java/net/ServerSocket.html#ServerSocket-int-int-java.net.InetAddress-
As such, the second server that tries to start will get a JVM Bind error and a new port will be chosen even though Jetty would have had no issues binding to the port on a separate inetAddress
Steps to Reproduce:
Start up two CommandBox 2016 servers with CFConfig installed using the following .cfconfig.json files in the respective web roots:
Server 1's .cfconfig.json file
{
"monitoringServiceHost":"127.0.0.1",
"monitoringServicePort":"5501"
}
Server 2's .cfconfig.json file
{
"monitoringServiceHost":"127.127.0.58",
"monitoringServicePort":"5501"
}
Then run "start --debug" in each web root.
Actual Result:
Even though the host is different for each server, the second server will incorrectly report that the port is in use and will use another port.
Expected Result:
The port check should correctly bind to port being tested using the correct host address.
Any Workarounds:
Use different ports for each instance, which isn't as easy since CommandBox servers using the hostupdater module could easily make the host dynamic based on the host being used by the server which would allow this to "just work" out of the box, no matter how many instances you started.
Attachments:
Comments: