From b5499b37d55806ea44f742bf032ccf772ff44f1f Mon Sep 17 00:00:00 2001 From: Pietro Abate Date: Sun, 20 Jan 2019 20:06:13 +0100 Subject: [PATCH] Shell: Catch timeout errors and improve reporting --- src/lib_shell/bootstrap_pipeline.ml | 3 ++- src/lib_shell/worker.ml | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lib_shell/bootstrap_pipeline.ml b/src/lib_shell/bootstrap_pipeline.ml index cbb7096d2..4c5412330 100644 --- a/src/lib_shell/bootstrap_pipeline.ml +++ b/src/lib_shell/bootstrap_pipeline.ml @@ -267,7 +267,8 @@ let rec validation_worker_loop pipeline = | Error [Exn Lwt.Canceled | Canceled | Exn Lwt_pipe.Closed] -> Lwt.return_unit | Error ([ Block_validator_errors.Invalid_block _ - | Block_validator_errors.Unavailable_protocol _ ] as err ) -> + | Block_validator_errors.Unavailable_protocol _ + | Timeout] as err ) -> (* Propagate the error to the peer validator. *) pipeline.errors <- pipeline.errors @ err ; Lwt_canceler.cancel pipeline.canceler >>= fun () -> diff --git a/src/lib_shell/worker.ml b/src/lib_shell/worker.ml index a8f32c38a..5109b995f 100644 --- a/src/lib_shell/worker.ml +++ b/src/lib_shell/worker.ml @@ -504,6 +504,9 @@ module Make end >>= function | Ok () -> loop () + | Error ([Timeout] as errs) -> + Logger.lwt_log_notice "Worker terminated with timeout" >>= fun () -> + do_close (Some errs) | Error errs -> Logger.lwt_log_error "@[Worker crashed:@,%a@]"