I'm thinking there is a regression in Ktor 2.0 whe...
# ktor
n
I'm thinking there is a regression in Ktor 2.0 where using
kotlinx.html
DSL exceptions are swallowed and the result of a request is just
*0.0.0.0* didn't send any data. ERR_EMPTY_RESPONSE
I found this issue for Ktor 1.x: https://youtrack.jetbrains.com/issue/KTOR-756 with status of being fixed in 1.5.4. However, I'm now using Ktor JVM 2.1.1 and
kotlinx-html-jvm:0.8.0
, and all exceptions inside the DSL get swallowed and the log just shows
Copy code
2022-09-29 20:12:45.948 [eventLoopGroupProxy-4-3]  INFO 
                Application - 200 OK: GET - /<path>
Debugging the exceptions, raised exception get to the
catch
block in
T.visitTag
in
commonMain/visit.kt
in
kotlinx-html-jvm
a
I’ve checked versions 1.5.4, 1.6.8, and 2.1.2 of Ktor and for all of them a server replies with an empty response (I’ve used a sample code from KTOR-756). So what do you think an expected behavior should be?
n
I'd expect the pipeline to fail, return 5xx and for the stack trace to be printed into server log. Now it is really unbearable and bad developer UX for the whole error to be swallowed, forcing me to debug/comment out DSL blocks for hours until I manage to narrow down the root cause that throws. Or have I somehow misread the intention and the issue I linked?
a
For all listed above versions of Ktor I can see a stack trace of an exception in logs. The 500 status code would be better indeed.
n
You have stack trace? That's weird, I have none, which is my main issue ATM. What versions you use for the kotlinx.html?
a
I didn’t use it directly but through the
ktor-server-html-builder
library.
Could you please file an issue with a code snippet attached?
1
n
Sorry it took me some time to submit. https://youtrack.jetbrains.com/issue/KTOR-4954/Installing-CallId-causes-exceptions-to-be-consumed I managed to narrow it down to the
CallId
plugin that causes all stack traces to be consumed