Jetty makes async Filter as not async

49 views
Skip to first unread message

Richard Hierlmeier

unread,
Aug 23, 2022, 9:30:52 AM8/23/22
to OPS4J
today a had a problem in a Karaf 4.3.7 instance. The karaf.log was full with the following log messages:

2022-08-23 14:48:18,690    [qtp550196699-89048]    [ERROR]    [AtmosphereFramework]    AtmosphereFramework exception    []    [ java.lang.IllegalStateException: !asyncSupported: de.hierlmeier.web.filter.GlobalRequestFilter==de.hierlmeier.web.filter.GlobalRequestFilter@6849a9c4{inst=true,async=false,src=EMBEDDED:null}
    at org.eclipse.jetty.server.Request.startAsync(Request.java:2340)
    at javax.servlet.ServletRequestWrapper.startAsync(ServletRequestWrapper.java:464)
    at org.atmosphere.cpr.AtmosphereRequestImpl.startAsync(AtmosphereRequestImpl.java:633)
    at org.atmosphere.container.Servlet30CometSupport.suspend(Servlet30CometSupport.java:94)
    at org.atmosphere.container.Servlet30CometSupport.service(Servlet30CometSupport.java:69)
    at org.atmosphere.cpr.AtmosphereFramework.doCometSupport(AtmosphereFramework.java:2297)
    at com.vaadin.server.communication.PushRequestHandler.handleRequest(PushRequestHandler.java:234)
    at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1637)
    at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:464)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799)
    at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1631)
    at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:292)
    at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193)
    at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
    at de.hierlmeier.web.filter.GlobalRequestFilter.doFilter(GlobalRequestFilter.java:486)
    at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:201)
    at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:548)
    at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:74)

Jetty thinks that the GlobalRequestFilter does not support async processing, but it does.

Under what circumstances marks Jetty a filter as non async?


Regard

   Richard



Grzegorz Grzybek

unread,
Aug 23, 2022, 10:02:33 AM8/23/22
to op...@googlegroups.com
Hello

How is "de.hierlmeier.web.filter.GlobalRequestFilter" registered?

Pax Web 7 sets "async" flag in org.ops4j.pax.web.service.jetty.internal.JettyServerImpl#addFilter():

holder.setAsyncSupported(model.isAsyncSupported());

In Whiteboard, this flag comes from "osgi.http.whiteboard.filter.asyncSupported" service property on the filter being registered but also from @javax.servlet.annotation.WebFilter/asyncSupported.

regards
Grzegorz Grzybek

--
--
------------------
OPS4J - http://www.ops4j.org - op...@googlegroups.com

---
You received this message because you are subscribed to the Google Groups "OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ops4j+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ops4j/439fe42f-1b35-47ac-bbd7-e92b456fb18dn%40googlegroups.com.

Richard Hierlmeier

unread,
Aug 24, 2022, 1:59:57 AM8/24/22
to OPS4J
The filter is part of a WAB. It is registered with the @WebFilter annotation.

I found the the reason for the problem. It was an invalid configuration of the Apache Httpd server that is a reverse proxy in front of Karaf.

In Karaf runs a Vaddin application. It uses websockets. The Apache Httpd service had the following proxy configuration:

    <Location /appl>
        RewriteEngine on      

        ProxyPass "https://appl4/"
        ProxyPassReverse "https://appl4/"
       
        RewriteCond %{HTTP:UPGRADE} ^websocket$ [NC]
        RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC]
        RewriteRule /ui/PUSH?(.*) "ws://appl4/ui/push$1" [P]    
       
    </Location> 


The websocket communiation used the ws (and not wss) protocol on the Karaf  https port. 
The Vaadin javascript produced in 10 seconds thousands of http requests. Each request produced the above error.

Thank you

   Richard
Reply all
Reply to author
Forward
0 new messages