Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 316976

Summary: Jetty.sh fails to start jetty due to incorrect quoting of start-stop-daemon arguments
Product: [RT] Jetty Reporter: Barry Pearce <netsupport>
Component: otherAssignee: Joakim Erdfelt <joakim.erdfelt>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: gregw, joakim.erdfelt, mgorovoy
Version: 7.1.4   
Target Milestone: 7.1.x   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Barry Pearce CLA 2010-06-15 16:54:06 EDT
Build Identifier: jetty-hightide-7.1.4.v20100610.tar.gz

Ubuntu Karmic Koala 9.10 fully updated. Sun java 6 packages.
7.1.3 works fine. 
Having fixed #316970 (https://bugs.eclipse.org/bugs/show_bug.cgi?id=316970)
AND
Having fixed #316973 (https://bugs.eclipse.org/bugs/show_bug.cgi?id=316973)
7.1.4 fails now fails with starting with 'FAILED'. without any logging.

Running bash -xv /etc/init.d/jetty gives the final output as:

+ case "$ACTION" in
+ echo -n 'Starting Jetty: '
Starting Jetty: + ((  NO_START  ))
+ type start-stop-daemon
+ unset CH_USER
+ '[' -n '' ']'
+ start-stop-daemon -S -p/var/run/jetty.pid -d/usr/local/jetty -b -m -a /usr/lib/jvm/java-6-sun/jre/bin/java -- '-Xmx512m -Djava.library.path=lib/ext' -Djetty.logs=/var/log/jetty -Djetty.home=/usr/local/jetty -Djava.io.tmpdir=/tmp -jar /usr/local/jetty/start.jar OPTIONS=Server,resources etc/jetty.xml etc/jetty-ssl.xml --daemon
process already running.

exit 0
+ exit 0


There are single quotes around the JAVA_OPTIONS derived arguments. A cut-and-paste of this results in no output and no jetty daemon. Removing the quotes and executing:

start-stop-daemon -S -p/var/run/jetty.pid -d/usr/local/jetty -b -m -a /usr/lib/jvm/java-6-sun/jre/bin/java -- -Xmx512m -Djava.library.path=lib/ext -Djetty.logs=/var/log/jetty -Djetty.home=/usr/local/jetty -Djava.io.tmpdir=/tmp -jar /usr/local/jetty/start.jar OPTIONS=Server,resources etc/jetty.xml etc/jetty-ssl.xml --daemon

Works correctly.

Reproducible: Always

Steps to Reproduce:
1. Fix #316970
2. Run in a root shell with JAVA_HOME set.
3. /etc/init.d/jetty start
Comment 1 Joakim Erdfelt CLA 2010-06-15 17:38:11 EDT
Unable to reproduce with Ubuntu Lucid 10.04 LTS.

Works as expected.

[joakim@lapetus jetty]$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 10.04 LTS
Release:	10.04
Codename:	lucid
[joakim@lapetus jetty]$ java -version
java version "1.6.0_14"
Java(TM) SE Runtime Environment (build 1.6.0_14-b08)
Java HotSpot(TM) Server VM (build 14.0-b16, mixed mode)


Slightly related...
I see that you have jetty again in /usr/local/jetty
Would you like to participate in the testing of the new jetty-distribution debian distribution testing?
Comment 2 Barry Pearce CLA 2010-06-16 05:25:00 EDT
# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 9.10
Release:        9.10
Codename:       karmic

# java -version
java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode, sharing)


> Slightly related...
> I see that you have jetty again in /usr/local/jetty
> Would you like to participate in the testing of the new jetty-distribution
> debian distribution testing?

Hmm. Why do you say 'again'? We took the hightide tar-gzip distribution from download and install it ourselves to that location. I know Ubuntu's releases are based on the jetty stable - but jetty 6 is too backwards for us to develop against.

What's involved?
Comment 3 Barry Pearce CLA 2010-06-16 05:31:51 EDT
In /etc/default/jetty

JETTY_ARGS="OPTIONS=Server,resources etc/jetty.xml etc/jetty-ssl.xml"
JETTY_LOGS=/var/log/jetty
JAVA_OPTIONS="-Xmx512m -Djava.library.path=lib/ext"
TMP=/var/cache/jetty
TMPDIR=$TMP
Comment 4 Barry Pearce CLA 2010-06-16 05:37:09 EDT
Actually to avoid polluting this bug report...can we take the chat of distribution testing offline to email?
Cheers.
Comment 5 Joakim Erdfelt CLA 2010-06-16 17:46:39 EDT
Able to reproduce with the following technique ...

Test 1:
Create a $HOME/.jettyrc file with the following line:
--(snip)--
JAVA_OPTIONS="-Xmx512m -Djava.library.path=lib/ext"
--(snip)--

Then start with "bin/jetty.sh start" any distribution.

Curiously, this file is just sourced early in the script.

Test 2:
You cannot replicate the problem with declaring an environment variable before startup of jetty.

With no /etc/default/jetty or $HOME/.jettyrc create the following environment variable:
$ export JAVA_OPTIONS="-Xmx512m -Djava.library.path=lib/ext"

Then attempt to start Jetty.  It works.
Comment 6 Joakim Erdfelt CLA 2010-06-16 17:47:56 EDT
The quotes you seeing are coming from the quotes in the /etc/default/jetty file.
Trying to remove them with a few bash hacks results in regressions on entries that require quoting (/me shakes fist at cygwin!)

Any suggestions?
Comment 7 Greg Wilkins CLA 2010-06-16 20:54:26 EDT
I've committed (r2021) a potential fix that removes the quoting of JETTY_OPTIONS.

It is working for my limited testing, but Joakim will test in more environments tomorrow.
Comment 8 Joakim Erdfelt CLA 2011-08-22 16:08:36 EDT
Unable to replicate the existing bug through various testing.
Considering this fixed.