From 44c9463b0660556ad43e189541c4809c42c05c56 Mon Sep 17 00:00:00 2001 From: Manuel Fahndrich Date: Fri, 27 Sep 2024 15:55:20 -0700 Subject: [PATCH] Add more sanity check to trace_length writing Reviewed By: alambert Differential Revision: D63497450 fbshipit-source-id: 97ffa7de47a9056d58f085de08c16cb9487eb5ae --- sapp/pipeline/model_generator.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sapp/pipeline/model_generator.py b/sapp/pipeline/model_generator.py index 74012a3..2ef4c71 100644 --- a/sapp/pipeline/model_generator.py +++ b/sapp/pipeline/model_generator.py @@ -448,8 +448,14 @@ def _generate_raw_trace_frame( leaf_records = [] leaf_mapping_ids: Set[LeafMapping] = set() for leaf, depth in leaves: - if not isinstance(depth, int) or depth < 0: - depth = None # avoid writing bad stuff to DB + # avoid writing bad trace_length to DB + if isinstance(depth, int): + if depth < 0: + depth = 0 + elif depth > 1000: + depth = 1000 + else: + depth = None leaf_record = self._get_shared_text(leaf_kind, leaf) caller_leaf_id = self.graph.get_transform_normalized_caller_kind_id( leaf_record