Skip to content

Commit

Permalink
Bump jetty to v9.4.12
Browse files Browse the repository at this point in the history
The recent proxy changes (apache#2801) tickled some issues in jetty's 9.3
series, where clients can hang if running on machines with a lot of
cores. This causes some tests to fail CI, while being impossible to
repro locally (unless you have a 24 core machine lying around).

Jetty reworked a lot of their selector code in 9.4, which appears to
make the issue go away.
  • Loading branch information
ivankelly committed Oct 19, 2018
1 parent 1386e6d commit fda0654
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 63 deletions.
35 changes: 18 additions & 17 deletions distribution/server/src/assemble/LICENSE.bin.txt
Original file line number Diff line number Diff line change
Expand Up @@ -395,22 +395,23 @@ The Apache Software License, Version 2.0
- org.asynchttpclient-async-http-client-2.1.0-alpha26.jar
- org.asynchttpclient-async-http-client-netty-utils-2.1.0-alpha26.jar
* Jetty
- org.eclipse.jetty-jetty-client-9.3.11.v20160721.jar
- org.eclipse.jetty-jetty-continuation-9.3.11.v20160721.jar
- org.eclipse.jetty-jetty-http-9.3.11.v20160721.jar
- org.eclipse.jetty-jetty-io-9.3.11.v20160721.jar
- org.eclipse.jetty-jetty-proxy-9.3.11.v20160721.jar
- org.eclipse.jetty-jetty-security-9.3.11.v20160721.jar
- org.eclipse.jetty-jetty-server-9.3.11.v20160721.jar
- org.eclipse.jetty-jetty-servlet-9.3.11.v20160721.jar
- org.eclipse.jetty-jetty-servlets-9.3.11.v20160721.jar
- org.eclipse.jetty-jetty-util-9.3.11.v20160721.jar
- org.eclipse.jetty.websocket-javax-websocket-client-impl-9.3.11.v20160721.jar
- org.eclipse.jetty.websocket-websocket-api-9.3.11.v20160721.jar
- org.eclipse.jetty.websocket-websocket-client-9.3.11.v20160721.jar
- org.eclipse.jetty.websocket-websocket-common-9.3.11.v20160721.jar
- org.eclipse.jetty.websocket-websocket-server-9.3.11.v20160721.jar
- org.eclipse.jetty.websocket-websocket-servlet-9.3.11.v20160721.jar
- org.eclipse.jetty-jetty-client-9.4.12.v20180830.jar
- org.eclipse.jetty-jetty-continuation-9.4.12.v20180830.jar
- org.eclipse.jetty-jetty-http-9.4.12.v20180830.jar
- org.eclipse.jetty-jetty-io-9.4.12.v20180830.jar
- org.eclipse.jetty-jetty-proxy-9.4.12.v20180830.jar
- org.eclipse.jetty-jetty-security-9.4.12.v20180830.jar
- org.eclipse.jetty-jetty-server-9.4.12.v20180830.jar
- org.eclipse.jetty-jetty-servlet-9.4.12.v20180830.jar
- org.eclipse.jetty-jetty-servlets-9.4.12.v20180830.jar
- org.eclipse.jetty-jetty-util-9.4.12.v20180830.jar
- org.eclipse.jetty-jetty-xml-9.4.12.v20180830.jar
- org.eclipse.jetty.websocket-javax-websocket-client-impl-9.4.12.v20180830.jar
- org.eclipse.jetty.websocket-websocket-api-9.4.12.v20180830.jar
- org.eclipse.jetty.websocket-websocket-client-9.4.12.v20180830.jar
- org.eclipse.jetty.websocket-websocket-common-9.4.12.v20180830.jar
- org.eclipse.jetty.websocket-websocket-server-9.4.12.v20180830.jar
- org.eclipse.jetty.websocket-websocket-servlet-9.4.12.v20180830.jar
* SnakeYaml -- org.yaml-snakeyaml-1.15.jar
* RocksDB - org.rocksdb-rocksdbjni-5.13.3.jar
* HttpClient
Expand Down Expand Up @@ -501,7 +502,7 @@ CDDL-1.1 -- licenses/LICENSE-CDDL-1.1.txt
* Java Annotations API
- javax.annotation-javax.annotation-api-1.2.jar
* Java Servlet API -- javax.servlet-javax.servlet-api-3.1.0.jar
* WebSocket Server API -- javax.websocket-javax.websocket-api-1.0.jar
* WebSocket Server API -- javax.websocket-javax.websocket-client-api-1.0.jar
* Java Web Service REST API -- javax.ws.rs-javax.ws.rs-api-2.1.jar
* HK2 - Dependency Injection Kernel
- org.glassfish.hk2-hk2-api-2.5.0-b30.jar
Expand Down
2 changes: 1 addition & 1 deletion distribution/server/src/assemble/NOTICE.bin.txt
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ This product contains a forked and modified version of Tomcat Native
----------------------------------------------------------------------------------------------------

Jetty Web Container
Copyright 1995-2016 Mort Bay Consulting Pty Ltd.
Copyright 1995-2018 Mort Bay Consulting Pty Ltd.

The Jetty Web Container is Copyright Mort Bay Consulting Pty Ltd
unless otherwise noted.
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ flexible messaging model and an intuitive client API.</description>
<zookeeper.version>3.4.13</zookeeper.version>
<netty.version>4.1.22.Final</netty.version>
<storm.version>1.0.5</storm.version>
<jetty.version>9.3.11.v20160721</jetty.version>
<jetty.version>9.4.12.v20180830</jetty.version>
<jersey.version>2.25</jersey.version>
<athenz.version>1.7.17</athenz.version>
<prometheus.version>0.5.0</prometheus.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
import java.util.List;
import java.util.Map;
import java.util.TimeZone;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import javax.servlet.DispatcherType;

Expand Down Expand Up @@ -59,7 +57,6 @@
import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
import com.google.common.collect.Lists;

import io.netty.util.concurrent.DefaultThreadFactory;
import io.prometheus.client.jetty.JettyStatisticsCollector;

/**
Expand All @@ -71,19 +68,19 @@ public class WebService implements AutoCloseable {

public static final String ATTRIBUTE_PULSAR_NAME = "pulsar";
public static final String HANDLER_CACHE_CONTROL = "max-age=3600";
public static final int NUM_ACCEPTORS = 32; // make it configurable?
public static final int MAX_CONCURRENT_REQUESTS = 1024; // make it configurable?

private final PulsarService pulsar;
private final Server server;
private final List<Handler> handlers;
private final ExecutorService webServiceExecutor;
private final ExecutorThreadPool webServiceExecutor;

public WebService(PulsarService pulsar) throws PulsarServerException {
this.handlers = Lists.newArrayList();
this.pulsar = pulsar;
this.webServiceExecutor = Executors.newFixedThreadPool(WebService.NUM_ACCEPTORS, new DefaultThreadFactory("pulsar-web"));
this.server = new Server(new ExecutorThreadPool(webServiceExecutor));
this.webServiceExecutor = new ExecutorThreadPool();
this.webServiceExecutor.setName("pulsar-web");
this.server = new Server(webServiceExecutor);
List<ServerConnector> connectors = new ArrayList<>();

ServerConnector connector = new PulsarServerConnector(server, 1, 1);
Expand Down Expand Up @@ -198,7 +195,7 @@ public void start() throws PulsarServerException {
public void close() throws PulsarServerException {
try {
server.stop();
webServiceExecutor.shutdown();
webServiceExecutor.stop();
log.info("Web service closed");
} catch (Exception e) {
throw new PulsarServerException(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@
import java.util.List;
import java.util.Map;
import java.util.TimeZone;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import javax.net.ssl.SSLContext;
import javax.servlet.Servlet;

import org.apache.pulsar.common.util.SecurityUtility;
Expand All @@ -48,21 +45,20 @@

import com.google.common.collect.Lists;

import io.netty.util.concurrent.DefaultThreadFactory;

/**
* Manages web-service startup/stop on jetty server.
*
*/
public class ServerManager {
private final Server server;
private final ExecutorService webServiceExecutor;
private final ExecutorThreadPool webServiceExecutor;
private final List<Handler> handlers = Lists.newArrayList();
protected final int externalServicePort;

public ServerManager(ServiceConfig config) {
this.webServiceExecutor = Executors.newFixedThreadPool(32, new DefaultThreadFactory("pulsar-external-web"));
this.server = new Server(new ExecutorThreadPool(webServiceExecutor));
this.webServiceExecutor = new ExecutorThreadPool();
this.webServiceExecutor.setName("pulsar-external-web");
this.server = new Server(webServiceExecutor);
this.externalServicePort = config.getWebServicePort();

List<ServerConnector> connectors = Lists.newArrayList();
Expand Down Expand Up @@ -134,7 +130,7 @@ public void start() throws Exception {

public void stop() throws Exception {
server.stop();
webServiceExecutor.shutdown();
webServiceExecutor.stop();
log.info("Server stopped successfully");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
import javax.servlet.DispatcherType;
import lombok.extern.slf4j.Slf4j;
import org.apache.pulsar.broker.web.AuthenticationFilter;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import org.apache.pulsar.common.util.SecurityUtility;
import org.apache.pulsar.functions.worker.WorkerConfig;
import org.apache.pulsar.functions.worker.WorkerService;
Expand Down Expand Up @@ -55,17 +53,14 @@

import com.google.common.annotations.VisibleForTesting;

import io.netty.util.concurrent.DefaultThreadFactory;

@Slf4j
public class WorkerServer {

private final WorkerConfig workerConfig;
private final WorkerService workerService;
private static final String MATCH_ALL = "/*";
private static final int NUM_ACCEPTORS = 16;
private static final int MAX_CONCURRENT_REQUESTS = 1024;
private final ExecutorService webServerExecutor;
private final ExecutorThreadPool webServerExecutor;
private Server server;

private static String getErrorMessage(Server server, int port, Exception ex) {
Expand All @@ -80,7 +75,8 @@ private static String getErrorMessage(Server server, int port, Exception ex) {
public WorkerServer(WorkerService workerService) {
this.workerConfig = workerService.getWorkerConfig();
this.workerService = workerService;
this.webServerExecutor = Executors.newFixedThreadPool(NUM_ACCEPTORS, new DefaultThreadFactory("function-web"));
this.webServerExecutor = new ExecutorThreadPool();
this.webServerExecutor.setName("function-web");
init();
}

Expand All @@ -90,7 +86,7 @@ public void start() throws Exception {
}

private void init() {
server = new Server(new ExecutorThreadPool(webServerExecutor));
server = new Server(webServerExecutor);

List<ServerConnector> connectors = new ArrayList<>();
ServerConnector connector = new ServerConnector(server, 1, 1);
Expand Down Expand Up @@ -167,8 +163,12 @@ public void stop() {
log.error("Failed to stop function web-server ", e);
}
}
if (this.webServerExecutor != null && !this.webServerExecutor.isShutdown()) {
this.webServerExecutor.shutdown();
if (this.webServerExecutor != null && this.webServerExecutor.isRunning()) {
try {
this.webServerExecutor.stop();
} catch (Exception e) {
log.warn("Error stopping function web-server executor", e);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
import com.google.common.collect.Lists;

import io.netty.util.concurrent.DefaultThreadFactory;
import io.prometheus.client.jetty.JettyStatisticsCollector;

import java.io.IOException;
Expand All @@ -34,8 +33,6 @@
import java.util.List;
import java.util.Optional;
import java.util.TimeZone;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import javax.servlet.DispatcherType;

Expand Down Expand Up @@ -72,7 +69,7 @@ public class WebServer {
private static final String MATCH_ALL = "/*";

private final Server server;
private final ExecutorService webServiceExecutor;
private final ExecutorThreadPool webServiceExecutor;
private final AuthenticationService authenticationService;
private final List<String> servletPaths = Lists.newArrayList();
private final List<Handler> handlers = Lists.newArrayList();
Expand All @@ -81,8 +78,9 @@ public class WebServer {
private URI serviceURI = null;

public WebServer(ProxyConfiguration config, AuthenticationService authenticationService) {
this.webServiceExecutor = Executors.newFixedThreadPool(32, new DefaultThreadFactory("pulsar-external-web"));
this.server = new Server(new ExecutorThreadPool(webServiceExecutor));
this.webServiceExecutor = new ExecutorThreadPool();
this.webServiceExecutor.setName("pulsar-external-web");
this.server = new Server(webServiceExecutor);
this.externalServicePort = config.getWebServicePort();
this.authenticationService = authenticationService;
this.config = config;
Expand Down Expand Up @@ -220,7 +218,7 @@ public void start() throws Exception {

public void stop() throws Exception {
server.stop();
webServiceExecutor.shutdown();
webServiceExecutor.stop();
log.info("Server stopped successfully");
}

Expand Down
2 changes: 1 addition & 1 deletion pulsar-sql/presto-distribution/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ The Apache Software License, Version 2.0
- jetty-server-9.4.11.v20180605.jar
- jetty-servlet-9.4.11.v20180605.jar
- jetty-util-9.4.11.v20180605.jar
- jetty-util-9.3.11.v20160721.jar
- jetty-util-9.4.12.v20180830.jar
* Javassist
- javassist-3.22.0-CR2.jar
* Asynchronous Http Client
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,11 @@
import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
import com.google.common.collect.Lists;

import io.netty.util.concurrent.DefaultThreadFactory;

import java.net.MalformedURLException;
import java.security.GeneralSecurityException;
import java.util.ArrayList;
import java.util.List;
import java.util.TimeZone;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import javax.servlet.Servlet;
import javax.servlet.ServletException;
Expand Down Expand Up @@ -60,14 +56,14 @@ public class ProxyServer {
private final Server server;
private final List<Handler> handlers = Lists.newArrayList();
private final WebSocketProxyConfiguration conf;
private final ExecutorService executorService;
private final ExecutorThreadPool executorService;

public ProxyServer(WebSocketProxyConfiguration config)
throws PulsarClientException, MalformedURLException, PulsarServerException {
this.conf = config;
executorService = Executors.newFixedThreadPool(WebSocketProxyConfiguration.PROXY_SERVER_EXECUTOR_THREADS,
new DefaultThreadFactory("pulsar-websocket-web"));
this.server = new Server(new ExecutorThreadPool(executorService));
executorService = new ExecutorThreadPool();
executorService.setName("pulsar-websocket-web");
this.server = new Server(executorService);
List<ServerConnector> connectors = new ArrayList<>();

ServerConnector connector = new ServerConnector(server);
Expand Down Expand Up @@ -150,7 +146,7 @@ public void start() throws PulsarServerException {

public void stop() throws Exception {
server.stop();
executorService.shutdown();
executorService.stop();
}

private static final Logger log = LoggerFactory.getLogger(ProxyServer.class);
Expand Down

0 comments on commit fda0654

Please sign in to comment.