Bug 61682 - StackOverflowError while executing HTTP/2 Server Push
Summary: StackOverflowError while executing HTTP/2 Server Push
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 9
Classification: Unclassified
Component: Connectors (show other bugs)
Version: 9.0.1
Hardware: PC All
: P2 normal (vote)
Target Milestone: -----
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-27 16:38 UTC by Michael Ernst
Modified: 2017-11-24 09:45 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Ernst 2017-10-27 16:38:32 UTC
While pushing some resources from the Server I received the following StackOverflowError sometimes when refreshing my page (the resource failed to load of course). 

```
Okt 27, 2017 3:10:26 PM org.apache.coyote.AbstractProtocol$ConnectionHandler process
SEVERE: Error reading request, ignored
java.lang.StackOverflowError
	at java.util.concurrent.ConcurrentHashMap$BaseIterator.<init>(ConcurrentHashMap.java:3391)
	at java.util.concurrent.ConcurrentHashMap$KeyIterator.<init>(ConcurrentHashMap.java:3410)
	at java.util.concurrent.ConcurrentHashMap$KeySetView.iterator(ConcurrentHashMap.java:4578)
	at java.util.Collections$SetFromMap.iterator(Collections.java:5462)
	at org.apache.coyote.http2.AbstractStream.isDescendant(AbstractStream.java:69)
	at org.apache.coyote.http2.AbstractStream.isDescendant(AbstractStream.java:70)
	at org.apache.coyote.http2.AbstractStream.isDescendant(AbstractStream.java:70)
	at org.apache.coyote.http2.AbstractStream.isDescendant(AbstractStream.java:70)
	at org.apache.coyote.http2.AbstractStream.isDescendant(AbstractStream.java:70)
	at org.apache.coyote.http2.AbstractStream.isDescendant(AbstractStream.java:70)
```
Comment 1 Remy Maucherat 2017-11-03 14:44:01 UTC
Please provide a test case.
Comment 2 Mark Thomas 2017-11-15 22:37:01 UTC
I've managed to find a way to reproduce this. The logic for re-prioritising streams doesn't always remove children from their old parent when they are re-prioritised. With the right sequence of moves, you can generate circular references.
Comment 3 Mark Thomas 2017-11-16 10:16:12 UTC
Thanks for the report.
Fixed in:
- trunk for 9.0.2 onwards
- 8.5.x for 8.5.24 onwards
Comment 4 Michael Ernst 2017-11-24 09:45:12 UTC
Hi Mark, thanks for fix. I had a look into the commit and I guess I wouldn't be able to provide such a test case without having a deeper knowledge about the code base.