From bf57578951c914329307991dc0c221aeff6d88de Mon Sep 17 00:00:00 2001 From: Tatiana Racheva Date: Tue, 17 Mar 2020 15:44:03 -0700 Subject: [PATCH] Thread init/recheck IDs to ServerApi Summary: By oversight, after the rewrite, I wasn't using the real init/recheck IDs in the remote type checking scenarios and generating random IDs. This makes it impossible to correlate events belonging to the same recheck between different hosts. Reviewed By: yinghuitan Differential Revision: D19849717 fbshipit-source-id: 3fa9e64fc6aad137838a7b4c9e8daa7429447527 --- hphp/hack/src/hh_bulk_check.ml | 7 +++++-- hphp/hack/src/server/serverApi.ml | 6 +++--- hphp/hack/src/server/serverInit.ml | 2 ++ hphp/hack/src/server/serverRemoteInit.ml | 5 +++-- hphp/hack/src/server/serverRemoteInit.mli | 2 ++ hphp/hack/src/stubs/remoteWorker.ml | 10 +++++++++- 6 files changed, 24 insertions(+), 8 deletions(-) diff --git a/hphp/hack/src/hh_bulk_check.ml b/hphp/hack/src/hh_bulk_check.ml index 57ab0005213..eeac8418fcb 100644 --- a/hphp/hack/src/hh_bulk_check.ml +++ b/hphp/hack/src/hh_bulk_check.ml @@ -124,8 +124,8 @@ let make_remote_server_api () : ( module struct type naming_table = unit option - let type_check ctx files_to_check ~state_filename = - ignore (ctx, files_to_check, state_filename); + let type_check ctx ~init_id ~check_id files_to_check ~state_filename = + ignore (ctx, init_id, check_id, files_to_check, state_filename); Errors.empty let load_naming_table_base ~naming_table_base = @@ -160,11 +160,14 @@ let parse_work_args () : command = ~backend:Provider_backend.Shared_memory in let server = make_remote_server_api () in + let init_id = Random_id.short_string () in CWork (RemoteWorker.make_env ctx ~bin_root ~check_id + ~init_id + ~init_start_t:(Unix.gettimeofday ()) ~key:!key ~root ~timeout:!timeout diff --git a/hphp/hack/src/server/serverApi.ml b/hphp/hack/src/server/serverApi.ml index 364692e6935..f7d9df17bb6 100644 --- a/hphp/hack/src/server/serverApi.ml +++ b/hphp/hack/src/server/serverApi.ml @@ -178,14 +178,14 @@ let make_remote_server_api with e -> Error (Exn.to_string e)) end - let type_check ctx files_to_check ~state_filename = + let type_check ctx ~init_id ~check_id files_to_check ~state_filename = let t = Unix.gettimeofday () in Hh_logger.log "Type checking a batch..."; Typing_check_service.( let check_info = { - init_id = Random_id.short_string (); - recheck_id = None; + init_id; + recheck_id = Some check_id; profile_log = true; profile_type_check_twice = false; profile_type_check_duration_threshold = 0.0; diff --git a/hphp/hack/src/server/serverInit.ml b/hphp/hack/src/server/serverInit.ml index 3c87d34d833..40062606ec3 100644 --- a/hphp/hack/src/server/serverInit.ml +++ b/hphp/hack/src/server/serverInit.ml @@ -117,6 +117,8 @@ let init genv.workers ~worker_key ~check_id + ~init_id:env.init_env.init_id + ~init_start_t:env.init_env.init_start_t ~bin_root ~root; let t = Hh_logger.log_duration "Remote type check" t in diff --git a/hphp/hack/src/server/serverRemoteInit.ml b/hphp/hack/src/server/serverRemoteInit.ml index 3acb2401e69..50eb68f2275 100644 --- a/hphp/hack/src/server/serverRemoteInit.ml +++ b/hphp/hack/src/server/serverRemoteInit.ml @@ -11,6 +11,8 @@ let init (workers : MultiWorker.worker list option) ~(worker_key : string) ~(check_id : string) + ~(init_id : string) + ~(init_start_t : float) ~(bin_root : Path.t) ~(root : Path.t) : unit = let (server @@ -19,7 +21,6 @@ let init ServerApi.make_remote_server_api ctx workers in let (worker_env : Naming_table.t option RemoteWorker.work_env) = - RemoteWorker.make_env ctx ~bin_root ~check_id ~key:worker_key ~root server + RemoteWorker.make_env ctx ~bin_root ~check_id ~init_id ~init_start_t ~key:worker_key ~root server in - RemoteWorker.go worker_env diff --git a/hphp/hack/src/server/serverRemoteInit.mli b/hphp/hack/src/server/serverRemoteInit.mli index 4661a5bdc78..e7c3d2e9d73 100644 --- a/hphp/hack/src/server/serverRemoteInit.mli +++ b/hphp/hack/src/server/serverRemoteInit.mli @@ -12,6 +12,8 @@ val init : MultiWorker.worker list option -> worker_key:string -> check_id:string -> + init_id:string -> + init_start_t:float -> bin_root:Path.t -> root:Path.t -> unit diff --git a/hphp/hack/src/stubs/remoteWorker.ml b/hphp/hack/src/stubs/remoteWorker.ml index a964fdfea67..d37429ba24f 100644 --- a/hphp/hack/src/stubs/remoteWorker.ml +++ b/hphp/hack/src/stubs/remoteWorker.ml @@ -26,6 +26,8 @@ module type RemoteServerApi = sig (i.e., the dependency graph) *) val type_check : Provider_context.t -> + init_id:string -> + check_id:string -> Relative_path.t list -> state_filename:string -> Errors.t @@ -35,6 +37,8 @@ type 'naming_table work_env = { bin_root: Path.t; check_id: string; ctx: Provider_context.t; + init_id: string; + init_start_t: float; key: string; root: Path.t; naming_table_base: 'naming_table; @@ -46,6 +50,8 @@ let make_env (ctx : Provider_context.t) ~(bin_root : Path.t) ~(check_id : string) + ~(init_id : string) + ~(init_start_t : float) ~(key : string) ~(root : Path.t) ?(timeout = (600 : int)) @@ -53,9 +59,11 @@ let make_env 'naming_table work_env = { bin_root; - key; check_id; ctx; + init_id; + init_start_t; + key; naming_table_base = None; root; timeout; -- 2.11.4.GIT