This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-07-02
Channels
- # aws (2)
- # babashka (24)
- # beginners (104)
- # calva (1)
- # cider (6)
- # clojure (7)
- # clojure-conj (4)
- # clojure-europe (21)
- # clojure-nl (2)
- # clojure-norway (69)
- # clojure-sweden (1)
- # clojure-uk (4)
- # clojurescript (19)
- # clr (4)
- # core-typed (1)
- # cursive (52)
- # datahike (1)
- # datalevin (7)
- # datomic (8)
- # docker (8)
- # humbleui (22)
- # hyperfiddle (4)
- # jobs-discuss (3)
- # leiningen (1)
- # off-topic (37)
- # pathom (4)
- # polylith (12)
- # remote-jobs (5)
- # vim (4)
- # yamlscript (3)
We are running a ring-jetty server and using muuntaja for json content negotiation. But too often Datadog catches an Idle TimeoutException with "Malformed application/json request." error message. Should this be considered normal since the client can actually lose the network during data transfer? Even so, waiting 10 seconds seems like an inefficient use of the servlet. How should we handle this situation?
You can't do anything about the inefficient use of the servlet except for reducing the timeout. Of course, doing so is a trade-off. Regarding the timeout exception - how to treat it depends on the app and your intentions. The simplest way in general is to pretend the request has never happened in the first place. Another way would be to store the fact that it's been made and let the user know that that specific request has failed and maybe should be retried. There might be other reasonable approaches as well. "Malformed request" seems to be tangential and, if I had to guess, is probably a result of the timeout exception being used instead of the request body in the content negotiation/parsing code.
I think it’s not desirable to consider connection lost as malformed json request. Decoding process over successfully transmitted data is good because you can tell what was wrong, network or user.
Another potential source of that error - the body gets decoded not as a fully read byte array but as a stream.
If a stream has {"a": [<EOF>
, that would also probably lead to that error, without anything being misconfigured.
But whether or not it's specifically EOF that's the problem should've been specified in the exception itself.