Bug 376365 - "jetty.sh start" returns 0 on failure
Summary: "jetty.sh start" returns 0 on failure
Status: RESOLVED FIXED
Alias: None
Product: Jetty
Classification: RT
Component: start (show other bugs)
Version: 8.1.2   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 7.6.x   Edit
Assignee: Joakim Erdfelt CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-09 18:16 EDT by J Li CLA
Modified: 2014-09-24 13:01 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description J Li CLA 2012-04-09 18:16:28 EDT
Build Identifier: 8.1.2

The jetty.sh script echos "FAILED" but falls through and exits 0.  This can cause issues if jetty.sh is invoked using any method that expects the exit code to indicate success/failure of the command.

~/Desktop/jetty-distribution-8.1.2.v20120308$ ./bin/jetty.sh start
Starting Jetty: FAILED
~/Desktop/jetty-distribution-8.1.2.v20120308$ echo $?
0

If start-stop-daemon is available, start.log will include the error (in this case, I purposely broke one of Jetty's config xml's):
Establishing start.log on Mon Apr 09 15:03:23 PDT 2012
2012-04-09 15:03:23.648:INFO::Redirecting stderr/stdout to /home/jli/Desktop/jetty-distribution-8.1.2.v20120308/logs/2012_04_09.stderrout.log
2012-04-09 15:03:23.676:WARN:oejx.XmlParser:FATAL@file:/home/jli/Desktop/jetty-distribution-8.1.2.v20120308/etc/jetty.xml line:79 col:1 : org.xml.sax.SAXParseException; systemId: file:/home/jli/Desktop/jetty-distribution-8.1.2.v20120308/etc/jetty.xml; lineNumber: 79; columnNumber: 1; XML document structures must start and end within the same entity.

However, because the failure is within Jetty (and not in start-stop-daemon), a pid file (/tmp/jetty.pid) is created.  A call to "jetty.sh check" will return the pid file of the failed start up.

Reproducible: Always

Steps to Reproduce:
1. Break start up (e.g. introduce an XML error in one of the configuration xml's)
2. Execute: ./bin/jetty.sh start
Comment 1 Joakim Erdfelt CLA 2014-09-24 13:01:10 EDT
fix applied to branch [jetty-9.2.x] in commit 3a8488a089af058abdc0b5323b6a642d9ebb2662