[
https://issues.apache.org/jira/browse/OOZIE-2636?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15421938#comment-15421938
]
Satish Subhashrao Saley commented on OOZIE-2636:
------------------------------------------------
We throw an exception if user is trying to read the logs beyond certain time
limit.
{code}
void org.apache.oozie.util.XLogFilter.calculateAndValidateDateRange(Date
jobStartTime, Date jobEndTime) throws IOException
if (diffHours > logDuration) {
throw new IOException(
"Request log streaming time range is higher than
configured. Please reduce the scan time range. For coord"
+ " jobs you can provide action list to reduce
log scan time range. Input range (hours) = "
+ diffHours + " system allowed (hours) = " +
logDuration);
}
{code}
Then, in the finally block, we flush (nothing) to the writer.
{code}
void org.apache.oozie.service.ZKXLogStreamingService.collateLogs(XLogFilter
filter, Date startTime, Date endTime, Writer writer, Map<String, String[]>
params, String logPath, String logName, int rotation, String logType) throws
IOException
finally {
for (TimestampedMessageParser parser : parsers) {
parser.closeReader();
}
writer.flush();
}
{code}
Later on, we try to write the response with error code and error message which
throws exception
{code}
void org.apache.oozie.servlet.JsonRestServlet.service(HttpServletRequest
request, HttpServletResponse response) throws ServletException, IOException
catch (XServletException ex) {
XLog log = XLog.getLog(getClass());
log.warn("URL[{0} {1}] error[{2}], {3}", request.getMethod(),
getRequestUrl(request), ex.getErrorCode(), ex
.getMessage(), ex);
request.setAttribute(AUDIT_ERROR_MESSAGE, ex.getMessage());
request.setAttribute(AUDIT_ERROR_CODE,
ex.getErrorCode().toString());
request.setAttribute(AUDIT_HTTP_STATUS_CODE,
ex.getHttpStatusCode());
incrCounter(INSTR_TOTAL_FAILED_REQUESTS_COUNTER, 1);
sendErrorResponse(response, ex.getHttpStatusCode(),
ex.getErrorCode().toString(), ex.getMessage());
}
{code}
We get IllegalStateException as
{code}
java.lang.IllegalStateException: Committed
at org.eclipse.jetty.server.Response.resetBuffer(Response.java:1242)
at
javax.servlet.ServletResponseWrapper.resetBuffer(ServletResponseWrapper.java:241)
at
org.eclipse.jetty.servlets.gzip.CompressedResponseWrapper.resetBuffer(CompressedResponseWrapper.java:272)
at
org.eclipse.jetty.servlets.gzip.CompressedResponseWrapper.sendError(CompressedResponseWrapper.java:297)
at
javax.servlet.http.HttpServletResponseWrapper.sendError(HttpServletResponseWrapper.java:167)
at
javax.servlet.http.HttpServletResponseWrapper.sendError(HttpServletResponseWrapper.java:167)
at
org.apache.oozie.servlet.JsonRestServlet.sendErrorResponse(JsonRestServlet.java:404)
at
org.apache.oozie.servlet.JsonRestServlet.service(JsonRestServlet.java:314)
{code}
Solution:
Flush to the writer only if there is no exception.
Also, this depends on the web server. I saw this with jetty.
> Premature EOF while querying for logs
> -------------------------------------
>
> Key: OOZIE-2636
> URL: https://issues.apache.org/jira/browse/OOZIE-2636
> Project: Oozie
> Issue Type: Bug
> Reporter: Satish Subhashrao Saley
> Assignee: Satish Subhashrao Saley
>
> -bash-4.1$ oozie job --oozie http://localhost:11000/oozie/ -log
> 5623294-160209103417338-oozie-W -auth kerberos
> Error: IO_ERROR : java.io.IOException: Premature EOF
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)