Highload

时间:2015-11-05 10:10:33

标签: java null jetty

我在jetty服务器v9.3上以5 qps的负载收到java.lang.NullPointerException

我定义了以下配置:

jetty.threadPool.maxThreads=500 jetty.http.acceptors=-1 jetty.http.selectors=-1

遇到类似问题的人?

记录

[WARN] [05/11/2015 09:49:29.074] [qtp821513849-64] [org.eclipse.jetty.server.HttpChannel] //host.com/service1
java.lang.NullPointerException: null
        at org.eclipse.jetty.security.SecurityHandler.checkSecurity(SecurityHandler.java:387) ~[jetty-security-9.3.5.v20151012.jar:9.3.5.v20151012]
        at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:443) ~[jetty-security-9.3.5.v20151012.jar:9.3.5.v20151012]
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226) ~[jetty-server-9.3.5.v20151012.jar:9.3.5.v20151012]
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1158) ~[jetty-server-9.3.5.v20151012.jar:9.3.5.v20151012]
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511) ~[jetty-servlet-9.3.5.v20151012.jar:9.3.5.v20151012]
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) ~[jetty-server-9.3.5.v20151012.jar:9.3.5.v20151012]
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1090) ~[jetty-server-9.3.5.v20151012.jar:9.3.5.v20151012]
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) ~[jetty-server-9.3.5.v20151012.jar:9.3.5.v20151012]
        at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213) ~[jetty-server-9.3.5.v20151012.jar:9.3.5.v20151012]
        at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:109) ~[jetty-server-9.3.5.v20151012.jar:9.3.5.v20151012]
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:119) ~[jetty-server-9.3.5.v20151012.jar:9.3.5.v20151012]
        at org.eclipse.jetty.webapp.logging.ContextLogHandler.handle(ContextLogHandler.java:62) ~[jetty-webapp-logging-9.0.0.jar:na]
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:119) ~[jetty-server-9.3.5.v20151012.jar:9.3.5.v20151012]
        at org.eclipse.jetty.server.Server.handle(Server.java:517) ~[jetty-server-9.3.5.v20151012.jar:9.3.5.v20151012]
        at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:306) ~[jetty-server-9.3.5.v20151012.jar:9.3.5.v20151012]
        at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:242) [jetty-server-9.3.5.v20151012.jar:9.3.5.v20151012]
        at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:261) [jetty-io-9.3.5.v20151012.jar:9.3.5.v20151012]
        at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95) [jetty-io-9.3.5.v20151012.jar:9.3.5.v20151012]
        at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:75) [jetty-io-9.3.5.v20151012.jar:9.3.5.v20151012]
        at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:213) [jetty-util-9.3.5.v20151012.jar:9.3.5.v20151012]
        at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:147) [jetty-util-9.3.5.v20151012.jar:9.3.5.v20151012]
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654) [jetty-util-9.3.5.v20151012.jar:9.3.5.v20151012]
        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572) [jetty-util-9.3.5.v20151012.jar:9.3.5.v20151012]
        at java.lang.Thread.run(Thread.java:745) [na:1.8.0_65]

配置

我在以下docker容器上使用defualt配置:

FROM centos:7

USER root

ENV TERM xterm

ENV JAVA_HOME /etc/alternatives/jre
ENV PATH $PATH:$JAVA_HOME

# Install Java
RUN yum install -y \
       java-1.8.0-openjdk \
       java-1.8.0-openjdk-devel


ENV JETTY_HOME /opt/jetty
ENV JETTY_VERSION 9.3.5.v20151012

# Install Jetty
RUN curl http://download.eclipse.org/jetty/${JETTY_VERSION}/dist/jetty-distribution-${JETTY_VERSION}.tar.gz -o /tmp/jetty.tar.gz \
 && cd /opt \
 && tar zxvf /tmp/jetty.tar.gz \
 && ln -s /opt/jetty-distribution-${JETTY_VERSION} /opt/jetty \
 && rm /tmp/jetty.tar.gz \
 && rm -rf /opt/jetty/webapps.demo

 # New Relic install
ADD ./newrelic/ $JETTY_HOME/newrelic/
RUN cd $JETTY_HOME/newrelic
RUN java -jar $JETTY_HOME/newrelic/newrelic.jar install

ENV JETTY_BASE /var/lib/jetty

RUN mkdir -p $JETTY_BASE/modules 

WORKDIR $JETTY_BASE

# Get the list of modules in the default start.ini and build new base with those modules, then add setuid
RUN modules="$(grep -- ^--module= "$JETTY_HOME/start.ini" | cut -d= -f2 | paste -d, -s)" \
    && set -xe \
    && java -jar "$JETTY_HOME/start.jar" --add-to-startd="$modules,setuid"

RUN cd modules \
    && curl -O https://raw.githubusercontent.com/jetty-project/logging-modules/master/logback/logging.mod \
    && curl -O https://raw.githubusercontent.com/jetty-project/logging-modules/master/centralized/webapp-logging.mod

RUN java -jar "$JETTY_HOME/start.jar" --add-to-startd="logging,webapp-logging"

# Delete default logback configuration
RUN rm resources/logback.xml

RUN useradd jetty -U -s /bin/false
RUN chown -R jetty:jetty $JETTY_HOME
RUN chown -R jetty:jetty $JETTY_BASE

EXPOSE 8080


# Set Application Configuration
ENV JETTY_ARGS "jetty.threadPool.maxThreads=500 jetty.http.acceptors=-1 jetty.http.selectors=-1"
ENV JAVA_OPTIONS "-Xms7g -Xmx7g -XX:NewSize=6g -XX:MaxNewSize=6g -XX:+UseParNewGC -XX:SurvivorRatio=8 -XX:+UseConcMarkSweepGC"

# Copy Jetty config file
COPY ./src/main/webapp/WEB-INF/jetty.xml $JETTY_BASE/etc/jetty.xml
COPY ./src/main/resources/logback.xml $JETTY_BASE/resources/logback.xml
COPY ./target/*.war $JETTY_BASE/webapps/ROOT.war

# Run Jetty
RUN chmod +x $JETTY_HOME/bin/jetty.sh
CMD ["/opt/jetty/bin/jetty.sh", "run"]

0 个答案:

没有答案