[sqlite] kill write daemon in all circumstances

Summary:
An exception thrown during capture/analysis may leave the daemon
running.  Kill it even when one is thrown.

Reviewed By: martintrojer

Differential Revision: D17181090

fbshipit-source-id: a7b002f23
master
Nikos Gorogiannis 5 years ago committed by Facebook Github Bot
parent d04e098eb1
commit c872fb5e1d

@ -15,12 +15,17 @@ module L = Logging
let run driver_mode =
let open Driver in
run_prologue driver_mode ;
let changed_files = read_config_changed_files () in
InferAnalyze.invalidate_changed_procedures changed_files ;
capture driver_mode ~changed_files ;
analyze_and_report driver_mode ~changed_files ;
run_epilogue ()
if CLOpt.is_originator && Config.(sqlite_write_daemon && not (buck || genrule_mode)) then
DBWriter.start () ;
Utils.try_finally_swallow_timeout
~f:(fun () ->
run_prologue driver_mode ;
let changed_files = read_config_changed_files () in
InferAnalyze.invalidate_changed_procedures changed_files ;
capture driver_mode ~changed_files ;
analyze_and_report driver_mode ~changed_files ;
run_epilogue () )
~finally:(fun () -> if CLOpt.is_originator && Config.sqlite_write_daemon then DBWriter.stop ())
let run driver_mode = ScubaLogging.execute_with_time_logging "run" (fun () -> run driver_mode)

@ -576,8 +576,7 @@ let run_prologue mode =
mono-threaded execution. *)
Unix.unsetenv "MAKEFLAGS" ;
(* disable the Buck daemon as changes in the Buck or infer config may be missed otherwise *)
Unix.putenv ~key:"NO_BUCKD" ~data:"1" ;
if Config.(sqlite_write_daemon && not (buck || genrule_mode)) then DBWriter.start () ) ;
Unix.putenv ~key:"NO_BUCKD" ~data:"1" ) ;
()
@ -588,7 +587,6 @@ let run_prologue mode =
let run_epilogue () =
if CLOpt.is_originator then (
if Config.developer_mode then StatsAggregator.generate_files () ;
if Config.sqlite_write_daemon then DBWriter.stop () ;
if Config.fail_on_bug then fail_on_issue_epilogue () ;
() ) ;
if Config.buck_cache_mode then clean_results_dir () ;

Loading…
Cancel
Save