Closed agcom closed 4 years ago
Hi @Agcom, I managed to reproduce the problem. It looks like we have 2 issues here: one with the server logging and one with the freeze.
Hi @e5l Yes, and they should be related I believe (in this particular use case). Noticeable issues:
StatusPages
(Netty, CIO).400, Can't recieve multipart
, after a non caught exception (should do 500, Internal server error
).MultiPartData.readPart()
documentation says:
Reads next part data or null if end of multipart stream encountered
.
Then, instead of the exception, it should just return null
.
MultiPartData.readPart()
throwing the exception
Ktor Version and Engine Used (client or server and name) 1.3.2, CIO engine client/server
Describe the bug Imagine the following server
Which tries to read a part from a multipart request.
But the client can be tricky. What trick? Sending empty body for a multipart request.
For example, in ktor language it can be expressed like this (the problem is not related to any particular client)
Run the server, then make the request. It will timeout (or hangs indefinitely) and the server logs
Also tested with Netty server engine but that worked as expected (client receives
400, Can't recieve multipart
).WAIT! Haven't reach the interesting part yet.
Install
StatusPages
feature on the server module and add an exception (so it will intercept the pipeline), like thisThen run the server and make the request again.
Surprise! one step forward. Now the server logs (yet the request times out on the client)
Also tested with Netty engine. She is more reasonable. Throws the same exception but the client receives the expected message
400, Can't recieve multipart
.It seems like the server is trying to fully read the request before responding.
Expected behavior I caught the
IOException
and responded accordingly. Why would the server try again and rise that exception again?Expected behavior would be the client receiving
400, Can't recieve multipart
and no error logs in the server.