On Nov 26, 2013, at 6:06 AM, Mark Thomas <ma...@apache.org> wrote: > On 26/11/2013 10:46, Mark Thomas wrote: >> On 25/11/2013 17:39, Daniel Mikusa wrote: >>> On Nov 25, 2013, at 12:19 PM, "Caldarale, Charles R" >>> <chuck.caldar...@unisys.com> wrote: >>> >>>>> From: Daniel Mikusa [mailto:dmik...@gopivotal.com] Subject: >>>>> Another Non-blocking IO Question >>>> >>>>> Most of the time it works, but in one case I'm seeing requests >>>>> hang. >>>> >>>> You know the ritual: >>>> >>>> 1) Tomcat version? 2) JDK version? 3) Thread dump? >>> >>> Doh… Tomcat trunk. JDK 1.7.0_45. >>> >>> Took some thread dumps, but I don't think that's going to help here. >>> There are no blocking threads or threads waiting on external >>> resources. The issue is that the async context is not being closed >>> and, in my example this is not happening cause "onAllDataRead()" is >>> not being called. Which back to my question, can I depend on >>> "onAllDataRead()" being called always or are there certain cases >>> where it won't get called? >> >> You should be able to rely on onAllDataRead() being called. >> >>>>> in this case "onWritePossible" (i.e. my WriteListener) is reading >>>>> the data. >>>> >>>> That seems to be against the spirit of the spec, albeit not the >>>> letter. Spec clarification might be needed here. >> >> The nature of the Servlet 3.1 non-blocking API is such that if copying >> data from request to response that the entire body may be read and the >> entire response written without any calls to onDataAvailable() or >> onWritePossible(). (That case is handled.). Depending on network >> conditions you may see either or both of onDataAvailable() and >> onWritePossible(). >> >> The code doesn't currently handle it correctly if the request is >> finished during onWritePossible(). I need to add that but it is a little >> more complicated as there could be multiple onWritePossible() calls >> after the request has been finished. >> >> Your test case would be very helpful. > > Should be fixed in trunk but I still won;t say no to a test case.
I pulled down the latest trunk and my test is no longer hanging, so that looks good. It is throwing an NPE, but that could be my fault. I haven't investigated that yet. Here's a link to the test case. I didn't see a BZ, so I just put it up on github. https://gist.github.com/dmikusa-pivotal/7660005 Dan > > Mark > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org