You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, and thanks for your work on this great package!
I have a strange (and critical!) issue. When using Dream.serve, if I send a long string to a closed connection, the program simply exits, without any error.
Here is a minimal reproduction:
Create a server with Dream.serve, which waits 3 seconds before answering a long string of as:
openLwt.Syntaxlet()=let f =let+()=Dream.serve
@@Dream.logger (fun_ ->
Logs.app (funm -> m "Starting waiting");
let*()=Lwt_unix.sleep 3.0inLogs.app (funm -> m "Finished waiting");
let x =String.init 1015765 (fun_ -> 'a') inDream.respond x)
in
print_endline "Finished"inLwt_main.run f
Start the program. Connect to localhost:8080 with a web browser, but close the tab before the 3 seconds elapses
Have a look at the log, and cry 😢:
$ dune exec ./middleware.exe
10.01.25 10:36:56.511 dream.logger INFO REQ 1 GET / ::1:48826 fd 6 Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/127.0
10.01.25 10:36:56.511 REQ 1 Starting waiting
10.01.25 10:36:59.515 REQ 1 Finished waiting
10.01.25 10:36:59.528 dream.logger INFO REQ 1 200 in 3017101 μs
$ # back to prompt. "Finished" was not even written to output... Error result is 0.
Some more comments:
Any length of answer above 1015765 result in this behavior,
Any length below works as expected
The same program but with Dream.run works!
openLwt.Syntaxlet()=Dream.run
@@Dream.logger (fun_ ->
Logs.app (funm -> m "Starting waiting");
let*()=Lwt_unix.sleep 3.0inLogs.app (funm -> m "Finished waiting");
let x =String.init 1015765(* 1061514 *) (fun_ -> 'a') inDream.respond x)
I am puzzled...
The text was updated successfully, but these errors were encountered:
Apparently, that is because of an unhandled "broken pipe" signal. I investigated the difference between Dream.serve and Dream.run, and it seems this line (taken from here) solves the problem:
let()=ifSys.unix thenSys.(set_signal sigpipe Signal_ignore) in
It makes sense, but probably should be added to Dream.serve. Or, have a mention in the doc.
Hello, and thanks for your work on this great package!
I have a strange (and critical!) issue. When using
Dream.serve
, if I send a long string to a closed connection, the program simply exits, without any error.Here is a minimal reproduction:
Dream.serve
, which waits 3 seconds before answering a long string ofa
s:Start the program. Connect to localhost:8080 with a web browser, but close the tab before the 3 seconds elapses
Have a look at the log, and cry 😢:
Some more comments:
Any length of answer above 1015765 result in this behavior,
Any length below works as expected
The same program but with
Dream.run
works!I am puzzled...
The text was updated successfully, but these errors were encountered: