Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't assume perf is still alive after sending it SIGTERM #293

Merged
merged 1 commit into from
Feb 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/perf_tool_backend.ml
Original file line number Diff line number Diff line change
Expand Up @@ -440,10 +440,13 @@ module Recording = struct

let finish_recording t =
Signal_unix.send_i Signal.term (`Pid t.pid);
(* This should usually be a signal exit, but we don't really care, if it didn't produce
a good perf.data file the next step will fail. *)
let%map (res : Core_unix.Exit_or_signal.t) = Async_unix.Unix.waitpid t.pid in
perf_exit_to_or_error res
(* This should usually be a signal exit, but we don't really care, if it didn't
produce a good perf.data file the next step will fail.

[Monitor.try_with] because [waitpid] raises if perf exited before we get here. *)
match%map.Deferred Monitor.try_with (fun () -> Async_unix.Unix.waitpid t.pid) with
| Ok res -> perf_exit_to_or_error res
| Error _exn -> Ok ()
;;
end

Expand Down
Loading