users@grizzly.java.net

Re: (Issue 336) grizzly-sendfile bugs for 1.9.5

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Mon, 04 May 2009 10:28:33 -0400

Salut,

Igor Minar wrote:
> I have a good news: r3122 resolved the problem
>
> and a bad news: the solution suffers from a concurrency bug.
>
> My code looks like this:
>
> try {
> response.flushHeaders();
> } catch (IOException ex) {
> logger.log(Level.INFO, "Failed to send headers", ex);
> }
>
> response.discardUpstreamWrites();
>
> When testing this code under load (50-100 concurrent requests), grizzly
> never sends the headers to the clients, so clients think that the
> response was a HTTP 0.9 response without headers.

Hum I'm surprised it is related to a concurrency issue. The header bytes
never gets written? Can you add, in SocketChannelOuputBuffer

Index:
http/src/main/java/com/sun/grizzly/http/SocketChannelOutputBuffer.java
===================================================================
---
http/src/main/java/com/sun/grizzly/http/SocketChannelOutputBuffer.java
     (revision 3124)
+++
http/src/main/java/com/sun/grizzly/http/SocketChannelOutputBuffer.java
     (working copy)
@@ -565,6 +565,11 @@
       * Stop buffering bytes, discard any upcoming writes.
       */
      public void discardUpstreamBytes(){
+ try{
+ flushBuffer();
+ } catch (IOException ex){
+ logger.log(Level.WARNING,"",ex);
+ }
          discardBytes = true;
      }

Thanks!

-- Jeanfrancois

>
> We are almost there :)
>
> /i
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>