Skip to content

Commit

Permalink
[ondemand] fix timeout and missing-deps bad interaction
Browse files Browse the repository at this point in the history
Summary:
For logging missing deps, an exception may be raised in `Exe_env.get_proc_tenv`. When this occurs after global state has been saved in ondemand, it leads to a crash due to the timer being suspended.

At a logical level, we should not throw an exception (such as `MissingDependencies`) after saving global state without the `raise` being inside a `protect` call which will restore the global state on `finally`.

Reviewed By: davidpichardie

Differential Revision: D45807245

fbshipit-source-id: b474ba568b99ebc9cae2cf96a1095e7d7c646575
  • Loading branch information
ngorogiannis authored and facebook-github-bot committed May 15, 2023
1 parent 8baad3c commit bb8c979
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions infer/src/backend/ondemand.ml
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,10 @@ let analyze_callee exe_env ~lazy_payloads ?specialization ?caller_summary callee
RestartScheduler.with_lock callee_pname ~f:(fun () ->
let previous_global_state = AnalysisGlobalState.save () in
AnalysisGlobalState.initialize callee_pname ;
(* preload tenv to avoid tainting preanalysis timing with IO *)
let tenv = Exe_env.get_proc_tenv exe_env callee_pname in
protect
~f:(fun () ->
(* preload tenv to avoid tainting preanalysis timing with IO *)
let tenv = Exe_env.get_proc_tenv exe_env callee_pname in
Timer.time Preanalysis
~f:(fun () ->
let caller_pname = caller_summary >>| fun summ -> summ.Summary.proc_name in
Expand Down

0 comments on commit bb8c979

Please sign in to comment.