Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Null HttpChannel.getCurrentHttpChannel() in ServletHandler.doFilter()

...making sure to respond on the proper thread now (facepalm)

Joakim - thanks for reviewing the code, and creating the bug. Quick followup question - do you know how long a bug like this usually takes to fix? I can understand that there are no guarantees, I'm just looking for a rough estimate - a few days, a few months, etc. I'm curious because the project I'm working on will be rolling out in the next month and a half, and I'll need to make a call on whether to wait for the fix or not. Thanks!

On Thu, Oct 9, 2014 at 10:37 PM, Joakim Erdfelt <joakim@xxxxxxxxxxx> wrote:

--
Joakim Erdfelt <joakim@xxxxxxxxxxx>
Expert advice, services and support from from the Jetty & CometD experts

On Thu, Oct 9, 2014 at 12:57 PM, Matt Deimel <mdeimel@xxxxxxxxx> wrote:
Joakim - I've added everything to a github repo here: https://github.com/mdeimel/sitemesh3-jetty-async

The README should have everything needed, but if there are any questions on it let me know. Thanks!

On Thu, Oct 9, 2014 at 1:59 PM, Joakim Erdfelt <joakim@xxxxxxxxxxx> wrote:
Sounds like we are at the point where a demonstration code/project and bug filed would be of most use.
Explain how to run it, and what the expected results are.

If this is a behavioral difference between tomcat and jetty then we should at least be able to explain it, and hopefully point to where in the spec one of is interpreting things differently.

Would be the first time for an interpretation difference, this happens often with new parts of the various specs (no new spec is spot on covering all situations on the first try), and usually gets resolved in a mutual fashion between us (and eventually becomes better defined in the official spec in a later revision)


--
Joakim Erdfelt <joakim@xxxxxxxxxxx>
Expert advice, services and support from from the Jetty & CometD experts

On Thu, Oct 9, 2014 at 11:53 AM, Matt Deimel <mdeimel@xxxxxxxxx> wrote:
Joakim, thanks for your response.

After looking into this some more, I have noticed a few things:

1) The Jetty Proxy is actually getting an HttpServletResponseWrapper as the response, so any writing isn't actually closing the session. And the content from that call is being sent along to retrieve the Sitemesh decorator. I think that's why a call to forward() is available here after the proxy work - and the forwarded call is not actually being proxied (only the initial call is proxied)

2) The same exception occurs if I create an asynchronous servlet and try to decorate that. So I don't think this is related to the proxy specifically.

3) When retrieving a vanilla html content to decorate, everything works properly (and the HttpChannel.getCurrentHttpChannel() request returns a valid HttpChannelOverHttp object).

In reference to #2, when I try to decorate an asynchronous servlet with Sitemesh, it works in Tomcat, but doesn't work in Jetty. I certainly don't understand the differences enough to know why that would be, but I thought I'd add that in case it's a helpful tip. The reason I'd like to use Jetty is because the proxy is so fast.

Thanks.

  --Matt


On Wed, Oct 8, 2014 at 2:01 PM, Joakim Erdfelt <joakim@xxxxxxxxxxx> wrote:
Looks like SiteMesh is doing a dispatcher.forward() after the proxy request.

I can't imagine that ever working under a valid proxy scenario.
Wouldn't the request + response be either underway / committed or done / completed by that point?

--
Joakim Erdfelt <joakim@xxxxxxxxxxx>
Expert advice, services and support from from the Jetty & CometD experts

On Wed, Oct 8, 2014 at 11:54 AM, Matt Deimel <mdeimel@xxxxxxxxx> wrote:
Apparently responding in Nabble did not carry over all of my content in <raw> tags. So here's another attempt:

This is a very late response - among other delays there was some work in the SiteMesh community to make SiteMesh3 asynchronous, which will get around some of the issues. Unfortunately I'm still finding a similar problem now when working through this situation.

I've updated to Jetty 9.2.3.v20140905

The project is a Jetty Proxy with a SiteMesh filter. Trying to decorate proxied content.

When I use AsyncProxyServlet$Transparent as the servlet in web.xml I receive the following error:
2014-10-08 13:43:28.593:WARN:oejh.HttpParser:qtp2070935783-20: badMessage: java.lang.IllegalStateException: too much data after closed for HttpReceiverOverHTTP@55b31984 on HttpConnectionOverHTTP@61505510(l:/127.0.0.1:60231 <-> r:localhost/127.0.0.1:8060)

When I use ProxyServlet$Transparent as the servlet I receive the following stack trace:
2014-10-08 13:46:44.033:WARN:oejs.HttpChannelState:qtp1489294793-22: 
java.lang.NullPointerException
at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:130)
at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:72)
at org.sitemesh.webapp.WebAppContext.dispatch(WebAppContext.java:168)
at org.sitemesh.webapp.WebAppContext.decorate(WebAppContext.java:143)
at org.sitemesh.BaseSiteMeshContext.decorate(BaseSiteMeshContext.java:39)
at org.sitemesh.webapp.SiteMeshFilter.postProcess(SiteMeshFilter.java:83)
at org.sitemesh.webapp.contentfilter.ContentBufferingFilter.processInternally(ContentBufferingFilter.java:217)
at org.sitemesh.webapp.contentfilter.ContentBufferingFilter$2.onComplete(ContentBufferingFilter.java:175)
at org.eclipse.jetty.server.HttpChannelState.completed(HttpChannelState.java:506)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:421)
at org.eclipse.jetty.server.HttpChannel.run(HttpChannel.java:262)
at org.eclipse.jetty.server.handler.ContextHandler.handle(ContextHandler.java:1173)
at org.eclipse.jetty.server.HttpChannelState.complete(HttpChannelState.java:452)
at org.eclipse.jetty.server.AsyncContextState.complete(AsyncContextState.java:92)
at org.eclipse.jetty.proxy.ProxyServlet.onResponseSuccess(ProxyServlet.java:560)
at org.eclipse.jetty.proxy.ProxyServlet$ProxyResponseListener.onComplete(ProxyServlet.java:815)
at org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:193)
at org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:185)
at org.eclipse.jetty.client.HttpReceiver.terminateResponse(HttpReceiver.java:484)
at org.eclipse.jetty.client.HttpReceiver.responseSuccess(HttpReceiver.java:393)
at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.messageComplete(HttpReceiverOverHTTP.java:255)
at org.eclipse.jetty.http.HttpParser.parseContent(HttpParser.java:1465)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:1275)
at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.parse(HttpReceiverOverHTTP.java:142)
at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.readAndParse(HttpReceiverOverHTTP.java:107)
at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.process(HttpReceiverOverHTTP.java:70)
at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.receive(HttpReceiverOverHTTP.java:65)
at org.eclipse.jetty.client.http.HttpChannelOverHTTP.receive(HttpChannelOverHTTP.java:75)
at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.onFillable(HttpConnectionOverHTTP.java:100)
at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:610)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:539)
at java.lang.Thread.run(Thread.java:722)

The NullPointerException now appears to be the same root problem that started this thread, that HttpChannel.getCurrentHttpChannel() returns null in Dispatcher.forward().
protected void forward(ServletRequest request, ServletResponse response, DispatcherType dispatch) throws ServletException, IOException
    {
        Request baseRequest=(request instanceof Request)?((Request)request):HttpChannel.getCurrentHttpChannel().getRequest();

In both cases I can verify that the proxy request is being made, since it's another application I control, and it's receiving a proper request.

Any suggestions on how to get around either of these problems? Thanks.

On Wed, Oct 8, 2014 at 1:52 PM, mdeimel <mdeimel@xxxxxxxxx> wrote:
This is a very late response - among other delays there was some work in the
SiteMesh community to make SiteMesh3 asynchronous, which will get around
some of the issues. Unfortunately I'm still finding a similar problem now
when working through this situation.

I've updated to Jetty 9.2.3.v20140905

The project is a Jetty Proxy with a SiteMesh filter. Trying to decorate
proxied content.

When I use AsyncProxyServlet$Transparent as the servlet in web.xml I receive
the following error:


When I use ProxyServlet$Transparent as the servlet I receive the following
stack trace:


The NullPointerException now appears to be the same root problem that
started this thread, that HttpChannel.getCurrentHttpChannel() returns null
in Dispatcher.forward().


In both cases I can verify that the proxy request is being made, since it's
another application I control, and it's receiving a proper request.

Any suggestions on how to get around either of these problems? Thanks.



--
View this message in context: http://jetty.4.x6.nabble.com/jetty-users-Null-HttpChannel-getCurrentHttpChannel-in-ServletHandler-doFilter-tp4962799p4963207.html
Sent from the Jetty User mailing list archive at Nabble.com.
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


Back to the top