On 23/02/2015 13:24, Rémy Maucherat wrote:
> 2015-02-23 13:32 GMT+01:00 Mark Thomas <ma...@apache.org>:
> 
>> I'm not sure if that is fixing the symptom or the cause. I'm still
>> seeing something going wrong with what should be a clean shutdown in
>> TestWsWebSocketContainer.testMaxMessageSize04().
>>
>> I took a look at the source for BufferedOutputStream and that does flush
>> on close. I think ServletOutputStream should behave the same way.
>>
>> Disabling the flush might give us some insight into what else might be
>> going wrong but I don't think disabling is a long term solution.
>>
> I'm not saying to disable fushing, but to do a non blocking flush (see
> r1661652). If there's a backlog (or a client not reading like for
> TestWebSocketFrameClientSSL testBug56032 this did end up waiting forever
> somehow (which didn't happen before).
> 
> With the infinite write timeout removed, I have the following tests failing
> due to a race between the real IO and the Websockets timeout:
> TestWsWebSocketContainer
> 
> Testcase: testWriteTimeoutServerEndpoint took 9.836 sec
>     FAILED
> expected:<class java.net.SocketTimeoutException> but was:<class
> java.io.EOFException>
> 
> Testcase: testWriteTimeoutServerContainer took 9.808 sec
>     FAILED
> expected:<class java.net.SocketTimeoutException> but was:<class
> java.io.EOFException>
> 
> IMO, we're fine with the infinite write timeout (for now), or it would need
> to be more than what it is right now.

There is a combination of things going on here.

With infinite timeout + blocking flush there is the possibility of an
infinite wait. Clearly that is wrong.

At socket close, I do think the flush needs to be blocking (with a
sensible timeout) rather than non-blocking. The app should be in control
of how long to wait to close the socket before closing it anyway and
losing data. I'm currently thinking of setting the write timeout to the
connection timeout followed by blocking flush on close.

I'll revert the change to the write timeout.

I'm also close to what is causing the problem with
testMaxMessageSize04(). There is a race between WsSession.onClose()
blocking write being completed. I want to take a little more time to
make sure I fix that properly.

Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to