Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not display extremely long commandline arguments #290

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/trace_writer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,10 @@ let create_thread t event =
| None -> default_name
| Some cmdline ->
let concat_cmdline = String.concat ~sep:" " cmdline in
[%string "%{concat_cmdline} %{default_name}"])
let name = [%string "%{concat_cmdline} %{default_name}"] in
if String.length name > Tracing_zero.Writer.max_interned_string_length
then default_name
else name)
in
let track_group_id = allocate_pid t ~name in
let thread = allocate_thread t ~pid:track_group_id ~name:"main" in
Expand Down
6 changes: 4 additions & 2 deletions vendor/tracing/zero/writer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,12 @@ module String_id = struct
let max_number_of_temp_string_slots = max_value - first_temp + 1
end

(* maximum string length defined in spec, somewhat less than 2**15 *)
let max_interned_string_length = 32000 - 1

let set_string_slot t ~string_id s =
let str_len = String.length s in
(* maximum string length defined in spec, somewhat less than 2**15 *)
if str_len >= 32000
if str_len > max_interned_string_length
then failwithf "string too long for FTF trace: %i is over the limit of 32kb" str_len ();
(* String record *)
let rtype = 2 in
Expand Down
2 changes: 2 additions & 0 deletions vendor/tracing/zero/writer.mli
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ module String_id : sig
val max_number_of_temp_string_slots : int
end

val max_interned_string_length : int

(** Intern a string into the trace so that it can be referred to with very low cost.
Note that this does not check if the string has already been interned, see
[intern_string_cached].
Expand Down
Loading