You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2023/02/14 21:26:00 UTC
[jira] [Commented] (HTTPCORE-733) BasicAsyncEntityProducer error on second time send
[ https://issues.apache.org/jira/browse/HTTPCORE-733?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17688709#comment-17688709 ]
ASF subversion and git services commented on HTTPCORE-733:
----------------------------------------------------------
Commit 473fc0a71ed63ecca29694fac6db396cf9be334b in httpcomponents-core's branch refs/heads/real-world-encoding from Oleg Kalnichevski
[ https://gitbox.apache.org/repos/asf?p=httpcomponents-core.git;h=473fc0a71 ]
HTTPCORE-733: BasicAsyncEntityProducer sends an extra trailing 0 with UTF-8 encoded content
> BasicAsyncEntityProducer error on second time send
> ---------------------------------------------------
>
> Key: HTTPCORE-733
> URL: https://issues.apache.org/jira/browse/HTTPCORE-733
> Project: HttpComponents HttpCore
> Issue Type: Bug
> Components: HttpCore
> Affects Versions: 5.2.1
> Reporter: Laurian Vostinar
> Priority: Minor
>
> 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 ?
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org