diff --git a/akka-http-core/src/main/scala/akka/http/impl/util/StreamUtils.scala b/akka-http-core/src/main/scala/akka/http/impl/util/StreamUtils.scala index 83277829e9..793d48c11b 100644 --- a/akka-http-core/src/main/scala/akka/http/impl/util/StreamUtils.scala +++ b/akka-http-core/src/main/scala/akka/http/impl/util/StreamUtils.scala @@ -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. */ diff --git a/akka-http-core/src/main/scala/akka/http/scaladsl/Http.scala b/akka-http-core/src/main/scala/akka/http/scaladsl/Http.scala index 130d8efca3..8f5ff87990 100644 --- a/akka-http-core/src/main/scala/akka/http/scaladsl/Http.scala +++ b/akka-http-core/src/main/scala/akka/http/scaladsl/Http.scala @@ -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() } diff --git a/akka-http-core/src/main/scala/akka/http/scaladsl/model/HttpMessage.scala b/akka-http-core/src/main/scala/akka/http/scaladsl/model/HttpMessage.scala index cfb50fb29d..0320bdd32b 100644 --- a/akka-http-core/src/main/scala/akka/http/scaladsl/model/HttpMessage.scala +++ b/akka-http-core/src/main/scala/akka/http/scaladsl/model/HttpMessage.scala @@ -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")