RE: [Simpleweb-Support] Problem when stress testing an application using SimpleWeb
                
                Brought to you by:
                
                    niallg
                    
                
            
            
        
        
        
    | 
     
      
      
      From: Niall G. <gal...@ya...> - 2005-07-26 21:29:05
      
     
   | 
Hi,
I had a further look at this, the reason for the
poller.close() is because if the header is too large,
and cannot be fully read the server will shut down the
connection. It has been a while since I wrote this,
but the sematics seem right.
If the header was too large, and the poller was not
closed, then the next poll would read from within the
center of an already half read request header, which
could result in an undesired result. At any rate, if
there is an error reading the request, and the state
cannot be determined, it is safest and best to close
the connection. RFC 2616 has guidelines on how clients
should behave on an asynchronous close!
Niall
--- Niall Gallagher <gal...@ya...> wrote:
> Hi Henry,
> 
> The reason the connection is closed is because RFC
> 2616 says that this is the way this must be done!
> For
> example, that the scenario where the request
> conatins
> a larger chunked encoded message body, and then you
> read only half of it. If the poller is not closed,
> where do you read the next request header from? Also
> if you send some wrong information how is the
> browser
> supposed to interpret it? 
> 
> Anyway, there is a large section in the HTTP/1.1
> specification that discusses pipelining and its
> semantics. It should provide some more detail.
> 
> Niall
> 
> --- Henry Voyer <hen...@ge...> wrote:
> 
> > Re Hi Neil,
> > 
> > Well i found the problem and fixed it. And i would
> > like your input about it.
> > The problem is when the client suddently close the
> > stream and this happens
> > often in highly concurrent transactions.
> > 
> > java.io.IOException: Stream closed
> > 	at
> >
>
java.io.PushbackInputStream.ensureOpen(PushbackInputStream.java:57)
> > 	at
> >
>
java.io.PushbackInputStream.unread(PushbackInputStream.java:181)
> > 	at
> >
>
simple.http.PollerInputStream.available(PollerInputStream.java:114)
> > 	at
> >
>
simple.http.BasicPoller.process(BasicPoller.java:117)
> > 	at
> > simple.http.Processor.execute(Processor.java:121)
> > 	at simple.http.Processor.run(Processor.java:83)
> > 	at java.lang.Thread.run(Thread.java:595)
> > 
> > Then the exception makes the closes the poller
> > 
> > This happens, in the class : simple.http.Processor
> > 
> >   private void execute() throws
> InterruptedException
> >  {
> >        Object top = queue.dequeue();
> >        Poller poller = (Poller)top;
> >        try{
> >           poller.process(proc);
> >        }catch(Exception e){
> >           poller.close();
> >        }
> >     }
> > 
> > Why close the poller?
> > 
> > 
> > My fix consist in removing the try catch, and
> > removing the line of the
> > pooler.close
> > 
> > the code is :
> > 
> >    private void execute() throws IOException,
> > InterruptedException {
> >       Object top = queue.dequeue();
> >       Poller poller = (Poller) top;
> >       poller.process(proc);
> >    }
> > 
> > then is catched in the run method
> > 
> >  public void run() {
> >       while (alive) {
> >          try {
> >             execute();
> >          }
> >          catch (IOException e) {
> >             l
> >          }
> >          catch (InterruptedException e) {
> >             logger.error("Interrupted exception
> > while executing an request",
> > e);
> >          }
> >       }
> >    }
> > 
> > 
> > -----Original Message-----
> > From:
> sim...@li...
> >
>
[mailto:sim...@li...]On
> > Behalf Of Henry
> > Voyer
> > Sent: Tuesday, July 26, 2005 1:06 PM
> > To: sim...@li...
> > Cc: jor...@ge...
> > Subject: RE: [Simpleweb-Support] Problem when
> stress
> > testing an
> > application using SimpleWeb
> > 
> > 
> > Hi Neil,
> > 
> > Thanks for answering.
> > 
> > We know thats part of the problem. But for the
> HTTP
> > processing that doesnt
> > mean that simple has to stop processing more
> > requests comming from the same
> > or other clients. It looks like the poller.close()
> > does just that. One error
> > and everything stops.
> > 
> > Il continue checking to see exactly at what
> > request/ratio it happens and
> > exacly why.
> > 
> > Regards
> > And thanks
> > 
> > henry
> > 
> > 
> > 
> > 
> > -----Original Message-----
> > From:
> sim...@li...
> >
>
[mailto:sim...@li...]On
> > Behalf Of Niall
> > Gallagher
> > Sent: Tuesday, July 26, 2005 10:53 AM
> > To: sim...@li...
> > Subject: Re: [Simpleweb-Support] Problem when
> stress
> > testing an
> > application using SimpleWeb
> > 
> > 
> > Hi Henry,
> > 
> > The stream has been closed because of an error! An
> > error has occured probably because the HTTP
> request
> > contained a message body. At any rate there is
> some
> > HTTP/1.1 violation with delimeters.
> > 
> > Has your request got a message body that you have
> > failed to read?
> > 
> > Niall
> > 
> > --- Henry Voyer <hen...@ge...> wrote:
> > 
> > > Hi everyone
> > >
> > > I have been stress testing an extensive
> > transaction
> > > oriented application
> > > that uses simple.
> > > The stress test consist of using jmeter with
> > around
> > > 20 threads sending 500
> > > requests each to my server.
> > >
> > > After a couple of minutes the system stops.
> > >
> > > So i started putting logs and found the section
> > > where the errors occurs.
> > > The code :
> > >
> > > simple.http.Processor
> > >
> > >  private void execute() throws
> > InterruptedException
> > > {
> > >       logger.debug("Reading a process");
> > >       Object top = queue.dequeue();
> > >       logger.debug("Processing " +
> > > ToStringBuilder.reflectionToString(top));
> > >       Poller poller = (Poller)top;
> > >       try{
> > >          logger.debug("Who is being processed "
> +
> 
=== message truncated ===
Niall Gallagher
__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
 |