This is an automated email from the ASF dual-hosted git repository.
gavinchou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 6828cb125ea [fix](web) FE startup fail due to websocket startup
(#60369)
6828cb125ea is described below
commit 6828cb125ea844acdc9ab1e7442fe74b8a870d37
Author: nsivarajan <[email protected]>
AuthorDate: Sat Feb 28 21:11:09 2026 +0530
[fix](web) FE startup fail due to websocket startup (#60369)
Issue Number: close #60366
Related PR: #57710
Problem Summary:
Apache Doris Frontend fails to start when enable_https=true with the
following error:
```
java.lang.IllegalStateException: WebSocketComponents has not been
created
at
org.eclipse.jetty.ee10.websocket.server.internal.DelegatedServerUpgradeRequest.getComponents(DelegatedServerUpgradeRequest.java:106)
at
org.eclipse.jetty.ee10.websocket.server.internal.DelegatedServerUpgradeRequest.getWebSocketComponents(DelegatedServerUpgradeRequest.java:125)
```
RCA for failure : Jetty 12 introduced strict lifecycle state validation for
WebSocket initialization.
Fix:
```Use Spring Boot's addServerCustomizers() hook which runs before the
WebAppContext starts, combined with
server.getDescendant(WebAppContext.class) to safely navigate Jetty 12's
handler tree.```
---
.../config/WebServerFactoryCustomizerConfig.java | 42 +++++++++++++++-------
1 file changed, 30 insertions(+), 12 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/httpv2/config/WebServerFactoryCustomizerConfig.java
b/fe/fe-core/src/main/java/org/apache/doris/httpv2/config/WebServerFactoryCustomizerConfig.java
index a467a230844..fc24bf1bd27 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/httpv2/config/WebServerFactoryCustomizerConfig.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/httpv2/config/WebServerFactoryCustomizerConfig.java
@@ -19,6 +19,10 @@ package org.apache.doris.httpv2.config;
import org.apache.doris.common.Config;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.eclipse.jetty.ee10.webapp.WebAppContext;
+import
org.eclipse.jetty.ee10.websocket.server.config.JettyWebSocketServletContainerInitializer;
import org.eclipse.jetty.server.HttpConfiguration;
import org.eclipse.jetty.server.HttpConnectionFactory;
import org.eclipse.jetty.server.ServerConnector;
@@ -31,26 +35,40 @@ import java.util.Collections;
@Configuration
public class WebServerFactoryCustomizerConfig implements
WebServerFactoryCustomizer<ConfigurableJettyWebServerFactory> {
+ private static final Logger LOG =
LogManager.getLogger(WebServerFactoryCustomizerConfig.class);
+
@Override
public void customize(ConfigurableJettyWebServerFactory factory) {
+
+ ((JettyServletWebServerFactory) factory).addServerCustomizers(server
-> {
+ WebAppContext context = server.getDescendant(WebAppContext.class);
+ if (context != null) {
+ try {
+
JettyWebSocketServletContainerInitializer.configure(context, null);
+ } catch (Exception e) {
+ LOG.error("Failed to initialize WebSocket support", e);
+ throw new RuntimeException("Failed to initialize WebSocket
support", e);
+ }
+ }
+ });
+
if (Config.enable_https) {
((JettyServletWebServerFactory) factory).setConfigurations(
Collections.singletonList(new HttpToHttpsJettyConfig())
);
- factory.addServerCustomizers(
- server -> {
- HttpConfiguration httpConfiguration = new
HttpConfiguration();
- httpConfiguration.setSecurePort(Config.https_port);
- httpConfiguration.setSecureScheme("https");
-
- ServerConnector connector = new
ServerConnector(server);
- connector.addConnectionFactory(new
HttpConnectionFactory(httpConfiguration));
- connector.setPort(Config.http_port);
-
- server.addConnector(connector);
+ factory.addServerCustomizers(server -> {
+ if (server.getConnectors() != null &&
server.getConnectors().length > 0) {
+ ServerConnector existingConnector = (ServerConnector)
server.getConnectors()[0];
+ HttpConnectionFactory httpFactory =
+
existingConnector.getConnectionFactory(HttpConnectionFactory.class);
+ if (httpFactory != null) {
+ HttpConfiguration httpConfig =
httpFactory.getHttpConfiguration();
+ httpConfig.setSecurePort(Config.https_port);
+ httpConfig.setSecureScheme("https");
}
- );
+ }
+ });
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]