You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "Otto Fowler (Jira)" <ji...@apache.org> on 2019/09/13 13:48:00 UTC

[jira] [Comment Edited] (NIFI-6661) HandleHttpRequest - Failed to receive content from HTTP Request

    [ https://issues.apache.org/jira/browse/NIFI-6661?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16929208#comment-16929208 ] 

Otto Fowler edited comment on NIFI-6661 at 9/13/19 1:47 PM:
------------------------------------------------------------

That error handling removes the flow file from the session, so it is "gone" after that.


{code:java}
 protected void handleFlowContentStreamingError(final ProcessSession session, HttpRequestContainer container,
        final HttpServletRequest request, Optional<FlowFile> flowFile, final Exception e) {
      // There may be many reasons which can produce an IOException on the HTTP stream and in some of them, eg.
      // bad requests, the connection to the client is not closed. In order to address also these cases, we try
      // and answer with a BAD_REQUEST, which lets the client know that the request has not been correctly
      // processed and makes it aware that the connection can be closed.
      getLogger().error("Failed to receive content from HTTP Request from {} due to {}",
              new Object[]{request.getRemoteAddr(), e});
      if (flowFile.isPresent())
        session.remove(flowFile.get());

      try {
          HttpServletResponse response = container.getResponse();
          response.sendError(HttpServletResponse.SC_BAD_REQUEST);
          container.getContext().complete();
      } catch (final IOException ioe) {
          getLogger().warn("Failed to send HTTP response to {} due to {}",
                  new Object[]{request.getRemoteAddr(), ioe});
      }
    }

{code}



was (Author: ottobackwards):
That error handling removes the flow file from the session, so it is "gone" after that.


{code:java}
 protected void handleFlowContentStreamingError(final ProcessSession session, HttpRequestContainer container,
        final HttpServletRequest request, Optional<FlowFile> flowFile, final Exception e) {
      // There may be many reasons which can produce an IOException on the HTTP stream and in some of them, eg.
      // bad requests, the connection to the client is not closed. In order to address also these cases, we try
      // and answer with a BAD_REQUEST, which lets the client know that the request has not been correctly
      // processed and makes it aware that the connection can be closed.
      getLogger().error("Failed to receive content from HTTP Request from {} due to {}",
              new Object[]{request.getRemoteAddr(), e});
      if (flowFile.isPresent())
        *session.remove(flowFile.get());*

      try {
          HttpServletResponse response = container.getResponse();
          response.sendError(HttpServletResponse.SC_BAD_REQUEST);
          container.getContext().complete();
      } catch (final IOException ioe) {
          getLogger().warn("Failed to send HTTP response to {} due to {}",
                  new Object[]{request.getRemoteAddr(), ioe});
      }
    }

{code}


> HandleHttpRequest - Failed to receive content from HTTP Request
> ---------------------------------------------------------------
>
>                 Key: NIFI-6661
>                 URL: https://issues.apache.org/jira/browse/NIFI-6661
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Core Framework
>    Affects Versions: 1.9.2
>            Reporter: William Gosse
>            Priority: Major
>
> I have had couple occurrence of the following exception occurring on an HandleHttpRequest pprocessor:
> nifi-app_2019-09-06_12.0.log:2019-09-06 12:24:48,132 ERROR [Timer-Driven Process Thread-3] o.a.n.p.standard.HandleHttpRequest HandleHttpRequest[id=6ceef915-4430-30fa-09d2-b12bb2142172] Failed to receive content from HTTP Request from 108.26.163.22 due to java.io.IOException: java.util.concurrent.TimeoutException: Idle timeout expired: 600001/600000 ms: java.io.IOException: java.util.concurrent.TimeoutException: Idle timeout expired: 600001/600000 ms
>  
> When it occurs the HandleHttpRequest processor stops excepting requests and I have to restart nifi in order to recover.
>  
> Is there anything I can do to better handle this exception?
> Also I only see this happening with one of my user who may be ealing with network latency.
> I have not been able to recreate the issue myself with this exact excetion message. However the fact the it causes HandleHttpRequest processor to stop functioning seems serious to me. 
> The only time that ever happened to me is when it to  long to get to the HandleHttpResponse. I currently have the Request Expiration property for my StandardHttpContextMap set to 10 minutes. If the this value is exceeded the HandleHttpRequest hangs up.  In this specific issue that time out also was reached but it seems that the flow never got beyond the HandleHttpRequest.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)