Hi,

I have maybe found another problem:
onAllDataRead is called with the same thread that is calling input.read.

I updated the sample to show the problem:
https://github.com/yanns/servlet31_async/commit/3c7618a51a8efd76956a6a29e27f350f7dbe835b

The servlet displays a wrong size of the uploaded file.

event.getSuppliedResponse().getOutputStream().print("Complete. Read "
+ readListener.getRead());
sees a wrong value from readListener.getRead()

If onAllDataRead was called with another thread, it would wait for the
synchronized (input) { } and display the right value.
Jetty for example displays the right size.
With Jetty:
[Thread 13] ReadListenerImpl: onDataAvailable
[Thread 13] onDataAvailable end
[Thread 22] read till now: 234
[Thread 14] onAllDataRead
(onAllDataRead is called after "read till now" with a different thread)

With Tomcat:
[Thread 26] ReadListenerImpl: onDataAvailable
[Thread 26] onDataAvailable end
[Thread 27] onAllDataRead
[Thread 27] read till now: 234
(onAllDataRead is called defore "read till now" with the same thread)

Can you check that?

Thanks!
Yann

2014-02-01 15:13 GMT+01:00 Yann Simon <yann.simon...@gmail.com>:
>
> On Jan 31, 2014 7:36 PM, "Mark Thomas" <ma...@apache.org> wrote:
>>
>> On 31/01/2014 11:52, Yann Simon wrote:
>> > On Jan 31, 2014 10:25 AM, "Mark Thomas" <ma...@apache.org> wrote:
>> >>
>> >> On 31/01/2014 07:58, Yann Simon wrote:
>> >>>>>> On Jan 30, 2014, at 11:18 AM, Yann Simon <yann.simon...@gmail.com>
>> >>
>> >>> Jetty seems to allow this. Why not tomcat? Is there something in the
>> >>> specification about it. I could not find anything explicit.
>> >>
>> >> It could simply be a bug in Tomcat. I've had a quick look and I think I
>> >> might have a fix (thanks to Remy for the hint earlier in the thread)
>> >> but
>> >> the non-blocking code has proved tricky to get right and I want to do
>> >> some more testing. I should get to that later today.
>> >
>> > Thanks for the feedback!
>>
>> No problem. Thanks again for the test case.
>>
>> I've applied some changes to 8.0.x that will be in 8.0.2 onwards. Your
>> test case now completes for both options for BIO, NIO and APR/native
>> connectors.
>>
>> The 8.0.1 release is currently in progress so 8.0.2 is a little way off.
>> You can always build from source to get it sooner which should be fairly
>> painless. If you want to go down that route and you need some pointers
>> just ask here.
>
> Thanks for the quick fix! I'll test the new version when it is released and
> let you know.
>
> Yann
>
>>
>> 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

Reply via email to