Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[JENKINS-42159] If startup fails, exit the process.
As it stands right now, empty Jetty keeps running and makes it difficult
to detect catastrophic boot error.

The code change makes any exception thrown from ServletContextListener a
fatal problem.
  • Loading branch information
kohsuke committed Feb 17, 2017
1 parent 7e2241e commit 20cbb8a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/java/winstone/HostConfiguration.java
Expand Up @@ -180,6 +180,7 @@ public void postConfigure() throws Exception {
}
};
wac.getSecurityHandler().setLoginService(loginService);
wac.setThrowUnavailableOnStartupException(true); // if boot fails, abort the process instead of letting empty Jetty run
wac.setMimeTypes(mimeTypes);
SessionManager sm = wac.getSessionHandler().getSessionManager();
sm.setSessionTrackingModes(Collections.singleton(SessionTrackingMode.COOKIE)); // disable URL-rewrite based session tracking, which leaks session ID. See JENKINS-22358
Expand Down
1 change: 1 addition & 0 deletions src/java/winstone/Launcher.java
Expand Up @@ -352,6 +352,7 @@ public static void main(String argv[]) throws IOException {
new Launcher(args);
} catch (Throwable err) {
Logger.log(Logger.ERROR, RESOURCES, "Launcher.ContainerStartupError", err);
System.exit(1);
}
}

Expand Down

0 comments on commit 20cbb8a

Please sign in to comment.