The problem here is that we need to call complete() on the same thread that receives the onTimeout() (see eclipse/jetty.project#6227). Instead of racing a timeout response against the service response and rendering the winner, we race a unit callback against the service response, and render the timeout response using the Servlet API. We only call context.complete() wherever we actually render the response.
Should fix the issue in http4s/http4s-jetty#118.
The problem here is that we need to call
complete()
on the same thread that receives theonTimeout()
(see eclipse/jetty.project#6227). Instead of racing a timeout response against the service response and rendering the winner, we race a unit callback against the service response, and render the timeout response using the Servlet API. We only callcontext.complete()
wherever we actually render the response.