On 20/06/2025 01:18, Amit Pande wrote:
Hello,

I was testing out the "configtest"  option of the catalina.sh/.bat and observed 
that does not do validation for the shutdown port.

There are lots of things it doesn't explicitly test. Why is the shutdown port of particular interest?

https://github.com/apache/tomcat/blob/8bbdabe02c384cf15aa43dafb66a5b42440edac3/java/org/apache/catalina/startup/Bootstrap.java

                 case "configtest":
                     daemon.load(args);
                     if (null == daemon.getServer()) {
                         System.exit(1);
                     }
                     // Can we add the shutdown port validation code here?
                    // Check if the port is an integter, check if this port is 
available for use

The integer check will be performed automatically as part of parsing the file. You'll see a warning for non-integer values.

Port availability is a tricky one. Just because the port is available now, that is no guarantee it will be available when you start the instance.

Consider the case of three Tomcat instances on a single machine, all using the same shutdown port. Run the configtest on each and it passes. Try starting them and you get failures.

I'm not convinced there is much value in a port availability test.

                   // Not 100% sure yet if this is the right place
                    validateShutdownPort(daemon.getServer().getPorrt());
                     System.exit(0);
                     break;

Appreciate feedback on whether this is a good idea to enhance the server.xml 
config validation check?

I'm not yet convinced.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to