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 | Reporter: | Andrew Garland <andrew.garland> |
Component: | Catalina | Assignee: | Tomcat Developers Mailing List <dev> |
Status: | RESOLVED FIXED | ||
Severity: | major | ||
Priority: | P2 | ||
Version: | 8.5.11 | ||
Target Milestone: | ---- | ||
Hardware: | PC | ||
OS: | All | ||
Attachments: |
Some pieces of the full trace showing the issue
Recoded RecycledProcessors |
Description
Andrew Garland
2017-03-24 17:43:14 UTC
To me, there are two separate issues here: 1. The logic for pushing the processor back in send file case has some flaw. 2. RecycledProcessors should protect against the same instance being in the stack more than once, as a defense against this flaw or any future flaws that result in mistakenly putting the same processor in twice. Thanks for the report and especially the debug logs. I was able to pin-point the root cause very quickly from those. Are you able to build Tomcat from svn in order to confirm a fix? i haven't before, but I am sure I could :) Please point me at BUILD instructions. These are the instructions for 9.0.x https://svn.apache.org/viewvc/tomcat/trunk/BUILDING.txt?view=markup 8.5.x is very similar, just a different svn path and a different minimum Java version. Both 9.0.x and 8.5.x have the fix. I'm currently working on a back-port to 8.0.x. thanks for the info. Can you point me to the commit diff? Just curious. FYI, minor typo in changelog subsequent requests experiencing and <code>IllegalStateException</code>. "and" -> "an" 8.0.x and earlier are not affected. This bug was introduced by the refactoring in 8.5.x onwards. Created attachment 34877 [details]
Recoded RecycledProcessors
The problem does not recur using the version built from trunk! Thanks for the rapid turnaround. I guess it will be a month or two before this is part of an official release?
FYI, I had also prevented the problem by re-coding the RecycledProcessors class to check for existence before pushing onto the stack. This was quick and dirty and would not scale, but food for thought.
We'll probably start the release process next week. It is normally started around the beginning of the every month but the first week of April is looking busy for me. We could delay it but there is enough in the changelog to justify a release. (In reply to Andrew Garland from comment #9) > Created attachment 34877 [details] > Recoded RecycledProcessors > > The problem does not recur using the version built from trunk! Thanks for > the rapid turnaround. I guess it will be a month or two before this is part > of an official release? > > FYI, I had also prevented the problem by re-coding the RecycledProcessors > class to check for existence before pushing onto the stack. This was quick > and dirty and would not scale, but food for thought. And we're not going to do that :) Fixed in: - trunk for 9.0.0.M19 onwards - 8.5.x for 8.5.13 onwards Who can provide the test code for the recurrence of this bug |