Hei. We are using CIO engine for our httpclient. A...
# ktor
s
Hei. We are using CIO engine for our httpclient. And often we see this error right request has been made. We noticed that the request never reaches the server, and dies with the following error while sending. Do you know what is happening, and how we can find more about whats causing it ? Version we use for ktor CIO is 1.6.8
Copy code
java.io.EOFException: Invalid chunk: content block of size 8192 ended unexpectedly
	at io.ktor.http.cio.ChunkedTransferEncodingKt.decodeChunked(ChunkedTransferEncoding.kt:92)
	at io.ktor.http.cio.ChunkedTransferEncodingKt$decodeChunked$3.invokeSuspend(ChunkedTransferEncoding.kt)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.internal.DispatchedContinuation.resumeWith(DispatchedContinuation.kt:205)
	at io.ktor.utils.io.ByteBufferChannel.resumeWriteOp(ByteBufferChannel.kt:2191)
	at io.ktor.utils.io.ByteBufferChannel.bytesRead(ByteBufferChannel.kt:908)
	at io.ktor.utils.io.ByteBufferChannel.readAsMuchAsPossible(ByteBufferChannel.kt:533)
	at io.ktor.utils.io.ByteBufferChannel.readAsMuchAsPossible$default(ByteBufferChannel.kt:514)
	at io.ktor.utils.io.ByteBufferChannel.readRemainingSuspend(ByteBufferChannel.kt:2154)
	at io.ktor.utils.io.ByteBufferChannel.readRemaining$suspendImpl(ByteBufferChannel.kt:2128)
	at io.ktor.utils.io.ByteBufferChannel.readRemaining(ByteBufferChannel.kt)
	at io.ktor.utils.io.ByteReadChannelKt.readRemaining(ByteReadChannel.kt:212)
	at io.ktor.util.ByteChannelsKt$split$1.invokeSuspend(ByteChannels.kt:25)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
cc: @Aleksei Tirman [JB]
a
Seems like some problem occurs while parsing a response body. It’s really weird that a request never reaches a server.
s
Is there something I can go on with to debug the issue ?
a
You can use a protocol analyzer like WireShark to capture a request/response and then share it with us.
s
hmm, this could be hard to do, as this happens only one api, and sporadically. All the other applications I have, use the same http client, engine, and configurations. They have never faced this problem. Neither have I been able to reproduce it. And the issue is in our production environment, where capturing request response in such a way is expensive when we don’t know when it will occur.