From c6278becc29f5605254786ad5070ab2666ffad47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cattilapiros=E2=80=9D?= Date: Mon, 19 Nov 2018 20:55:28 +0100 Subject: [PATCH 1/3] Introducing spark.ui.requestHeaderSize --- .../scala/org/apache/spark/internal/config/package.scala | 7 +++++++ core/src/main/scala/org/apache/spark/ui/JettyUtils.scala | 6 ++++-- docs/configuration.md | 9 +++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/core/src/main/scala/org/apache/spark/internal/config/package.scala b/core/src/main/scala/org/apache/spark/internal/config/package.scala index ab2b872c5551..10818a491a46 100644 --- a/core/src/main/scala/org/apache/spark/internal/config/package.scala +++ b/core/src/main/scala/org/apache/spark/internal/config/package.scala @@ -570,6 +570,13 @@ package object config { .stringConf .createOptional + private[spark] val UI_REQUEST_HEADER_SIZE = + ConfigBuilder("spark.ui.requestHeaderSize") + .doc("Value for HTTP request header size in bytes.") + .bytesConf(ByteUnit.BYTE) + .createWithDefaultString("8k") + + private[spark] val EXTRA_LISTENERS = ConfigBuilder("spark.extraListeners") .doc("Class names of listeners to add to SparkContext during initialization.") .stringConf diff --git a/core/src/main/scala/org/apache/spark/ui/JettyUtils.scala b/core/src/main/scala/org/apache/spark/ui/JettyUtils.scala index 52a955111231..316af9b79d28 100644 --- a/core/src/main/scala/org/apache/spark/ui/JettyUtils.scala +++ b/core/src/main/scala/org/apache/spark/ui/JettyUtils.scala @@ -356,13 +356,15 @@ private[spark] object JettyUtils extends Logging { (connector, connector.getLocalPort()) } + val httpConfig = new HttpConfiguration() + httpConfig.setRequestHeaderSize(conf.get(UI_REQUEST_HEADER_SIZE).toInt) // If SSL is configured, create the secure connector first. val securePort = sslOptions.createJettySslContextFactory().map { factory => val securePort = sslOptions.port.getOrElse(if (port > 0) Utils.userPort(port, 400) else 0) val secureServerName = if (serverName.nonEmpty) s"$serverName (HTTPS)" else serverName val connectionFactories = AbstractConnectionFactory.getFactories(factory, - new HttpConnectionFactory()) + new HttpConnectionFactory(httpConfig)) def sslConnect(currentPort: Int): (ServerConnector, Int) = { newConnector(connectionFactories, currentPort) @@ -377,7 +379,7 @@ private[spark] object JettyUtils extends Logging { // Bind the HTTP port. def httpConnect(currentPort: Int): (ServerConnector, Int) = { - newConnector(Array(new HttpConnectionFactory()), currentPort) + newConnector(Array(new HttpConnectionFactory(httpConfig)), currentPort) } val (httpConnector, httpPort) = Utils.startServiceOnPort[ServerConnector](port, httpConnect, diff --git a/docs/configuration.md b/docs/configuration.md index 2915fb5fa919..0c3bb011600d 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -973,6 +973,15 @@ Apart from these, the following properties are also available, and may be useful
spark.com.test.filter1.param.name2=bar + + spark.ui.requestHeaderSize + 8k + + The HTTP request header size, in bytes unless otherwise specified. + This setting applied for the Spark History Server too. + + + ### Compression and Serialization From 81334f45e158fe5edd42a1297caa91d208c9c112 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cattilapiros=E2=80=9D?= Date: Mon, 19 Nov 2018 21:49:07 +0100 Subject: [PATCH 2/3] Remove unnecesary enters. --- .../main/scala/org/apache/spark/internal/config/package.scala | 1 - docs/configuration.md | 1 - 2 files changed, 2 deletions(-) diff --git a/core/src/main/scala/org/apache/spark/internal/config/package.scala b/core/src/main/scala/org/apache/spark/internal/config/package.scala index 10818a491a46..9cc48f637500 100644 --- a/core/src/main/scala/org/apache/spark/internal/config/package.scala +++ b/core/src/main/scala/org/apache/spark/internal/config/package.scala @@ -576,7 +576,6 @@ package object config { .bytesConf(ByteUnit.BYTE) .createWithDefaultString("8k") - private[spark] val EXTRA_LISTENERS = ConfigBuilder("spark.extraListeners") .doc("Class names of listeners to add to SparkContext during initialization.") .stringConf diff --git a/docs/configuration.md b/docs/configuration.md index 0c3bb011600d..7f79436a3e85 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -981,7 +981,6 @@ Apart from these, the following properties are also available, and may be useful This setting applied for the Spark History Server too. - ### Compression and Serialization From a343f933d15aacc1e0407a0b23eceb0b4da7a5bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cattilapiros=E2=80=9D?= Date: Mon, 19 Nov 2018 23:17:12 +0100 Subject: [PATCH 3/3] fix doc --- docs/configuration.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/configuration.md b/docs/configuration.md index 7f79436a3e85..04210d855b11 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -977,8 +977,8 @@ Apart from these, the following properties are also available, and may be useful spark.ui.requestHeaderSize 8k - The HTTP request header size, in bytes unless otherwise specified. - This setting applied for the Spark History Server too. + The maximum allowed size for a HTTP request header, in bytes unless otherwise specified. + This setting applies for the Spark History Server too.