You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2026/09/17 14:27:52 UTC
(tomcat) branch main updated (14901ae4cc -> fc7fd5deb2)
This is an automated email from the ASF dual-hosted git repository.
markt-asf pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
from 14901ae4cc Avoid saving some Context to server.xml
new 4b000cc2f5 Avoid start then immediate stop when an error occurs with await enabled
new fc7fd5deb2 Align load() error handling with server.start() error handling
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
java/org/apache/catalina/startup/Catalina.java | 25 +++++++++++++++++++++++--
webapps/docs/changelog.xml | 3 +++
2 files changed, 26 insertions(+), 2 deletions(-)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
(tomcat) 01/02: Avoid start then immediate stop when an error occurs with await enabled
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
markt-asf pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 4b000cc2f5ee44bc6d7b239490e41bab6d634123
Author: Mark Thomas <ma...@apache.org>
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 7710a18e6b..7f458c0878 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -267,6 +267,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>
<subsection name="Coyote">
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
(tomcat) 02/02: Align load() error handling with server.start() error handling
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
markt-asf pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit fc7fd5deb2f7ea83ef188bf21bbcd3961e1ee745
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Sep 17 14:43:05 2026 +0100
Align load() error handling with server.start() error handling
---
java/org/apache/catalina/startup/Catalina.java | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/java/org/apache/catalina/startup/Catalina.java b/java/org/apache/catalina/startup/Catalina.java
index 7fa1be7ddf..1feded95d6 100644
--- a/java/org/apache/catalina/startup/Catalina.java
+++ b/java/org/apache/catalina/startup/Catalina.java
@@ -874,7 +874,21 @@ public class Catalina {
public void start() {
if (getServer() == null) {
- load();
+ try {
+ load();
+ } catch (Throwable t) {
+ // Re-throw critical errors immediately. Otherwise, try and clean-up first.
+ ExceptionUtils.handleThrowable(t);
+ log.fatal(sm.getString("catalina.initError"), t);
+ if (getServer() != null) {
+ try {
+ getServer().destroy();
+ } catch (LifecycleException e) {
+ log.debug(sm.getString("catalina.destroyFail"), e);
+ }
+ }
+ return;
+ }
}
if (getServer() == null) {
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org