Bug 64859

Summary: Assertion errros org.apache.catalina.mapper.Mapper.internalMap(Mapper.java:744)
Product: Tomcat 9 Reporter: marcin borcz <marcin.borcz>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED INVALID    
Severity: normal CC: marcin.borcz
Priority: P2    
Version: 9.0.34   
Target Milestone: -----   
Hardware: All   
OS: Linux   
Attachments: Full stacktraces for mentioned log entries

Description marcin borcz 2020-10-29 11:14:41 UTC
Created attachment 37538 [details]
Full stacktraces for mentioned log entries

We had observed the following assertion errors, total 356 cases.

"java.lang.AssertionError
   at org.apache.catalina.mapper.Mapper.internalMap(Mapper.java:744)"

Above errors were preceded by the two log info entries

"org.apache.catalina.connector.CoyoteAdapter.checkRecycled 
Encountered a non-recycled request and recycled it forcedly.
org.apache.catalina.connector.CoyoteAdapter$RecycleRequiredException"

"org.apache.coyote.http11.Http11Processor.service Error parsing HTTP request header
 Note: further occurrences of HTTP request parsing errors will be logged at DEBUG level.
java.lang.IllegalStateException: Unexpected state: headers already parsed. Buffer not recycled?"

Full log entries are in the attachment.

Assertion errors had occurred for 2 hours and then the problem disappeared. After a few hours, we had noticed another two cases this time not preceded by any connected log entries. After that, we restarted the problematic instance and the situation has not repeated anymore.

Almost the same configuration and application are in use for weeks so it's rather not an issue.

Application and installation:
Spring Boot 2.0 + Vaadin 8 
The application running in Kubernetes based on image tomcat:9.0.34-jdk8-openjdk-slim
Comment 1 Mark Thomas 2020-10-29 19:26:32 UTC
This is typically caused by an application or library retaining a reference to a request, response, InputStream, OutputStream etc. beyond the lifetime of the original request (Tomcat recycles these objects and you end up with two threads trying to use the same object).

The users list is usually the best place to debug issues such as these.

If you are sure a reference is not being retained and you are able to reproduce this issue feel free to re-open this report and provide the necessary steps to recreate the issue from a clean install of the latest release of a currently supported Tomcat major version (e.g. 9.0.x).