It's flaky in 2.4.x, 2.5.x, and main on Windows and Linux and on a variety of different JDKs. I suspect that it may be a Jetty bug but we'll have to be able to reproduce the problem reliably to pursue that avenue.
Comment From: wilkinsona
I no longer think it's a Jetty bug. The problem is Jetty-specific due to a difference in its behaviour that exposes a shortcoming in the test. Stopping the web server interrupts the thread that's handling the active request. This initiates a race between the request-handling thread which will decrement the number of active requests and the main thread that expects an active request to cause the shutdown result to be REQUESTS_ACTIVE
. The test passes when the main thread wins and fails when the request-handling thread wins. The blocking servlet that's used to stall a request and keep it active needs to be updated to ignore the thread being interrupted and continue waiting.