This is an automated email from the ASF dual-hosted git repository.
remm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new dce1fc833b Sync ContainerBase background processes with lifecycle
operations
dce1fc833b is described below
commit dce1fc833b5192ec0ccee7d4120a050cee5da8de
Author: remm <[email protected]>
AuthorDate: Fri Nov 17 11:35:40 2023 +0100
Sync ContainerBase background processes with lifecycle operations
Also sync check for webapp updates since the same lifecycle operations
could cause problems.
---
java/org/apache/catalina/core/ContainerBase.java | 2 +-
java/org/apache/catalina/startup/HostConfig.java | 23 +++++++++++++++--------
webapps/docs/changelog.xml | 8 ++++++++
3 files changed, 24 insertions(+), 9 deletions(-)
diff --git a/java/org/apache/catalina/core/ContainerBase.java
b/java/org/apache/catalina/core/ContainerBase.java
index c774b26b82..c3ab118646 100644
--- a/java/org/apache/catalina/core/ContainerBase.java
+++ b/java/org/apache/catalina/core/ContainerBase.java
@@ -1031,7 +1031,7 @@ public abstract class ContainerBase extends
LifecycleMBeanBase implements Contai
* this container. Unexpected throwables will be caught and logged.
*/
@Override
- public void backgroundProcess() {
+ public synchronized void backgroundProcess() {
if (!getState().isAvailable()) {
return;
diff --git a/java/org/apache/catalina/startup/HostConfig.java
b/java/org/apache/catalina/startup/HostConfig.java
index 3c9d7e481c..3c35b8ef09 100644
--- a/java/org/apache/catalina/startup/HostConfig.java
+++ b/java/org/apache/catalina/startup/HostConfig.java
@@ -1686,15 +1686,22 @@ public class HostConfig implements LifecycleListener {
* @param name The name of the web application to check
*/
public void check(String name) {
- if (tryAddServiced(name)) {
- try {
- DeployedApplication app = deployed.get(name);
- if (app != null) {
- checkResources(app, true);
+ synchronized (host) {
+ if (host instanceof Lifecycle) {
+ if (!((Lifecycle) host).getState().isAvailable()) {
+ return;
+ }
+ }
+ if (tryAddServiced(name)) {
+ try {
+ DeployedApplication app = deployed.get(name);
+ if (app != null) {
+ checkResources(app, true);
+ }
+ deployApps(name);
+ } finally {
+ removeServiced(name);
}
- deployApps(name);
- } finally {
- removeServiced(name);
}
}
}
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index d2baf05a23..6140c4dbdf 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -105,6 +105,14 @@
issues do not "pop up" wrt. others).
-->
<section name="Tomcat 11.0.0-M15 (markt)" rtext="in development">
+ <subsection name="Catalina">
+ <changelog>
+ <fix>
+ Background processes should not be run concurrently with lifecycle
+ oprations of a container. (remm)
+ </fix>
+ </changelog>
+ </subsection>
<subsection name="Coyote">
<changelog>
<fix>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]