Browser REPL server hang when receive unknown POST

Description

When running tests, those tests may fire off a HTTP request. In general, these shouldn't go to the ClojureScript REPL server but accidents happen and/or the user doesn't care about the HTTP request succeeding (fire & forget). However, this can cause an issue with the REPL hanging due to the network request never returning. This is due to the fact that the server as set up by the browser REPL is not able to handle: A) Non-EDN input, B) A null type dispatch, when something submitted happens to be valid EDN by accident

Repro:

Run ClojureScript Browser REPL in one terminal:

Run cURL in another terminal:

cURL will never terminate. It will wait for response from Cljs. Cljs terminal will print the following to STDOUT:

Environment

None

Activity

Show:
Dominic Monroe
February 25, 2020, 9:08 PM

I’ve uploaded 3 patches that shows various different approaches.

Of these, I think -3 should be used, as it will ensure that in all cases of failure (these and others we don’t know about) the socket is closed & 500 is sent.

Fixed
Your pinned fields
Click on the next to a field label to start pinning.

Assignee

David Nolen

Reporter

Dominic Monroe

Approval

Accepted

Patch

Code