Skip to content

Commit

Permalink
Remove body read timeout feature
Browse files Browse the repository at this point in the history
The goal of the feature was to prevent long body reads in GCP, this however does
not prevent the slow incoming connection handling at the framework level.
Therefore, as this adds unnecessary complexity with possible negative
performance impact, the feature is removed.

The configuration parameter is no longer used, but can remain as is.
  • Loading branch information
peel committed Sep 3, 2024
1 parent ffff1e0 commit 1a34e95
Show file tree
Hide file tree
Showing 25 changed files with 2 additions and 78 deletions.
1 change: 0 additions & 1 deletion core/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@
maxConnections = 1024
idleTimeout = 610 seconds
responseHeaderTimeout = 5 seconds
bodyReadTimeout = 1 second
maxRequestLineLength = 20480
maxHeadersLength = 40960
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ object Config {
maxConnections: Int,
idleTimeout: FiniteDuration,
responseHeaderTimeout: FiniteDuration,
bodyReadTimeout: FiniteDuration,
maxRequestLineLength: Int,
maxHeadersLength: Int
)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
*/
package com.snowplowanalytics.snowplow.collector.core

import scala.concurrent.duration.FiniteDuration
import cats.implicits._
import cats.effect.{Async, Sync}
import org.http4s._
Expand All @@ -22,7 +21,6 @@ class Routes[F[_]: Async](
enableDefaultRedirect: Boolean,
enableRootResponse: Boolean,
enableCrossdomainTracking: Boolean,
bodyReadTimeout: FiniteDuration,
service: IService[F]
) extends Http4sDsl[F] {

Expand Down Expand Up @@ -51,7 +49,7 @@ class Routes[F[_]: Async](
case req @ POST -> Root / vendor / version =>
val path = service.determinePath(vendor, version)
service.cookie(
body = req.bodyText.through(Pipes.timeoutOnIdle(bodyReadTimeout)).compile.string.map(Some(_)),
body = req.bodyText.compile.string.map(Some(_)),
path = path,
request = req,
pixelExpected = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ object Run {
config.enableDefaultRedirect,
config.rootResponse.enabled,
config.crossDomain.enabled,
config.networking.responseHeaderTimeout,
collectorService
).value,
if (config.ssl.enable) config.ssl.port else config.port,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ class RoutesSpec extends Specification {
) = {
val service = new TestService()
val routes =
new Routes(enabledDefaultRedirect, enableRootResponse, enableCrossdomainTracking, 500.millis, service)
.value
.orNotFound
new Routes(enabledDefaultRedirect, enableRootResponse, enableCrossdomainTracking, service).value.orNotFound
val routesWithHsts = HttpServer.hstsMiddleware(Config.HSTS(enableHsts, 180.days), routes)
(service, routesWithHsts)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ object TestUtils {
1024,
610.seconds,
5.seconds,
1.second,
20480,
40960
),
Expand Down
1 change: 0 additions & 1 deletion kafka/src/it/resources/collector.hocon
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,5 @@ collector {

networking {
responseHeaderTimeout = 10 seconds
bodyReadTimeout = 2 seconds
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ object KafkaConfigSpec {
maxConnections = 1024,
idleTimeout = 610.seconds,
responseHeaderTimeout = 5.seconds,
bodyReadTimeout = 1.second,
maxRequestLineLength = 20480,
maxHeadersLength = 40960
),
Expand Down
1 change: 0 additions & 1 deletion kinesis/src/it/resources/collector-cookie-anonymous.hocon
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ collector {

networking {
responseHeaderTimeout = 10 seconds
bodyReadTimeout = 2 seconds
}

"cookie": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ collector {

networking {
responseHeaderTimeout = 10 seconds
bodyReadTimeout = 2 seconds
}

"cookie": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ collector {

networking {
responseHeaderTimeout = 10 seconds
bodyReadTimeout = 2 seconds
}

"cookie": {
Expand Down
1 change: 0 additions & 1 deletion kinesis/src/it/resources/collector-cookie-domain.hocon
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ collector {

networking {
responseHeaderTimeout = 10 seconds
bodyReadTimeout = 2 seconds
}

"cookie": {
Expand Down
1 change: 0 additions & 1 deletion kinesis/src/it/resources/collector-cookie-fallback.hocon
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ collector {

networking {
responseHeaderTimeout = 10 seconds
bodyReadTimeout = 2 seconds
}

"cookie": {
Expand Down
1 change: 0 additions & 1 deletion kinesis/src/it/resources/collector-cookie-no-domain.hocon
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ collector {

networking {
responseHeaderTimeout = 10 seconds
bodyReadTimeout = 2 seconds
}

"cookie": {
Expand Down
1 change: 0 additions & 1 deletion kinesis/src/it/resources/collector-custom-paths.hocon
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ collector {

networking {
responseHeaderTimeout = 10 seconds
bodyReadTimeout = 2 seconds
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ collector {

networking {
responseHeaderTimeout = 10 seconds
bodyReadTimeout = 2 seconds
}

"doNotTrackCookie": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ collector {

networking {
responseHeaderTimeout = 10 seconds
bodyReadTimeout = 2 seconds
}

"doNotTrackCookie": {
Expand Down
1 change: 0 additions & 1 deletion kinesis/src/it/resources/collector.hocon
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,5 @@ collector {

networking {
responseHeaderTimeout = 10 seconds
bodyReadTimeout = 2 seconds
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ object KinesisConfigSpec {
maxConnections = 1024,
idleTimeout = 610.seconds,
responseHeaderTimeout = 5.seconds,
bodyReadTimeout = 1.second,
maxRequestLineLength = 20480,
maxHeadersLength = 40960
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ object NsqConfigSpec {
maxConnections = 1024,
idleTimeout = 610.seconds,
responseHeaderTimeout = 5.seconds,
bodyReadTimeout = 1.second,
maxRequestLineLength = 20480,
maxHeadersLength = 40960
),
Expand Down
1 change: 0 additions & 1 deletion pubsub/src/it/resources/collector.hocon
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@ collector {

networking {
responseHeaderTimeout = 10 seconds
bodyReadTimeout = 2 seconds
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ object ConfigSpec {
maxConnections = 1024,
idleTimeout = 610.seconds,
responseHeaderTimeout = 5.seconds,
bodyReadTimeout = 1.second,
maxRequestLineLength = 20480,
maxHeadersLength = 40960
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ object SqsConfigSpec {
maxConnections = 1024,
idleTimeout = 610.seconds,
responseHeaderTimeout = 5.seconds,
bodyReadTimeout = 1.second,
maxRequestLineLength = 20480,
maxHeadersLength = 40960
),
Expand Down

0 comments on commit 1a34e95

Please sign in to comment.