Shell: Catch timeout errors and improve reporting

This commit is contained in:
Pietro Abate 2019-01-20 20:06:13 +01:00 committed by Grégoire Henry
parent 80587889d5
commit b5499b37d5
No known key found for this signature in database
GPG Key ID: 50D984F20BD445D2
2 changed files with 5 additions and 1 deletions

View File

@ -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 () ->

View File

@ -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
"@[<v 0>Worker crashed:@,%a@]"