jira-importer opened a new issue, #1490: URL: https://github.com/apache/httpcomponents-core/issues/1490
**[Laurian Vostinar](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=laurian)** opened **[HTTPCORE-733](https://issues.apache.org/jira/browse/HTTPCORE-733?redirect=false)** and commented I use BasicAsyncEntityProducer to send a small String, UTF-8 encoded. Server respondes with 307 status code so request is sent again. Second time sending fails because bytebuf is broken. Initially bytebuff has limit 24 and capacity 26 (see line this.bytebuf = charset.encode(CharBuffer.wrap(content)); with UTF-8 encoding); after releaseResources is called bytebuf has limit and capacity 26 (obviously this.length is unchanged, still 24). So send will fail because of this: ERROR com.servoy.j2db.util.Debug - Error executing a request to /create/chat with method POST with user: null, workstation: null, domain: null java.lang.IllegalStateException: Encoding process already completed at org.apache.hc.core5.util.Asserts.check(Asserts.java:38) ~[?:?] at org.apache.hc.core5.http.impl.nio.AbstractContentEncoder.assertNotCompleted(AbstractContentEncoder.java:104) ~[?:?] at org.apache.hc.core5.http.impl.nio.LengthDelimitedEncoder.write(LengthDelimitedEncoder.java:101) ~[?:?] at org.apache.hc.core5.http.impl.nio.AbstractHttp1StreamDuplexer.streamOutput(AbstractHttp1StreamDuplexer.java:497) ~[?:?] at org.apache.hc.core5.http.impl.nio.ClientHttp1StreamDuplexer$1.write(ClientHttp1StreamDuplexer.java:152) ~[?:?] at org.apache.hc.core5.http.impl.nio.ClientHttp1StreamHandler$1.write(ClientHttp1StreamHandler.java:100) ~[?:?] at org.apache.hc.client5.http.impl.async.HttpAsyncMainClientExec$1$1.write(HttpAsyncMainClientExec.java:158) ~[?:?] at org.apache.hc.core5.http.nio.entity.BasicAsyncEntityProducer.produce(BasicAsyncEntityProducer.java:132) ~[?:?] at org.apache.hc.core5.http.nio.support.BasicRequestProducer.produce(BasicRequestProducer.java:104) ~[?:?] at org.apache.hc.client5.http.impl.async.InternalAbstractHttpAsyncClient$1$2.produce(InternalAbstractHttpAsyncClient.java:278) ~[?:?] at org.apache.hc.client5.http.impl.async.HttpAsyncMainClientExec$1.produce(HttpAsyncMainClientExec.java:149) ~[?:?] at org.apache.hc.core5.http.impl.nio.ClientHttp1StreamHandler.produceOutput(ClientHttp1StreamHandler.java:199) ~[?:?] at org.apache.hc.core5.http.impl.nio.ClientHttp1StreamDuplexer.produceOutput(ClientHttp1StreamDuplexer.java:338) ~[?:?] at org.apache.hc.core5.http.impl.nio.AbstractHttp1StreamDuplexer.onOutput(AbstractHttp1StreamDuplexer.java:368) ~[?:?] at org.apache.hc.core5.http.impl.nio.AbstractHttp1IOEventHandler.outputReady(AbstractHttp1IOEventHandler.java:73) ~[?:?] at org.apache.hc.core5.http.impl.nio.ClientHttp1IOEventHandler.outputReady(ClientHttp1IOEventHandler.java:39) ~[?:?] at org.apache.hc.core5.reactor.InternalDataChannel.onIOEvent(InternalDataChannel.java:141) ~[?:?] at org.apache.hc.core5.reactor.InternalChannel.handleIOEvent(InternalChannel.java:51) ~[?:?] at org.apache.hc.core5.reactor.SingleCoreIOReactor.processEvents(SingleCoreIOReactor.java:178) ~[?:?] at org.apache.hc.core5.reactor.SingleCoreIOReactor.doExecute(SingleCoreIOReactor.java:127) ~[?:?] at org.apache.hc.core5.reactor.AbstractSingleCoreIOReactor.execute(AbstractSingleCoreIOReactor.java:85) ~[?:?] at org.apache.hc.core5.reactor.IOReactorWorker.run(IOReactorWorker.java:44) ~[?:?] at java.lang.Thread.run(Unknown Source) ~[?:?] maybe you should use flip instead of clear ? --- **Affects:** 5.2.1 -- 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]
