https://bz.apache.org/bugzilla/show_bug.cgi?id=58646

            Bug ID: 58646
           Summary: NullPointerException in InternalNioOutputBuffer under
                    traffic related to <async-supported> config.
           Product: Tomcat 8
           Version: 8.0.28
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: anmalys...@mail.ru

We're using Tomcat in our product. Under traffic we can reproduce the following
exceptions:

Nov 23, 2015 CST 08:34:58.115 PM org.apache.coyote.http11.Http11NioProcessor
INFO: Error parsing HTTP request header
 Note: further occurrences of HTTP header parsing errors will be logged at
DEBUG level.

Nov 23, 2015 CST 08:34:58.118 PM org.apache.coyote.http11.Http11NioProcessor
SEVERE: Error finishing response

java.lang.NullPointerException
    at
org.apache.coyote.http11.InternalNioOutputBuffer.flushBuffer(InternalNioOutputBuffer.java:234)
    at
org.apache.coyote.http11.InternalNioOutputBuffer.addToBB(InternalNioOutputBuffer.java:189)
    at
org.apache.coyote.http11.InternalNioOutputBuffer.commit(InternalNioOutputBuffer.java:177)
    at
org.apache.coyote.http11.AbstractHttp11Processor.action(AbstractHttp11Processor.java:741)
    at org.apache.coyote.Response.action(Response.java:177)
    at
org.apache.coyote.http11.AbstractOutputBuffer.endRequest(AbstractOutputBuffer.java:369)
    at
org.apache.coyote.http11.AbstractHttp11Processor.endRequest(AbstractHttp11Processor.java:1804)
    at
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1143)
    at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673)
    at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
    at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
    at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)


We have several applications deployed on our Tomcat. Most of the applications
are simple Jersey Rest service applications. Above NullPointer is related to
one of them (basically, the one which is called during traffic - I bet other
apps will have the same issue if they would be called). Also we have one
application which is using WebSockets (Tomcat implementation) and Async support
for Comet. WebSocket interface is used during traffic testing while Comet is
NOT (Servlets are not called). We have the following in our Tomcat main web.xml
file (comparing to the default one):


    <filter>
        <filter-name>CorsFilter</filter-name>
        <filter-class>com.avaya.acc.base.web.filters.CorsFilter</filter-class>
        <async-supported>true</async-supported>
    </filter>
    <filter-mapping>
        <filter-name>CorsFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <filter>
        <filter-name>NoCachingFilter</filter-name>
       
<filter-class>com.avaya.acc.base.web.filters.NoCachingFilter</filter-class>
        <async-supported>true</async-supported>
        <init-param>
          <param-name>Set-Expires</param-name>
          <param-value>false</param-value>
        </init-param>
        <init-param>
          <param-name>No-Store</param-name>
          <param-value>true</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>NoCachingFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <!-- enable caching for static content -->
    <context-param>
        <param-name>NoCachingFilter enableCaching</param-name>
       
<param-value>Set-Expires=true;No-Store=false;patterns=*.js,*.swf,*.jar,*.png,*.jpg,*.css</param-value>
    </context-param>

    <!-- Declaring this param in web.xml for specific webapp doesn't work, so
leaving it here -->
    <context-param>
        <param-name>stinger.excluded.url.patterns</param-name>
       
<param-value>/Comet/StartLiveSession,/Comet/Data,/Comet/EndLiveSession</param-value>
    </context-param>

And the following in the web.xml for application which has issues:

<?xml version="1.0" encoding="UTF-8"?>

<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd";>
    <servlet>
        <servlet-name>Live Viewer</servlet-name>
       
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>

        <init-param>
                <param-name>javax.ws.rs.Application</param-name>
               
<param-value>com.avaya.acc.wcs.api.viewer.rest.app.LiveViewerRestApp</param-value>
        </init-param>

        <init-param>
            <!-- integrates JERSEY and JACKSON -->
            <param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
            <param-value>true</param-value>
        </init-param>
        <init-param>
            <param-name>sendfileSize</param-name>
            <param-value>-1</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>Live Viewer</servlet-name>
        <url-pattern>/rest/*</url-pattern>
    </servlet-mapping>
</web-app>

I tried to remove async-supported from all our web.xml files and the issue is
gone. So it's definitely related to <async-supported> configuration - without
even actually using async functionality. We still need async-supported for our
Comet interface so just disabling async is not an option for us.

I can turn on some additional logging and reproduce again if this will help -
just let me know which logging is needed.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to