You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by GitBox <gi...@apache.org> on 2022/05/18 13:49:10 UTC

[GitHub] [tomcat] aooohan opened a new pull request, #515: Bug:Deadlocks occur when both engine and host startStopThreads values are set and the latter value is larger than the former

aooohan opened a new pull request, #515:
URL: https://github.com/apache/tomcat/pull/515

   # Reproduce
   ```xml
   <Engine name="Catalina" defaultHost="localhost"  startStopThreads="3">
         <Host name="localhost"  appBase="webapps"
               unpackWARs="true" autoDeploy="true" startStopThreads="4">
         </Host>
   </Engine>
   ```
   **When starting tomcat as configured above, the situation shown in the image below will occur.**
   
   <img width="1669" alt="image" src="https://user-images.githubusercontent.com/40265686/169047128-b7fefd31-7a1a-4ba4-96e7-05dfbd2156dc.png">
   
   **been stuck here**⬆️⬆️⬆️
   
   **Then  i used the Arthas tool to look at the threads and the results are shown below.**
   
   <img width="1709" alt="image" src="https://user-images.githubusercontent.com/40265686/169047640-8c2d689d-3e23-49c4-861b-b1c5a4d6ce3e.png">
   <img width="1350" alt="image" src="https://user-images.githubusercontent.com/40265686/169047710-d9d8e8a9-c2f0-41ff-92dc-148d9d99a52c.png">
   <img width="1509" alt="image" src="https://user-images.githubusercontent.com/40265686/169048027-9b1c1e43-8ccc-4782-b9ed-cbf2d518dcf6.png">
   
   
   
    When starting tomcat, the current StandardServer instance object has been locked in LifecycleBase#start. When we do not set the startStopThreads value of StandardEngine, startStopThreads defaults to 1. At this time, startStopExecutor in StandardEngine is actually an instance of InlineExecutorService (in fact, the current thread), so when StandardEngine starts its subcontainer StandardHost through the startStopExecutor thread pool, because it is the current thread, there is no problem when executing the .StandardServer#reconfigureUtilityExecutor method.
   However, when the startStopExecutor in StandardEngine is not InlineExecutorService (ie Server#getUtilityExecutor()), the StandardServer#reconfigureUtilityExecutor method is executed again(The host's startStopThreads value is greater than the engine's startStopThreads), because the lock of the StandardServer instance has not been released at this time, resulting in a deadlock.
   
   
   > My English is limited, I don't know if I have explained it clearly, or I am thinking in the wrong direction
   
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[GitHub] [tomcat] rmaucher closed pull request #515: Bug:Deadlocks occur when both engine and host startStopThreads values are set and the latter value is larger than the former

Posted by GitBox <gi...@apache.org>.
rmaucher closed pull request #515: Bug:Deadlocks occur when both engine and host startStopThreads values are set and the latter value is larger than the former
URL: https://github.com/apache/tomcat/pull/515


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[GitHub] [tomcat] rmaucher commented on pull request #515: Bug:Deadlocks occur when both engine and host startStopThreads values are set and the latter value is larger than the former

Posted by GitBox <gi...@apache.org>.
rmaucher commented on PR #515:
URL: https://github.com/apache/tomcat/pull/515#issuecomment-1131604290

   Thanks a lot for your PR. Sorry, I forgot to close it after merging it manually. The fix will be in Tomcat 10.1.0-M16, 10.0.22, 9.0.64. Tomcat 8.5 is not affected since it doesn't have the utility executor feature.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[GitHub] [tomcat] rmaucher commented on pull request #515: Bug:Deadlocks occur when both engine and host startStopThreads values are set and the latter value is larger than the former

Posted by GitBox <gi...@apache.org>.
rmaucher commented on PR #515:
URL: https://github.com/apache/tomcat/pull/515#issuecomment-1131378209

   Good idea, the sync is overloaded in that case so this is risky, and other operations already use a servicesLock item for this reason.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[GitHub] [tomcat] aooohan commented on pull request #515: Bug:Deadlocks occur when both engine and host startStopThreads values are set and the latter value is larger than the former

Posted by GitBox <gi...@apache.org>.
aooohan commented on PR #515:
URL: https://github.com/apache/tomcat/pull/515#issuecomment-1131597904

   @rmaucher Thank u for reviewing my PR, it's an honour to contribute PR to Tomcat.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org