HADOOP-18077. ProfileOutputServlet unable to proceed due to NPE (#3875)
This commit is contained in:
parent
e2d620192a
commit
93294f0329
@ -772,10 +772,11 @@ private void initializeWebServer(String name, String hostName,
|
||||
|
||||
addDefaultServlets();
|
||||
addPrometheusServlet(conf);
|
||||
addAsyncProfilerServlet(contexts);
|
||||
addAsyncProfilerServlet(contexts, conf);
|
||||
}
|
||||
|
||||
private void addAsyncProfilerServlet(ContextHandlerCollection contexts) throws IOException {
|
||||
private void addAsyncProfilerServlet(ContextHandlerCollection contexts, Configuration conf)
|
||||
throws IOException {
|
||||
final String asyncProfilerHome = ProfileServlet.getAsyncProfilerHome();
|
||||
if (asyncProfilerHome != null && !asyncProfilerHome.trim().isEmpty()) {
|
||||
addServlet("prof", "/prof", ProfileServlet.class);
|
||||
@ -787,6 +788,7 @@ private void addAsyncProfilerServlet(ContextHandlerCollection contexts) throws I
|
||||
genCtx.addServlet(ProfileOutputServlet.class, "/*");
|
||||
genCtx.setResourceBase(tmpDir.toAbsolutePath().toString());
|
||||
genCtx.setDisplayName("prof-output-hadoop");
|
||||
setContextAttributes(genCtx, conf);
|
||||
} else {
|
||||
addServlet("prof", "/prof", ProfilerDisabledServlet.class);
|
||||
LOG.info("ASYNC_PROFILER_HOME environment variable and async.profiler.home system property "
|
||||
|
@ -36,9 +36,15 @@ protected void doGet(final HttpServletRequest req, final HttpServletResponse res
|
||||
throws IOException {
|
||||
resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
|
||||
ProfileServlet.setResponseHeader(resp);
|
||||
// TODO : Replace github.com link with
|
||||
// https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-common/
|
||||
// AsyncProfilerServlet.html once Async profiler changes are released
|
||||
// in 3.x (3.4.0 as of today).
|
||||
resp.getWriter().write("The profiler servlet was disabled at startup.\n\n"
|
||||
+ "Please ensure the prerequisites for the Profiler Servlet have been installed and the\n"
|
||||
+ "environment is properly configured.");
|
||||
+ "environment is properly configured. \n\n"
|
||||
+ "For more details, please refer to: https://github.com/apache/hadoop/blob/trunk/"
|
||||
+ "hadoop-common-project/hadoop-common/src/site/markdown/AsyncProfilerServlet.md");
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user