Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 326979 - www-servers/tomcat-6.0.26-r1 server start but init script shows error
Summary: www-servers/tomcat-6.0.26-r1 server start but init script shows error
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Java (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Java team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-05 12:51 UTC by Christian Kaps
Modified: 2011-03-14 01:52 UTC (History)
7 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Kaps 2010-07-05 12:51:40 UTC
When I try to start the tomcat server with the provided init script then the server starts without an error but the init script shows that the server isn't started.

Reproducible: Always

Steps to Reproduce:
1. /etc/init.d/tomcat-6 start
Actual Results:  
* Starting Tomcat ...                                            [ !! ]

Expected Results:  
* Starting Tomcat ...                                            [ ok ]
Comment 1 Andreas Prieß 2010-07-16 09:01:30 UTC
Same problem here with tomcat-6.0.28. Some differences I observe:

After starting tomcat-6.0.26 with the working init script I see tomcat as a child process of
/bin/bash /sbin/runscript.sh /etc/init.d/tomcat-6 start

The init scritp of version 6.0.28 shows an error, but tomcat is running without a parent process like above. The init script then does not show the correct status and can not stop tomcat.

What additional info is needed to fix this?
Comment 2 Pavel Goran 2010-08-17 15:22:07 UTC
Same here. tomcat-6.0.28, baselayout-1.12.13.

The cause seems to be that the runscript's start-stop-daemon variant (the one from /lib64/rcscripts/sh/rc-daemon.sh) doesn't recognize the Java process that Bash runs, thus thinks that the daemon did not start successfully and returns a non-zero exit status.

The solution is simple: in /etc/init.d/tomcat-6, replace

start-stop-daemon ${args} --startas /bin/bash -- -c \
    "exec ${exec} ${OPTS_CP} $@ ${CATALINA_ARGS} ${TOMCAT_START} >> \
    \"$CATALINA_BASE/logs/catalina.out\" 2>&1"

with

start-stop-daemon ${args} --name ${exec} --startas /bin/bash -- -c \
    "exec ${exec} ${OPTS_CP} $@ ${CATALINA_ARGS} ${TOMCAT_START} >> \
    \"$CATALINA_BASE/logs/catalina.out\" 2>&1"

(add the --name argument).

This will make runscript's start-stop-daemon recognize the process started by Bash with exec.

Another solution would be to remove "exec" from this command line. This way, the Bash process would be left hanging waiting for the Java process to finish, and start-stop-daemon would recognize this Bash process as the daemon process.

Note that the "native" start-stop-daemon program doesn't have this problem. It either doesn't check that the process still runs, or is able to recognize the process even after Bash does exec.
Comment 3 Andy Dalton 2011-02-14 03:49:26 UTC
This affects www-servers/tomcat-6.0.32-r1 as well.  The suggestion from Comment #2 resolved the problem.
Comment 4 Max Nokhrin 2011-02-14 22:27:07 UTC
Thanks for the hint, reporting that 6.0.32-r1 works with the change as per Comment #2. As a note, the start-stop-daemon call in the if just two lines above already has the --exec param, but it was missing from the else.
Comment 5 Max Nokhrin 2011-02-14 22:35:17 UTC
(In reply to comment #2)
> Another solution would be to remove "exec" from this command line. This way,
> the Bash process would be left hanging waiting for the Java process to finish,
> and start-stop-daemon would recognize this Bash process as the daemon process.

Actually, this didn't fix it for me. I had no --exec argument in the command line, but start-stop-daemon never caught the start up. It did hang for a bit, but maybe timeout in any case before tomcat started fully.
Comment 6 Joerg Schaible 2011-02-14 22:51:35 UTC
6.0.32-r1 went stable now with this bug (amd64)
Comment 7 Miroslav Šulc gentoo-dev 2011-02-14 22:56:07 UTC
it was stabilized because of security issues, see bug #329937. i will commit the fix in few mins, just working on it.
Comment 8 Miroslav Šulc gentoo-dev 2011-02-14 23:11:17 UTC
fixed in tomcat-6.0.32-r2 (it will take some time till the ebuild reaches portage mirrors). this ebuild is not stable (is ~arch) so you have to unmask it to use it if you are not on ~arch. i used the --name fix.

thanks for the fix and feedback.
Comment 9 Fabio Bonfante 2011-03-14 01:52:07 UTC
the fix works for the start command... but now 'stop' has the same problem for me... some ideas?