This is an automated email from the ASF dual-hosted git repository. paulrutter pushed a commit to branch feature/FELIX-6808-Add-ability-to-configure-Jetty12-acceptQueueSize in repository https://gitbox.apache.org/repos/asf/felix-dev.git
commit ad5e388f999bfe7c32536f1877f15b4d391fe32f Author: Paul Rütter <[email protected]> AuthorDate: Fri Oct 3 10:09:30 2025 +0200 FELIX-6808 Add ability to configure Jetty12 acceptQueueSize - Make acceptQueueSize configurable --- http/README.md | 117 +++++++++++---------- .../jetty/internal/ConfigMetaTypeProvider.java | 10 +- .../felix/http/jetty/internal/JettyConfig.java | 8 ++ .../felix/http/jetty/internal/JettyService.java | 6 ++ 4 files changed, 81 insertions(+), 60 deletions(-) diff --git a/http/README.md b/http/README.md index d49e879a56..877b39918c 100644 --- a/http/README.md +++ b/http/README.md @@ -387,64 +387,65 @@ The service can both be configured using OSGi environment properties and using C this service is `"org.apache.felix.http"`. If you use both methods, Configuration Admin takes precedence. The following properties can be used (some legacy property names still exist but are not documented here on purpose). As properties might change over time, the actual list of properties can be found [here for the Jetty 12 bundle](https://github.com/apache/felix-dev/blob/master/http/jetty12/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java) and [here for the Jetty 11 bundle](https://github.com/apache/felix-dev/blob/master/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/J [...] -| Property | Description [...] -|----------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ [...] -| `org.apache.felix.http.host` | Host name or IP Address of the interface to listen on. The default is `null` causing Jetty to listen on all interfaces. [...] -| `org.osgi.service.http.port` | The port used for servlets and resources available via HTTP. The default is `8080`. See [port settings below](#http-port-settings) for additional information. A negative port number has the same effect as setting `org.apache.felix.http.enable` to `false`. [...] -| `org.osgi.service.http.port.secure` | The port used for servlets and resources available via HTTPS. The default is `8443`. See [port settings below](#http-port-settings) for additional information. A negative port number has the same effect as setting `org.apache.felix.https.enable` to `false`. [...] -| `org.apache.felix.http.context_path` | The servlet Context Path to use for the Http Service. If this property is not configured it defaults to "/". This must be a valid path starting with a slash and not ending with a slash (unless it is the root context). [...] -| `org.apache.felix.http.timeout` | Connection timeout in milliseconds. The default is `60000` (60 seconds). [...] -| `org.apache.felix.http.session.timeout` | Allows for the specification of the Session life time as a number of minutes. This property serves the same purpose as the `session-timeout` element in a Web Application descriptor. The default is "0" (zero) for no timeout at all. [...] -| `org.apache.felix.http.enable` | Flag to enable the use of HTTP. The default is `true`. [...] -| `org.apache.felix.https.enable` | Flag to enable the user of HTTPS. The default is `false`. [...] -| `org.apache.felix.https.keystore` | The name of the file containing the keystore. [...] -| `org.apache.felix.https.keystore.password` | The password for the keystore. [...] -| `org.apache.felix.https.keystore.key.password` | The password for the key in the keystore. [...] -| `org.apache.felix.https.truststore` | The name of the file containing the truststore. [...] -| `org.apache.felix.https.truststore.type` | The type of truststore to use. The default is `JKS`. [...] -| `org.apache.felix.https.truststore.password` | The password for the truststore. [...] -| `org.apache.felix.https.jetty.ciphersuites.excluded` | Configures comma-separated list of SSL cipher suites to *exclude*. Default is `null`, meaning that no cipher suite is excluded. [...] -| `org.apache.felix.https.jetty.ciphersuites.included` | Configures comma-separated list of SSL cipher suites to *include*. Default is `null`, meaning that the default cipher suites are used. [...] -| `org.apache.felix.https.jetty.protocols.excluded` | Configures comma-separated list of SSL protocols (e.g. SSLv3, TLSv1.0, TLSv1.1, TLSv1.2) to *exclude*. Default is `null`, meaning that no protocol is excluded. [...] -| `org.apache.felix.https.jetty.protocols.included` | Configures comma-separated list of SSL protocols to *include*. Default is `null`, meaning that the default protocols are used. [...] -| `org.apache.felix.https.clientcertificate` | Flag to determine if the HTTPS protocol requires, wants or does not use client certificates. Legal values are `needs`, `wants` and `none`. The default is `none`. [...] -| `org.apache.felix.http.jetty.headerBufferSize` | Size of the buffer for request and response headers, in bytes. Default is 16 KB. [...] -| `org.apache.felix.http.jetty.requestBufferSize` | Size of the buffer for requests not fitting the header buffer, in bytes. Default is 8 KB. [...] -| `org.apache.felix.http.jetty.responseBufferSize` | Size of the buffer for responses, in bytes. Default is 24 KB. [...] -| `org.apache.felix.http.jetty.maxFormSize` | The maximum size accepted for a form post, in bytes (ony applies to form parameters). Defaults to 200 KB. [...] -| `org.apache.felix.http.jetty.requestSizeLimit` | Maximum size of the request body in bytes. Default is unlimited. Added in Jetty12 1.0.30. [...] -| `org.apache.felix.http.jetty.responseSizeLimit` | Maximum size of the response body in bytes. Default is unlimited. Default is unlimited. Added in Jetty12 1.0.30. [...] -| `org.apache.felix.http.jetty.errorPageCustomHeaders` | Configures the custom headers to add to all error pages served by Jetty. Separate key-value pairs with `##`, e.g. `X-Custom-Header=Value##X-Custom-Header2=Value2`. Added in Jetty12 1.0.32. [...] -| `org.apache.felix.http.mbeans` | If `true`, enables the MBean server functionality. The default is `false`. [...] -| `org.apache.felix.http.jetty.sendServerHeader` | If `false`, the `Server` HTTP header is no longer included in responses. The default is `false`. [...] -| `org.eclipse.jetty.servlet.SessionCookie` | Name of the cookie used to transport the Session ID. The default is `JSESSIONID`. [...] -| `org.eclipse.jetty.servlet.SessionURL` | Name of the request parameter to transport the Session ID. The default is `jsessionid`. [...] -| `org.eclipse.jetty.servlet.SessionDomain` | Domain to set on the session cookie. The default is `null`. [...] -| `org.eclipse.jetty.servlet.SessionPath` | The path to set on the session cookie. The default is the configured session context path ("/"). [...] -| `org.eclipse.jetty.servlet.MaxAge` | The maximum age value to set on the cookie. The default is "-1". [...] -| `org.eclipse.jetty.UriComplianceMode` | The URI compliance mode to set. The default is [DEFAULT](https://eclipse.dev/jetty/javadoc/jetty-12/org/eclipse/jetty/http/UriCompliance.html#DEFAULT). See [documentation](https://eclipse.dev/jetty/documentation/jetty-12/programming-guide/index.html#pg-server-compliance-uri.) and [possible modes](https://github.com/jetty/jetty.project/blob/jetty-12.0.x/jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/UriCompliance.jav [...] -| `org.apache.felix.proxy.load.balancer.connection.enable` | Set this to `true` when running Felix HTTP behind a (offloading) proxy or load balancer which rewrites the requests. The default is `false`. [...] -| `org.apache.felix.http.runtime.init.` | Properties starting with this prefix are added as service registration properties to the HttpServiceRuntime service. The prefix is removed for the property name. [...] -| `org.apache.felix.jetty.gziphandler.enable` | Whether the server should use a server-wide gzip handler. Default is false. [...] -| `org.apache.felix.jetty.gzip.minGzipSize` | The minimum response size to trigger dynamic compression. Default is GzipHandler.DEFAULT_MIN_GZIP_SIZE. [...] -| `org.apache.felix.jetty.gzip.inflateBufferSize` | The size in bytes of the buffer to inflate compressed request, or <= 0 for no inflation. Default is -1. [...] -| `org.apache.felix.jetty.gzip.syncFlush` | True if Deflater#SYNC_FLUSH should be used, else Deflater#NO_FLUSH will be used. Default is false. [...] -| `org.apache.felix.jetty.gzip.includedMethods` | The additional http methods to include in compression. Default is none. [...] -| `org.apache.felix.jetty.gzip.excludedMethods` | The additional http methods to exclude in compression. Default is none. [...] -| `org.apache.felix.jetty.gzip.includedPaths` | The additional path specs to include. Inclusion takes precedence over exclusion. Default is none. [...] -| `org.apache.felix.jetty.gzip.excludedPaths` | The additional path specs to exclude. Inclusion takes precedence over exclusion. Default is none. [...] -| `org.apache.felix.jetty.gzip.includedMimeTypes` | The included mime types. Inclusion takes precedence over exclusion. Default is none. [...] -| `org.apache.felix.jetty.gzip.excludedMimeTypes` | The excluded mime types. Inclusion takes precedence over exclusion. Default is none. [...] -| `org.apache.felix.http2.enable` | Whether to enable HTTP/2. Default is false. [...] -| `org.apache.felix.jetty.http2.maxConcurrentStreams` | The max number of concurrent streams per connection. Default is 128. [...] -| `org.apache.felix.jetty.http2.initialStreamRecvWindow` | The initial stream receive window (client to server). Default is 524288. [...] -| `org.apache.felix.jetty.http2.initialSessionRecvWindow` | The initial session receive window (client to server). Default is 1048576. [...] -| `org.apache.felix.jetty.alpn.protocols` | The ALPN protocols to consider. Default is h2, http/1.1. [...] -| `org.apache.felix.jetty.alpn.defaultProtocol` | The default protocol when negotiation fails. Default is http/1.1. [...] -| `org.apache.felix.jakarta.websocket.enable` | Enables Jakarta websocket support. Default is false. [...] -| `org.apache.felix.jetty.websocket.enable` | Enables Jetty websocket support. Default is false. [...] -| `org.apache.felix.http.jetty.threadpool.max` | The maximum number of threads in the Jetty thread pool. Default is unlimited. Works for both platform threads and virtual threads (Jetty 12 only). [...] -| `org.apache.felix.http.jetty.virtualthreads.enable` | Enables using virtual threads in Jetty 12 (JDK 21 required). Default is false. When enabled, `org.apache.felix.http.jetty.threadpool.max` is used for a bounded virtual thread pool. [...] +| Property | Description [...] +|-----------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- [...] +| `org.apache.felix.http.host` | Host name or IP Address of the interface to listen on. The default is `null` causing Jetty to listen on all interfaces. [...] +| `org.osgi.service.http.port` | The port used for servlets and resources available via HTTP. The default is `8080`. See [port settings below](#http-port-settings) for additional information. A negative port number has the same effect as setting `org.apache.felix.http.enable` to `false`. [...] +| `org.osgi.service.http.port.secure` | The port used for servlets and resources available via HTTPS. The default is `8443`. See [port settings below](#http-port-settings) for additional information. A negative port number has the same effect as setting `org.apache.felix.https.enable` to `false`. [...] +| `org.apache.felix.http.context_path` | The servlet Context Path to use for the Http Service. If this property is not configured it defaults to "/". This must be a valid path starting with a slash and not ending with a slash (unless it is the root context). [...] +| `org.apache.felix.http.timeout` | Connection timeout in milliseconds. The default is `60000` (60 seconds). [...] +| `org.apache.felix.http.session.timeout` | Allows for the specification of the Session life time as a number of minutes. This property serves the same purpose as the `session-timeout` element in a Web Application descriptor. The default is "0" (zero) for no timeout at all. [...] +| `org.apache.felix.http.enable` | Flag to enable the use of HTTP. The default is `true`. [...] +| `org.apache.felix.https.enable` | Flag to enable the user of HTTPS. The default is `false`. [...] +| `org.apache.felix.https.keystore` | The name of the file containing the keystore. [...] +| `org.apache.felix.https.keystore.password` | The password for the keystore. [...] +| `org.apache.felix.https.keystore.key.password` | The password for the key in the keystore. [...] +| `org.apache.felix.https.truststore` | The name of the file containing the truststore. [...] +| `org.apache.felix.https.truststore.type` | The type of truststore to use. The default is `JKS`. [...] +| `org.apache.felix.https.truststore.password` | The password for the truststore. [...] +| `org.apache.felix.https.jetty.ciphersuites.excluded` | Configures comma-separated list of SSL cipher suites to *exclude*. Default is `null`, meaning that no cipher suite is excluded. [...] +| `org.apache.felix.https.jetty.ciphersuites.included` | Configures comma-separated list of SSL cipher suites to *include*. Default is `null`, meaning that the default cipher suites are used. [...] +| `org.apache.felix.https.jetty.protocols.excluded` | Configures comma-separated list of SSL protocols (e.g. SSLv3, TLSv1.0, TLSv1.1, TLSv1.2) to *exclude*. Default is `null`, meaning that no protocol is excluded. [...] +| `org.apache.felix.https.jetty.protocols.included` | Configures comma-separated list of SSL protocols to *include*. Default is `null`, meaning that the default protocols are used. [...] +| `org.apache.felix.https.clientcertificate` | Flag to determine if the HTTPS protocol requires, wants or does not use client certificates. Legal values are `needs`, `wants` and `none`. The default is `none`. [...] +| `org.apache.felix.http.jetty.headerBufferSize` | Size of the buffer for request and response headers, in bytes. Default is 16 KB. [...] +| `org.apache.felix.http.jetty.requestBufferSize` | Size of the buffer for requests not fitting the header buffer, in bytes. Default is 8 KB. [...] +| `org.apache.felix.http.jetty.responseBufferSize` | Size of the buffer for responses, in bytes. Default is 24 KB. [...] +| `org.apache.felix.http.jetty.maxFormSize` | The maximum size accepted for a form post, in bytes (ony applies to form parameters). Defaults to 200 KB. [...] +| `org.apache.felix.http.jetty.requestSizeLimit` | Maximum size of the request body in bytes. Default is unlimited. Added in Jetty12 1.0.30. [...] +| `org.apache.felix.http.jetty.responseSizeLimit` | Maximum size of the response body in bytes. Default is unlimited. Default is unlimited. Added in Jetty12 1.0.30. [...] +| `org.apache.felix.http.jetty.acceptQueueSize` | Configures the Jetty12 accept queue size. Defaults to whatever Jetty configures when not specified. [...] +| `org.apache.felix.http.jetty.errorPageCustomHeaders` | Configures the custom headers to add to all error pages served by Jetty. Separate key-value pairs with `##`, e.g. `X-Custom-Header=Value##X-Custom-Header2=Value2`. Added in Jetty12 1.0.32. [...] +| `org.apache.felix.http.mbeans` | If `true`, enables the MBean server functionality. The default is `false`. [...] +| `org.apache.felix.http.jetty.sendServerHeader` | If `false`, the `Server` HTTP header is no longer included in responses. The default is `false`. [...] +| `org.eclipse.jetty.servlet.SessionCookie` | Name of the cookie used to transport the Session ID. The default is `JSESSIONID`. [...] +| `org.eclipse.jetty.servlet.SessionURL` | Name of the request parameter to transport the Session ID. The default is `jsessionid`. [...] +| `org.eclipse.jetty.servlet.SessionDomain` | Domain to set on the session cookie. The default is `null`. [...] +| `org.eclipse.jetty.servlet.SessionPath` | The path to set on the session cookie. The default is the configured session context path ("/"). [...] +| `org.eclipse.jetty.servlet.MaxAge` | The maximum age value to set on the cookie. The default is "-1". [...] +| `org.eclipse.jetty.UriComplianceMode` | The URI compliance mode to set. The default is [DEFAULT](https://eclipse.dev/jetty/javadoc/jetty-12/org/eclipse/jetty/http/UriCompliance.html#DEFAULT). See [documentation](https://eclipse.dev/jetty/documentation/jetty-12/programming-guide/index.html#pg-server-compliance-uri.) and [possible modes](https://github.com/jetty/jetty.project/blob/jetty-12.0.x/jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/UriCompliance.ja [...] +| `org.apache.felix.proxy.load.balancer.connection.enable` | Set this to `true` when running Felix HTTP behind a (offloading) proxy or load balancer which rewrites the requests. The default is `false`. [...] +| `org.apache.felix.http.runtime.init.` | Properties starting with this prefix are added as service registration properties to the HttpServiceRuntime service. The prefix is removed for the property name. [...] +| `org.apache.felix.jetty.gziphandler.enable` | Whether the server should use a server-wide gzip handler. Default is false. [...] +| `org.apache.felix.jetty.gzip.minGzipSize` | The minimum response size to trigger dynamic compression. Default is GzipHandler.DEFAULT_MIN_GZIP_SIZE. [...] +| `org.apache.felix.jetty.gzip.inflateBufferSize` | The size in bytes of the buffer to inflate compressed request, or <= 0 for no inflation. Default is -1. [...] +| `org.apache.felix.jetty.gzip.syncFlush` | True if Deflater#SYNC_FLUSH should be used, else Deflater#NO_FLUSH will be used. Default is false. [...] +| `org.apache.felix.jetty.gzip.includedMethods` | The additional http methods to include in compression. Default is none. [...] +| `org.apache.felix.jetty.gzip.excludedMethods` | The additional http methods to exclude in compression. Default is none. [...] +| `org.apache.felix.jetty.gzip.includedPaths` | The additional path specs to include. Inclusion takes precedence over exclusion. Default is none. [...] +| `org.apache.felix.jetty.gzip.excludedPaths` | The additional path specs to exclude. Inclusion takes precedence over exclusion. Default is none. [...] +| `org.apache.felix.jetty.gzip.includedMimeTypes` | The included mime types. Inclusion takes precedence over exclusion. Default is none. [...] +| `org.apache.felix.jetty.gzip.excludedMimeTypes` | The excluded mime types. Inclusion takes precedence over exclusion. Default is none. [...] +| `org.apache.felix.http2.enable` | Whether to enable HTTP/2. Default is false. [...] +| `org.apache.felix.jetty.http2.maxConcurrentStreams` | The max number of concurrent streams per connection. Default is 128. [...] +| `org.apache.felix.jetty.http2.initialStreamRecvWindow` | The initial stream receive window (client to server). Default is 524288. [...] +| `org.apache.felix.jetty.http2.initialSessionRecvWindow` | The initial session receive window (client to server). Default is 1048576. [...] +| `org.apache.felix.jetty.alpn.protocols` | The ALPN protocols to consider. Default is h2, http/1.1. [...] +| `org.apache.felix.jetty.alpn.defaultProtocol` | The default protocol when negotiation fails. Default is http/1.1. [...] +| `org.apache.felix.jakarta.websocket.enable` | Enables Jakarta websocket support. Default is false. [...] +| `org.apache.felix.jetty.websocket.enable` | Enables Jetty websocket support. Default is false. [...] +| `org.apache.felix.http.jetty.threadpool.max` | The maximum number of threads in the Jetty thread pool. Default is unlimited. Works for both platform threads and virtual threads (Jetty 12 only). [...] +| `org.apache.felix.http.jetty.virtualthreads.enable` | Enables using virtual threads in Jetty 12 (JDK 21 required). Default is false. When enabled, `org.apache.felix.http.jetty.threadpool.max` is used for a bounded virtual thread pool. [...] ### Multiple Servers diff --git a/http/jetty12/src/main/java/org/apache/felix/http/jetty/internal/ConfigMetaTypeProvider.java b/http/jetty12/src/main/java/org/apache/felix/http/jetty/internal/ConfigMetaTypeProvider.java index b6fa8ef492..5086bbe0ba 100644 --- a/http/jetty12/src/main/java/org/apache/felix/http/jetty/internal/ConfigMetaTypeProvider.java +++ b/http/jetty12/src/main/java/org/apache/felix/http/jetty/internal/ConfigMetaTypeProvider.java @@ -211,15 +211,21 @@ class ConfigMetaTypeProvider implements MetaTypeProvider adList.add(new AttributeDefinitionImpl(JettyConfig.FELIX_JETTY_REQUEST_SIZE_LIMIT, "Maximum request size in bytes", "Maximum size of the request body in bytes. Default is unlimited.", - 204800, + -1, bundle.getBundleContext().getProperty(JettyConfig.FELIX_JETTY_REQUEST_SIZE_LIMIT))); adList.add(new AttributeDefinitionImpl(JettyConfig.FELIX_JETTY_RESPONSE_SIZE_LIMIT, "Maximum response size in bytes", "Maximum size of the response body in bytes. Default is unlimited.", - 204800, + -1, bundle.getBundleContext().getProperty(JettyConfig.FELIX_JETTY_RESPONSE_SIZE_LIMIT))); + adList.add(new AttributeDefinitionImpl(JettyConfig.FELIX_JETTY_ACCEPT_QUEUE_SIZE, + "Jetty accept queue size", + "Felix specific property to configure the accept queue size.", + -1, + bundle.getBundleContext().getProperty(JettyConfig.FELIX_JETTY_ACCEPT_QUEUE_SIZE))); + adList.add(new AttributeDefinitionImpl(JettyConfig.FELIX_JETTY_ERROR_PAGE_CUSTOM_HEADERS, "Custom headers to add to error pages", "Felix specific property to configure the custom headers to add to all error pages served by Jetty. Separate key-value pairs with ##.", diff --git a/http/jetty12/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java b/http/jetty12/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java index e14db27c1f..73c815a245 100644 --- a/http/jetty12/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java +++ b/http/jetty12/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java @@ -115,6 +115,9 @@ public final class JettyConfig /** Felix specific property to configure the response size limit. Default is unlimited. See https://jetty.org/docs/jetty/12/programming-guide/server/http.html#handler-use-size-limit */ public static final String FELIX_JETTY_RESPONSE_SIZE_LIMIT = "org.apache.felix.http.jetty.responseSizeLimit"; + /** Felix specific property to configure the accept queue size. Default is not setting it, leaving it up to Jetty. */ + public static final String FELIX_JETTY_ACCEPT_QUEUE_SIZE = "org.apache.felix.http.jetty.acceptQueueSize"; + /** Felix specific property to configure the custom headers to add to all error pages served by Jetty. Separate key-value pairs with ##. */ public static final String FELIX_JETTY_ERROR_PAGE_CUSTOM_HEADERS = "org.apache.felix.http.jetty.errorPageCustomHeaders"; @@ -515,6 +518,11 @@ public final class JettyConfig return getIntProperty(FELIX_JETTY_RESPONSE_SIZE_LIMIT, -1); } + public int getAcceptQueueSize() { + // Jetty default is 0 meaning that the OS default is used + return getIntProperty(FELIX_JETTY_ACCEPT_QUEUE_SIZE, -1); + } + public String getFelixJettyErrorPageCustomHeaders() { return getProperty(FELIX_JETTY_ERROR_PAGE_CUSTOM_HEADERS, null); } diff --git a/http/jetty12/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java b/http/jetty12/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java index 2dce509ec2..24b45d8868 100644 --- a/http/jetty12/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java +++ b/http/jetty12/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java @@ -730,6 +730,12 @@ public final class JettyService connector.setHost(this.config.getHost()); connector.setIdleTimeout(this.config.getHttpTimeout()); + if (this.config.getAcceptQueueSize() > -1) { + // Set the accept queue size only if explicitly configured + // otherwise leave the default to Jetty to decide + connector.setAcceptQueueSize(this.config.getAcceptQueueSize()); + } + if (this.config.isRegisterMBeans()) { connector.addBean(new ConnectionStatistics());
