Skip to content

Commit

Permalink
http-lib: add backtrace to logs on connection without response
Browse files Browse the repository at this point in the history
Signed-off-by: Pau Ruiz Safont <[email protected]>
  • Loading branch information
psafont committed Oct 9, 2024
1 parent 8e3cb5f commit 008a813
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ocaml/libs/http-lib/http_client.ml
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,11 @@ let response_of_fd_exn fd =
(Astring.String.cuts ~sep:"\n" buf)
)

(* Use a different logging brand, the one used by {D} is ignore in the default
configuration. This allows to have visibility of an issue that interrupts
storage migrations. *)
module L = Debug.Make (struct let name = __MODULE__ end)

(** [response_of_fd fd] returns an optional Http.Response.t record *)
let response_of_fd ?(use_fastpath = false) fd =
try
Expand All @@ -188,7 +193,10 @@ let response_of_fd ?(use_fastpath = false) fd =
| Unix.Unix_error (_, _, _) as e ->
raise e
| e ->
D.debug "%s: returning no response because of the exception: %s"
Backtrace.is_important e ;
let bt = Backtrace.get e in
Debug.log_backtrace e bt ;
L.debug "%s: returning no response because of the exception: %s"
__FUNCTION__ (Printexc.to_string e) ;
None

Expand Down

0 comments on commit 008a813

Please sign in to comment.