ring-clojure / ring

Clojure HTTP server abstraction
MIT License
3.78k stars 520 forks source link

ring hangs when attempting to use websockets with :async? true #499

Closed hiredman closed 8 months ago

hiredman commented 8 months ago

reported by Thierry in the clojurians slack.

https://downey.family/p/2024-03-22/jetty-test.clj.html is a little reproducer that monkey patches ring to call complete, if you remove the monkey patching it hangs.

LouDnl commented 8 months ago

I can confirm that implementing this monkey patch makes the async response work immediately!`

weavejester commented 8 months ago

Thanks for the report! I was wondering how this could have gotten past the tests, but it turns out this is an omission in the test suite; websockets are never tested with async handlers!

I'll plug the hole in the test suite and release a fix this weekend. Looks like it should just be a case of changing:

(upgrade-to-websocket request response response-map)

To:

(do (upgrade-to-websocket request response response-map)
    (.complete context))
LouDnl commented 8 months ago

Thanks in advance @weavejester