From bea3f3b4399ac2544fdf836db879796c1c421148 Mon Sep 17 00:00:00 2001 From: Nikos Gorogiannis Date: Fri, 9 Apr 2021 06:39:28 -0700 Subject: [PATCH] [starvation] add more detail in reporting Summary: Add more informative messaging in report string. Reviewed By: da319 Differential Revision: D27674828 fbshipit-source-id: 52c4ada0b --- infer/src/concurrency/starvation.ml | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/infer/src/concurrency/starvation.ml b/infer/src/concurrency/starvation.ml index afbd8447a..39ed0719b 100644 --- a/infer/src/concurrency/starvation.ml +++ b/infer/src/concurrency/starvation.ml @@ -674,7 +674,8 @@ let report_on_parallel_composition ~should_report_starvation tenv pattrs pair lo && Acquisitions.lock_is_held_in_other_thread tenv lock acquisitions -> let error_message = Format.asprintf - "Method %a runs on UI thread and%a, which may be held by another thread which %a." + "Method %a runs on UI thread and%a, which may be held by another thread which %a. \ + This may regress scroll performance or cause ANRs." pname_pp pname Lock.pp_locks lock Event.describe event in let ltr, loc = make_trace_and_loc () in @@ -685,7 +686,8 @@ let report_on_parallel_composition ~should_report_starvation tenv pattrs pair lo && not (Lock.equal lock monitor_lock) -> let error_message = Format.asprintf - "Method %a runs on UI thread and%a, which may be held by another thread which %a." + "Method %a runs on UI thread and%a, which may be held by another thread which %a. \ + This may regress scroll performance or cause ANRs." pname_pp pname Lock.pp_locks lock Event.describe other_pair.CriticalPair.elem.event in let ltr, loc = make_trace_and_loc () in @@ -724,22 +726,28 @@ let report_on_pair ~analyze_ondemand tenv pattrs (pair : Domain.CriticalPair.t) match event with | Ipc _ when is_not_private && should_report_starvation -> let error_message = - Format.asprintf "Method %a runs on UI thread and may perform blocking IPC; %a." pname_pp - pname Event.describe event + Format.asprintf + "Method %a runs on UI thread and may perform blocking IPC, potentially regressing scroll \ + performance or causing ANRs; %a." + pname_pp pname Event.describe event in let ltr, loc = make_trace_and_loc () in ReportMap.add_ipc tenv pattrs loc ltr error_message report_map | MayBlock _ when is_not_private && should_report_starvation -> let error_message = - Format.asprintf "Method %a runs on UI thread and may block; %a." pname_pp pname - Event.describe event + Format.asprintf + "Method %a runs on UI thread and may block, potentially regressing scroll performance or \ + causing ANRs; %a." + pname_pp pname Event.describe event in let ltr, loc = make_trace_and_loc () in ReportMap.add_starvation tenv pattrs loc ltr error_message report_map | MonitorWait _ when is_not_private && should_report_starvation -> let error_message = - Format.asprintf "Method %a runs on UI thread and may block; %a." pname_pp pname - Event.describe event + Format.asprintf + "Method %a runs on UI thread and may block, potentially regressing scroll performance or \ + causing ANRs; %a." + pname_pp pname Event.describe event in let ltr, loc = make_trace_and_loc () in ReportMap.add_starvation tenv pattrs loc ltr error_message report_map