Skip to content

Do not use pretty print for checkpoints as it might cause stack overflow #17167

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

Open
wants to merge 4 commits into
base: compatible
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions changes/17167.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Do not use pretty print of replayer checkpoints and output file in order to avoid stack overflow issue when replaying mainnet
8 changes: 4 additions & 4 deletions src/app/replayer/replayer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ let write_replayer_checkpoint ~logger ~ledger ~last_global_slot_since_genesis
let%map input =
create_replayer_checkpoint ~ledger ~start_slot_since_genesis
in
input_to_yojson input |> Yojson.Safe.pretty_to_string
input_to_yojson input
in
let checkpoint_file =
let checkpoint_filename =
Expand All @@ -620,7 +620,7 @@ let write_replayer_checkpoint ~logger ~ledger ~last_global_slot_since_genesis
[%log info] "Writing checkpoint file"
~metadata:[ ("checkpoint_file", `String checkpoint_file) ] ;
Out_channel.with_file checkpoint_file ~f:(fun oc ->
Out_channel.output_string oc replayer_checkpoint ) )
Yojson.Safe.to_channel oc replayer_checkpoint ) )
else (
[%log info] "Not writing checkpoint file at slot %Ld, because not canonical"
last_global_slot_since_genesis
Expand Down Expand Up @@ -1681,11 +1681,11 @@ let main ~input_file ~output_file_opt ~archive_uri ~continue_on_error
~next_epoch_ledger:!next_epoch_ledger
~next_seed:!next_seed input.genesis_ledger
in
output_to_yojson output |> Yojson.Safe.pretty_to_string
output_to_yojson output
in
return
@@ Out_channel.with_file output_file ~f:(fun oc ->
Out_channel.output_string oc output ) )
Yojson.Safe.to_channel oc output ) )
else (
[%log error] "There were %d errors, not writing output"
!error_count ;
Expand Down