aizu-m opened a new pull request, #121:
URL: https://github.com/apache/poi-xmlbeans/pull/121

   jstack of the test JVM, 30 minutes into a two-test class:
   
       "Test worker" #1 prio=5 cpu=1834450.76ms elapsed=1895.28s runnable
          java.lang.Thread.State: RUNNABLE
           at 
org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:208)
           at 
org.apache.xmlbeans.impl.schema.ParseUrlRedirectTest.doesNotFollowRedirectsOffHttp(ParseUrlRedirectTest.java:98)
   
   Found while checking what `parse(URL)` does with a 302 whose `Location` is 
not http. The loop takes the header verbatim and `HttpURLConnection` refuses 
cross-protocol redirects itself, so I expected the `file:` target to be opened. 
It never got that far. `redirected` is only re-evaluated inside the `instanceof 
HttpURLConnection` branch, so a `file:`, `ftp:` or `jar:` hop leaves it `true` 
and the loop calls `openConnection()` forever at 100% CPU. One response from 
any server the caller points at, or from a `schemaLocation` host when downloads 
are enabled, hangs the calling thread.
   
   The fix follows a redirect only when its target is http or https, which is 
what this loop exists for. Anything else ends the loop the way a missing 
`Location` does, and the redirect body is parsed. Regression test added to 
`ParseUrlRedirectTest`: on trunk it fails with `execution timed out after 30000 
ms`, with the fix it passes in a few ms.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to