[config] add option to disable the DBWriter daemon

Summary:
This seems needed in some cases, might as well provide the option since
Infer is supposed to work with or without it.

Reviewed By: ngorogiannis

Differential Revision: D28712272

fbshipit-source-id: 35c0708f2
master
Jules Villard 4 years ago committed by Facebook GitHub Bot
parent 7211e4cfbc
commit 199f707495

@ -71,7 +71,7 @@ case "${OS}" in
BUILD_PLATFORM=Windows BUILD_PLATFORM=Windows
;; ;;
*) *)
AC_MSG_ERROR(["OS $unamestr is not supported"]) AC_MSG_ERROR(["OS $uname_str is not supported"])
;; ;;
esac esac
esac esac

@ -1611,6 +1611,11 @@ INTERNAL OPTIONS
--costs-previous-reset --costs-previous-reset
Cancel the effect of --costs-previous. Cancel the effect of --costs-previous.
--no-dbwriter
Deactivates: Use a separate process to serialize writes to sqlite.
Disabling this will degrade performance. Note that this is always
disabled on Windows and WSL. (Conversely: --dbwriter)
--debug-exceptions --debug-exceptions
Activates: Generate lightweight debugging information: just print Activates: Generate lightweight debugging information: just print
the internal exceptions during analysis (also sets the internal exceptions during analysis (also sets

@ -127,6 +127,15 @@ let fail_on_issue_exit_code = 2
(** If true, treat calls to no-arg getters as idempotent w.r.t non-nullness *) (** If true, treat calls to no-arg getters as idempotent w.r.t non-nullness *)
let idempotent_getters = true let idempotent_getters = true
let is_WSL =
match Utils.read_file "/proc/version" with
| Ok [line] ->
let re = Str.regexp "Linux.+-Microsoft" in
Str.string_match re line 0
| _ ->
false
let ivar_attributes = "ivar_attributes" let ivar_attributes = "ivar_attributes"
let java_lambda_marker_infix = "$Lambda$" let java_lambda_marker_infix = "$Lambda$"
@ -1286,6 +1295,12 @@ and ( biabduction_write_dotty
, write_html ) , write_html )
and dbwriter =
CLOpt.mk_bool ~default:true ~long:"dbwriter"
"Use a separate process to serialize writes to sqlite. Disabling this will degrade \
performance. Note that this is always disabled on Windows and WSL."
and dependencies = and dependencies =
CLOpt.mk_bool ~deprecated:["dependencies"] ~long:"dependencies" CLOpt.mk_bool ~deprecated:["dependencies"] ~long:"dependencies"
~in_help:InferCommand.[(Capture, manual_java)] ~in_help:InferCommand.[(Capture, manual_java)]
@ -2464,13 +2479,8 @@ and sqlite_lock_timeout =
and sqlite_vfs = and sqlite_vfs =
let default = let default =
match Utils.read_file "/proc/version" with
| Result.Ok [line] ->
let re = Str.regexp "Linux.+-Microsoft" in
(* on WSL (bash on Windows) standard SQLite VFS can't be used, see WSL/issues/1927 WSL/issues/2395 *) (* on WSL (bash on Windows) standard SQLite VFS can't be used, see WSL/issues/1927 WSL/issues/2395 *)
if Str.string_match re line 0 then Some "unix-excl" else None if is_WSL then Some "unix-excl" else None
| _ ->
None
in in
CLOpt.mk_string_opt ?default ~long:"sqlite-vfs" "VFS for SQLite" CLOpt.mk_string_opt ?default ~long:"sqlite-vfs" "VFS for SQLite"
@ -3026,6 +3036,8 @@ and cxx = !cxx
and cxx_scope_guards = !cxx_scope_guards and cxx_scope_guards = !cxx_scope_guards
and dbwriter = !dbwriter
and debug_level_analysis = !debug_level_analysis and debug_level_analysis = !debug_level_analysis
and debug_level_capture = !debug_level_capture and debug_level_capture = !debug_level_capture

@ -72,6 +72,9 @@ val idempotent_getters : bool
val initial_analysis_time : float val initial_analysis_time : float
val is_WSL : bool
(** Windows Subsystem for Linux *)
val ivar_attributes : string val ivar_attributes : string
val java_lambda_marker_infix : string val java_lambda_marker_infix : string
@ -258,6 +261,8 @@ val cxx : bool
val cxx_scope_guards : Yojson.Basic.t val cxx_scope_guards : Yojson.Basic.t
val dbwriter : bool
val deduplicate : bool val deduplicate : bool
val debug_exceptions : bool val debug_exceptions : bool

@ -385,7 +385,10 @@ module Server = struct
send Command.Handshake send Command.Handshake
end end
let use_daemon = Config.((not (buck || genrule_mode)) && jobs > 1) let use_daemon =
let is_windows = match Version.build_platform with Windows -> true | Linux | Darwin -> false in
Config.((not is_windows) && (not is_WSL) && dbwriter && (not (buck || genrule_mode)) && jobs > 1)
let perform cmd = if use_daemon then Server.send cmd else Command.execute cmd let perform cmd = if use_daemon then Server.send cmd else Command.execute cmd

Loading…
Cancel
Save