This is an automated email from the ASF dual-hosted git repository.
markt-asf pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/11.0.x by this push:
new 1eab007ae0 Avoid start then immediate stop when an error occurs with
await enabled
1eab007ae0 is described below
commit 1eab007ae0761c54efb28144645c1cc2f689f3b7
Author: Mark Thomas <[email protected]>
AuthorDate: Thu Sep 17 14:42:14 2026 +0100
Avoid start then immediate stop when an error occurs with await enabled
---
java/org/apache/catalina/startup/Catalina.java | 9 ++++++++-
webapps/docs/changelog.xml | 3 +++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/java/org/apache/catalina/startup/Catalina.java
b/java/org/apache/catalina/startup/Catalina.java
index a3334c973d..7fa1be7ddf 100644
--- a/java/org/apache/catalina/startup/Catalina.java
+++ b/java/org/apache/catalina/startup/Catalina.java
@@ -830,7 +830,14 @@ public class Catalina {
try {
getServer().init();
} catch (LifecycleException e) {
- if (throwOnInitFailure) {
+ /*
+ * The server will be in the FAILED state. If start() is then
called, that will first call stop() to
+ * clean-up before trying to start the server. Calling stop()
means a future call to getServer().await()
+ * will return immediately. That in turn means if the call to
start() succeeds it will be immediately
+ * followed by another call to stop(). If await is enabled then it
is better to throw the error here than to
+ * start the Server only to immediately stop it again.
+ */
+ if (throwOnInitFailure || await) {
throw new Error(e);
} else {
log.error(sm.getString("catalina.initError"), e);
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 06ab3785cd..6d53814909 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -136,6 +136,9 @@
<code>server.xml</code>. Use it to have <code>StoreConfig</code>
save to a new config file. (remm)
</fix>
+ <fix>
+ Improve error handling on start-up. (markt)
+ </fix>
</changelog>
</subsection>
</section>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]