Did anyone encounter `Broken delimiter occurred` i...
# ktor
b
Did anyone encounter
Broken delimiter occurred
in ktor server (netty engine)? i have a super simple python script which uploads files of size 2-4MB (with method PUT) and it works well in general but in like 1 out of 2000 cases i get this error message.
python basically does
Copy code
files = {'upload_file': open(file_name, 'rb')}
requests.put("<http://%s:8080/api/matrices/%s/upload>" % (api_endpoint, cleaned_name), files=files,
                        timeout=None)
that's the line where the error message comes from
the error message is not very helpful
my guess is that python chooses a delimiter which ktor doesn't like but i have no way of knowing 🙂
it seems it only happens when there are multiple clients uploading data concurrently .. but also hard to verify.
Copy code
2019-09-17 11:43:22.699 [nioEventLoopGroup-4-2] ERROR Application - Broken delimiter occurred
java.io.IOException: Broken delimiter occurred
        at kotlinx.coroutines.io.DelimitedKt$skipDelimiterSuspend$2.invokeSuspend(Delimited.kt:58)
        at kotlinx.coroutines.io.DelimitedKt$skipDelimiterSuspend$2.invoke(Delimited.kt)
        at kotlinx.coroutines.io.ByteBufferChannel.lookAheadSuspend(ByteBufferChannel.kt:1838)
        at kotlinx.coroutines.io.DelimitedKt.skipDelimiterSuspend(Delimited.kt:56)
        at kotlinx.coroutines.io.DelimitedKt.skipDelimiter(Delimited.kt:51)
        at io.ktor.http.cio.MultipartKt.boundary(Multipart.kt:160)
        at io.ktor.http.cio.MultipartKt$parseMultipart$1.invokeSuspend(Multipart.kt:319)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedContinuation.resumeWith(Dispatched.kt:108)
        at kotlinx.coroutines.io.internal.CancellableReusableContinuation.resumeWith(CancellableReusableContinuation.kt:93)
        at kotlinx.coroutines.io.ByteBufferChannel.resumeWriteOp(ByteBufferChannel.kt:2230)
        at kotlinx.coroutines.io.ByteBufferChannel.bytesRead(ByteBufferChannel.kt:877)
        at kotlinx.coroutines.io.ByteBufferChannel.readAsMuchAsPossible(ByteBufferChannel.kt:438)
        at kotlinx.coroutines.io.ByteBufferChannel.readAvailable(ByteBufferChannel.kt:571)
        at kotlinx.coroutines.io.ByteBufferChannel.readAvailableSuspend(ByteBufferChannel.kt:605)
        at kotlinx.coroutines.io.ByteBufferChannel$readAvailableSuspend$2.invokeSuspend(ByteBufferChannel.kt)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:241)
        at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
        at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:416)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:515)
        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:918)
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.base/java.lang.Thread.run(Thread.java:834)
should i create a ticket for that?