Skip to content

Commit

Permalink
test: let’s see if it crashes now..
Browse files Browse the repository at this point in the history
More debug

Make the obuilder-spec printing a tiny bit faster

Use http-lwt-client instead of cohttp-lwt-unix for the client part

Give better error message from http-lwt-client

Fix issues with h2 and http-lwt-client

Show all the logs in debug mode

Fix last commit (logs requires Logs.set_reporter to be called to actually print anything)

Be more specific for the debug logs

Remove debug logging on the webhook requests

Return 404 instead of 500 (exn Not_found) when getting a request for a non-existant log file

Return 404 instead of 500 (exn Not_found) when getting a request for a non-existant log directory

Wait for most of the possibly blocking actions to finish before calling the webhooks

Return some helpful error message when no run exist yet instead of 500

Do not wait for the end of initialisation to start the tcp servers

Fix the display of opam metadata

Use opam-dev instead of opam 2.1

Revert "Wait for most of the possibly blocking actions to finish before calling the webhooks"

This reverts commit aa89ab8.

Revert "Do not wait for the end of initialisation to start the tcp servers"

This reverts commit 6ed4ce9.

Fix compilation after the previous git reverts

Revert 39b14a5

Try to debug a new Lwt_io.Channel_closed(input) exception at the end of each run when reloading the cache

Avoid race conditions with the cache

Revert 4a8e2a6.

Remove possible Lwt_io.Channel_closed("input") exception

Rewrite some use of Lwt_io.read_line_opt to read line faster (and hopefully elimitate an unknown Lwt_io.Channel_closed("input") race-condition)

Give the docker image hash explicitly to improve reliablity and fix e56c933

Use lwt_ppx instead of Lwt.finally

Fix "TLS failure: End_of_file" (robur-coop/http-lwt-client#8)
  • Loading branch information
kit-ty-kate committed Jan 12, 2022
1 parent e795df2 commit 873de6c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
23 changes: 16 additions & 7 deletions lib/oca_lib.ml
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,25 @@ let pread ?cwd ?exit1 ~timeout cmd f =
Lwt.fail (Failure "process failure")
end

let read_unordered_lines c =
let read_unordered_lines ~typical_line_size c =
let buffer = Buffer.create typical_line_size in
let rec aux acc =
match%lwt Lwt_io.read_line_opt c with
| None -> Lwt.return acc (* Note: We don't care about the line ordering *)
| Some line -> aux (line :: acc)
match%lwt Lwt_io.read ~count:typical_line_size c with
| "" -> Lwt.return acc (* Note: We don't care about the line ordering *)
| str ->
Buffer.add_string buffer str;
let lines = String.split_on_char '\n' (Buffer.contents buffer) in
let rec add_lines acc = function
| [] -> assert false (* State not reachable by String.split_on_char *)
| [x] -> Buffer.clear buffer; Buffer.add_string buffer x; acc
| x::xs -> add_lines (x :: acc) xs
in
aux (add_lines acc lines)
in
aux []

let scan_tpxz_archive archive =
pread ~timeout:60. ["pixz"; "-l"; Fpath.to_string archive] read_unordered_lines
pread ~timeout:60. ["pixz"; "-l"; Fpath.to_string archive] (read_unordered_lines ~typical_line_size:64)

let random_access_tpxz_archive ~file archive =
let file = Filename.quote file in
Expand All @@ -96,13 +105,13 @@ let compress_tpxz_archive ~cwd ~directories archive =

let ugrep_dir ~switch ~regexp ~cwd =
let cwd = Fpath.to_string cwd in
pread ~timeout:60. ~cwd ~exit1:[] ["ugrep"; "-Rl"; "--include="^switch^"/**"; "--regexp="^regexp; "."] read_unordered_lines
pread ~timeout:60. ~cwd ~exit1:[] ["ugrep"; "-Rl"; "--include="^switch^"/**"; "--regexp="^regexp; "."] (read_unordered_lines ~typical_line_size:64)

let ugrep_tpxz ~switch ~regexp ~archive =
let switch = Filename.quote switch in
let regexp = Filename.quote regexp in
let archive = Filename.quote (Fpath.to_string archive) in
pread ~timeout:60. ~exit1:[] ["sh"; "-c"; "pixz -x "^switch^" -i "^archive^" | ugrep -zl --format='%z%~' --regexp="^regexp] read_unordered_lines
pread ~timeout:60. ~exit1:[] ["sh"; "-c"; "pixz -x "^switch^" -i "^archive^" | ugrep -zl --format='%z%~' --regexp="^regexp] (read_unordered_lines ~typical_line_size:64)

let mkdir_p dir =
let rec aux base = function
Expand Down
1 change: 1 addition & 0 deletions server/lib/dune
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
fpath
uri
re
logs
current_ansi
oca_lib))

0 comments on commit 873de6c

Please sign in to comment.