https://bz.apache.org/bugzilla/show_bug.cgi?id=60918

            Bug ID: 60918
           Summary: Process Send File releases the same Http11Processor in
                    two threads, leading to
                    java.lang.IllegalStateException: Unexpected state:
                    headers already parsed. Buffer not recycled?
           Product: Tomcat 8
           Version: 8.5.11
          Hardware: PC
            Status: NEW
          Severity: major
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: andrew.garl...@sunbirddcim.com
  Target Milestone: ----

Created attachment 34876
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=34876&action=edit
Some pieces of the full trace showing the issue

This is a similar report to
https://bz.apache.org/bugzilla/show_bug.cgi?id=58646 but whatever fix was done
in that case does not prevent this issue.

Basic outline:

1. thread http-nio-8080-exec-1 processes a request that will result in send
file.  It pops Http11Processor@8dc1458 from recycledProcessors
2. The send file action is completed in thread http-nio-8080-ClientPoller-0. 
Then that thread is done, it pushes Http11Processor@8dc1458 onto
recycledProcessors
3. A few milliseconds later, http-nio-8080-exec-1 also pushes
Http11Processor@8dc1458 onto recycledProcessors, so now that one processor is
in the list of recycledProcessors twice
4. Eventually, two nio exec threads both pop that one instance off of
recycledProcessors

4A.  The second thread to use it throws

24-Mar-2017 12:08:08.093 INFO [http-nio-8080-exec-1]
org.apache.coyote.http11.Http11Processor.service Error parsing HTTP request
header
 Note: further occurrences of HTTP header parsing errors will be logged at
DEBUG level.
 java.lang.IllegalStateException: Unexpected state: headers already parsed.
Buffer not recycled?
        at
org.apache.coyote.http11.Http11InputBuffer.parseHeaders(Http11InputBuffer.java:554)
        at
org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:683)


4B.  The first thread, which completes after the second one, throws

24-Mar-2017 12:08:08.833 SEVERE [http-nio-8080-exec-7]
org.apache.coyote.http11.Http11Processor.service Error processing request
 java.lang.NullPointerException
        at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:389)
        at
org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:783)

and then

24-Mar-2017 12:08:08.849 SEVERE [http-nio-8080-exec-7]
org.apache.coyote.http11.Http11Processor.endRequest Error finishing response
 java.lang.NullPointerException
        at
org.apache.coyote.http11.Http11OutputBuffer.commit(Http11OutputBuffer.java:351)
        at
org.apache.coyote.http11.Http11Processor.prepareResponse(Http11Processor.java:1288)
        at
org.apache.coyote.AbstractProcessor.action(AbstractProcessor.java:254)
        at
org.apache.coyote.http11.Http11Processor.endRequest(Http11Processor.java:1457)
        at
org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:823)

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to