=htc #17992 prevent single failing server connections from cancelling the binding
This commit is contained in:
parent
b137117399
commit
9000c15e51
3 changed files with 11 additions and 3 deletions
|
|
@ -278,7 +278,7 @@ private[http] object StreamUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a no-op flow that materialized to a future that will be completed when the flow gets a
|
||||
* Returns a no-op flow that materializes to a future that will be completed when the flow gets a
|
||||
* completion or error signal. It doesn't necessarily mean, though, that all of a streaming pipeline
|
||||
* is finished, only that the part that contains this flow has finished work.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -94,7 +94,15 @@ class HttpExt(config: Config)(implicit system: ActorSystem) extends akka.actor.E
|
|||
}
|
||||
|
||||
bind(interface, port, settings, httpsContext, log)
|
||||
.mapAsyncUnordered(settings.maxConnections)(handleOneConnection)
|
||||
.mapAsyncUnordered(settings.maxConnections) { connection ⇒
|
||||
handleOneConnection(connection).recoverWith {
|
||||
// Ignore incoming errors from the connection as they will cancel the binding.
|
||||
// As far as it is known currently, these errors can only happen if a TCP error bubbles up
|
||||
// from the TCP layer through the HTTP layer to the Http.IncomingConnection.flow.
|
||||
// See https://github.com/akka/akka/issues/17992
|
||||
case NonFatal(_) ⇒ Future.successful(())
|
||||
}(fm.executionContext)
|
||||
}
|
||||
.to(Sink.ignore)
|
||||
.run()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ final case class HttpRequest(method: HttpMethod = HttpMethods.GET,
|
|||
entity: RequestEntity = HttpEntity.Empty,
|
||||
protocol: HttpProtocol = HttpProtocols.`HTTP/1.1`) extends jm.HttpRequest with HttpMessage {
|
||||
HttpRequest.verifyUri(uri)
|
||||
require(entity.isKnownEmpty || method.isEntityAccepted, "Requests with this method must have an empty entity")
|
||||
require(entity.isKnownEmpty || method.isEntityAccepted, s"Requests with method '${method.value}' must have an empty entity")
|
||||
require(protocol != HttpProtocols.`HTTP/1.0` || !entity.isInstanceOf[HttpEntity.Chunked],
|
||||
"HTTP/1.0 requests must not have a chunked entity")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue