You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Mark Thomas (Jira)" <ji...@apache.org> on 2023/04/19 09:49:00 UTC

[jira] [Resolved] (DAEMON-451) Prunsrv does not use configured stack size for the main thread in jvm mode

     [ https://issues.apache.org/jira/browse/DAEMON-451?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mark Thomas resolved DAEMON-451.
--------------------------------
    Fix Version/s: 1.3.4
       Resolution: Fixed

Thanks for the research and the patch.

> Prunsrv does not use configured stack size for the main thread in jvm mode
> --------------------------------------------------------------------------
>
>                 Key: DAEMON-451
>                 URL: https://issues.apache.org/jira/browse/DAEMON-451
>             Project: Commons Daemon
>          Issue Type: Bug
>          Components: Procrun
>    Affects Versions: 1.3.3
>            Reporter: Konstantin Kolinko
>            Priority: Minor
>             Fix For: 1.3.4
>
>         Attachments: 0001-Fix-DAEMON-451.-Honor-the-stack-size-option-when-cre.patch
>
>
> This issue was originally reported for Apache Tomcat, see
> [https://bz.apache.org/bugzilla/show_bug.cgi?id=66327]
> A user provided a sample web application (see BZ 66327 attachment 38426). This web application was deployed on Apache Tomcat 9.0.70 (uses Commons Daemon 1.3.3), configured as a Windows Service.
> The sample application performs a deep recursion at startup, that prints numbers from 1 up to 25000. In the default configuration it fails with a StackOverflowError.
> To reproduce:
> 1. Build the sample web application:
> 1.1. Download it from BZ 66327 (attachment 38426).
> 1.2. Change its pom.xml file, removing "jersey-container-servlet" from dependencies. I do not know why it is there, it is not needed.
> 1.3. Build it with Apache Maven (`mvn package`). The result is target/TestStack-1.0-SNAPSHOT.war
> 2. Install Apache Tomcat 9 on Windows as a service:
> 2.1. Download and run the "32-bit/64-bit Windows Service Installer" (*.exe) from
> https://tomcat.apache.org/download-90.cgi
> 2.2. Run it. Use default options, but once installation finishes choose to do not start the service.
> 3. Deploy the web appplication on Tomcat:
> 3.1. Copy the war file into webapps directory of Tomcat.
> 4. Go into the bin directory of Tomcat and run prunmgr (tomcat9w.exe).
> 5. Start Tomcat service, from the first page of prunmgr dialog.
> 6. See the files in the logs directory of Tomcat.
>  - See the localhost.2022-*{*}-{*}*.log file for a StackOverflowError
>  - See the tomcat9-stdout.2022-{*}-{*}*.log file for recursion counter.
> If the web application starts successfully, there will be no StackOverflowError, and the counter will go up to 25000.
> If the web application fails to start, there will be a StackOverflowError, and the recursion counter will stop at some value, usually somewhere around 15000.
> 7. Try to increase the stack size:
> 7.1. Stop the service. Clear the files in the logs directory.
> 7.2. In prunmgr dialog (page "Java") change "Thread stack size" to a higher value, e.g. 3072.
> 7.3. Do not forget to press the "Apply" button.
> 7.4. Start the service.
> Expected behaviour:
> It is expected that changing the "Thread stack size" value to a higher value would eventually allow the web application to start successfully.
> Actual behaviour:
> It makes no difference.
> If I reconfigure Tomcat to use a thread pool when starting web applications, instead of using the main thread, the behaviour changes to the expected one.  E.g. if you add startStopThreads="3" to a Host element in its conf/server.xml file. See Configuration Reference here:
> https://tomcat.apache.org/tomcat-9.0-doc/config/host.html
> Note: procrun here runs in jvm mode. The configuration for Tomcat is as follows (see bin/service.bat file):
> --StartMode jvm
> --StopMode jvm
> --StartClass org.apache.catalina.startup.Bootstrap
> --StopClass org.apache.catalina.startup.Bootstrap
> --StartParams start
> --StopParams stop



--
This message was sent by Atlassian Jira
(v8.20.10#820010)