Tomcat 9: UpgradedServletOutputStream

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Tomcat 9: UpgradedServletOutputStream

Sergey Mashkov
Hi everyone

I am experiencing race condition: from time to time when I cann to
UpgradedServletOutputStream.setWriteListener(myCallback) servlet container
doesn't invoke neither myCallback.onWritePossible() nor .onError.

I believe the reason is that setWriteListener() method implementation sets
listener reference _AFTER_ it schedules dispatch/registers write listener.
I've checked regular (non-upgraded) CoyoteOutput and I see it's
implementation does the same but in correct order. Also I see that
UpgradedServletInputStream.setWriteListener also has such a strange order:

Kind regards
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Tomcat 9: UpgradedServletOutputStream

remm
On Fri, Aug 11, 2017 at 3:14 PM, Sergey Mashkov <
[hidden email]> wrote:

> Hi everyone
>
> I am experiencing race condition: from time to time when I cann to
> UpgradedServletOutputStream.setWriteListener(myCallback) servlet container
> doesn't invoke neither myCallback.onWritePossible() nor .onError.
>
> I believe the reason is that setWriteListener() method implementation sets
> listener reference _AFTER_ it schedules dispatch/registers write listener.
> I've checked regular (non-upgraded) CoyoteOutput and I see it's
> implementation does the same but in correct order. Also I see that
> UpgradedServletInputStream.setWriteListener also has such a strange order:
>
> Ok, I don't see why and if I place it in the sync above there's no
testsuite issue. I'll wait for Mark to ack that though, just in case
there's a trick.

Rémy
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Tomcat 9: UpgradedServletOutputStream

markt
On 11/08/17 15:14, Rémy Maucherat wrote:

> On Fri, Aug 11, 2017 at 3:14 PM, Sergey Mashkov <
> [hidden email]> wrote:
>
>> Hi everyone
>>
>> I am experiencing race condition: from time to time when I cann to
>> UpgradedServletOutputStream.setWriteListener(myCallback) servlet container
>> doesn't invoke neither myCallback.onWritePossible() nor .onError.
>>
>> I believe the reason is that setWriteListener() method implementation sets
>> listener reference _AFTER_ it schedules dispatch/registers write listener.
>> I've checked regular (non-upgraded) CoyoteOutput and I see it's
>> implementation does the same but in correct order. Also I see that
>> UpgradedServletInputStream.setWriteListener also has such a strange order:
>>
> Ok, I don't see why and if I place it in the sync above there's no
> testsuite issue. I'll wait for Mark to ack that though, just in case
> there's a trick.

I don't see any issue with moving "this.listener = listener;" above the
sync.

A similar change in UpgradeServletInputStream should be fine too.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Loading...