jira-importer opened a new issue, #929:
URL: https://github.com/apache/httpcomponents-core/issues/929

   **[Anders 
Wallgren](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=awallgren)**
 opened 
**[HTTPCORE-51](https://issues.apache.org/jira/browse/HTTPCORE-51?redirect=false)**
 and commented
   
   In my test suite, I'm sending a single post, but I'm finding that my 
HttpRequestExecutionHandler.submitRequest handler is being called multiple 
times.  I think I've tracked it down to 
DefaultNHttpClientConnection.productOutput:
   
       public void produceOutput(final NHttpClientHandler handler) {
           try {
               if (this.outbuf.hasData()) {
                   this.outbuf.flush(this.session.channel());   <<--- this is 
called
               }
               if (!this.outbuf.hasData()) {
                   if (this.closed) {
                       this.session.close();
                       resetOutput();
                       return;
                   } else {
                       if (this.contentEncoder != null) {
                           handler.outputReady(this, this.contentEncoder);
                           if (this.contentEncoder.isCompleted()) {
                               resetOutput();   <<<<----- then this 
                           }
                       }
                   }
                   if (this.contentEncoder == null && !this.outbuf.hasData()) {
                       this.session.clearEvent(EventMask.WRITE);
                   }
               }
           } catch (IOException ex) {
               handler.exception(this, ex);
           } finally {
               // Finally set buffered output flag
               this.hasBufferedOutput = this.outbuf.hasData();
           }
       
           if (this.request == null && !this.closed) {
               handler.requestReady(this);   <<<--- then this
           }
       }
   
   The sequence of events is that my submitRequest is called once, then when 
the channel becomes writable, produceOutput is called.  It's a small request (3 
bytes of content), so the first branch is followed and outbuf is flushed.  Then 
there is no more data, and the second branch is called, where resetOutput is 
called, but the method doesn't return.  Then, at the bottom of produceOutput, 
handle.requestReady is called again, since resetOutput set request to null.
   
   Am I doing something wrong, or is there a bug here?
   
   
   ---
   No further details from 
[HTTPCORE-51](https://issues.apache.org/jira/browse/HTTPCORE-51?redirect=false)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to