`Fatal error: exception Bad file descriptor` errors
Here's an example: https://gitlab.com/tezos/tezos/-/jobs/4344481114#L4074
Discussed previously on slack with @romain.nl. I'll paste the conversation here (hope you don't mind):
Le mauvais fd peut être soit :
- stdout
- --log-file
Le seul qu’on close (et qui peut donc faire EBADF) parmis ces deux-là est --log-file. Il est fermé à deux endroits :
- si on met un deuxième --log-file
- at_exit
Donc : le plus probable serait que quand le worker reçoit son SIGTERM, il y a un at_exit qui ferme le --log-file, suivi d’un Log.quelque_chose.Je propose donc ce patch :
diff --git a/lib_core/cli.ml b/lib_core/cli.ml index 4429368..ec20376 100644 --- a/lib_core/cli.ml +++ b/lib_core/cli.ml @@ -107,7 +107,13 @@ let options = test_args = String_map.empty; } -let () = at_exit @@ fun () -> Option.iter close_out options.log_file +let () = at_exit @@ fun () -> + match options.log_file with + | None -> + () + | Some log_file -> + options.log_file <- None; + close_out options.log_file let init ?args () = let set_log_level = function
qu’il faut de toute façon faire.Mais ça veut dire qu’on risque de perdre quelques logs dans le log file, donc il faudrait aussi investiguer pourquoi on log après at_exit.