https://bz.apache.org/bugzilla/show_bug.cgi?id=63389

--- Comment #2 from Igal Sapir <isa...@apache.org> ---
(In reply to Mark Thomas from comment #1)
> Start and stop are synchronous. Calling start() then stop() should be
> sufficient. Doing that with the current startup scripts is a little trickier
> because you need to wait for the shutdown port to open.
> 
> Something like:
> ./catalina.sh start && sleep 1 && ./catalina.sh stop
> 
> should work however long the web application takes to start up.

On my laptop the servlet takes about 3 seconds to initialize (though on some
cloud deployments I have seen it take as much as 15s).

>From testing the above compounded command it seems to me that the shutdown port
only opens after the servlet initialization, so waiting 1 or 2s does not work
[1].

If we could start listening the shutdown port at the beginning of the process,
and then it can be a blocking operation until start completes, then that would
be a great a solution.

Thoughts?

[1] /workspace/src/tomcat-master$ output/build/bin/catalina.sh start && sleep 2
&& output/build/bin/catalina.sh stop
Using CATALINA_BASE:   /workspace/test/catalina-base
Using CATALINA_HOME:   /workspace/src/tomcat-master/output/build
Using CATALINA_TMPDIR: /workspace/test/catalina-base/temp
Using JRE_HOME:        /opt/java/jdk1.8.0_202
Using CLASSPATH:      
/workspace/src/tomcat-master/output/build/bin/bootstrap.jar:/workspace/src/tomcat-master/output/build/bin/tomcat-juli.jar
Tomcat started.
Using CATALINA_BASE:   /workspace/test/catalina-base
Using CATALINA_HOME:   /workspace/src/tomcat-master/output/build
Using CATALINA_TMPDIR: /workspace/test/catalina-base/temp
Using JRE_HOME:        /opt/java/jdk1.8.0_202
Using CLASSPATH:      
/workspace/src/tomcat-master/output/build/bin/bootstrap.jar:/workspace/src/tomcat-master/output/build/bin/tomcat-juli.jar
Apr 29, 2019 10:58:34 AM org.apache.catalina.startup.Catalina stopServer
SEVERE: Could not contact [localhost:8005] (base port [8005] and offset [0]).
Tomcat may not be running.
Apr 29, 2019 10:58:34 AM org.apache.catalina.startup.Catalina stopServer
SEVERE: Error stopping Catalina
java.net.ConnectException: Connection refused (Connection refused)
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at
java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
        at
java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
        at
java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
        at java.net.Socket.connect(Socket.java:589)
        at java.net.Socket.connect(Socket.java:538)
        at java.net.Socket.<init>(Socket.java:434)
        at java.net.Socket.<init>(Socket.java:211)
        at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:513)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:390)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:480)

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to