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

simulation: Write logs on panic #2285

Merged
merged 3 commits into from
Sep 11, 2018
Merged

simulation: Write logs on panic #2285

merged 3 commits into from
Sep 11, 2018

Conversation

ValarDragon
Copy link
Contributor

@ValarDragon ValarDragon commented Sep 9, 2018

If the logs are large, it gets written to a file. Additionally, this PR also does a slight refactor so that simulation returns an error. This means when we do SIGTERM/ SIGINT the database cleanup code still gets ran.

  • Targeted PR against correct branch (see CONTRIBUTING.md)

  • Added entries in PENDING.md with issue #

  • rereviewed Files changed in the github PR explorer


For Admin Use:

  • Added appropriate labels to PR (ex. wip, ready-for-review, docs)
  • Reviewers Assigned
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)

sdk "github.com/cosmos/cosmos-sdk/types"
dbm "github.com/tendermint/tendermint/libs/db"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linting was failing here, so I just ran make format.

@codecov
Copy link

codecov bot commented Sep 9, 2018

Codecov Report

Merging #2285 into develop will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff            @@
##           develop    #2285   +/-   ##
========================================
  Coverage    63.87%   63.87%           
========================================
  Files          140      140           
  Lines         8682     8682           
========================================
  Hits          5546     5546           
  Misses        2756     2756           
  Partials       380      380

fmt.Printf("Exiting early due to SIGTERM, on block %d, operation %d\n", header.Height, opCount)
DisplayEvents(events)
os.Exit(128 + int(syscall.SIGTERM))
fmt.Printf("Exiting early due to SIGTERM/SIGINT, on block %d, operation %d\n", header.Height, opCount)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not:

sig := <-c
fmt.Printf("Exiting early due to %s, on block %d, operation %d\n", sig, header.Height, opCount)

DisplayEvents(events)
os.Exit(128 + int(syscall.SIGTERM))
fmt.Printf("Exiting early due to SIGTERM/SIGINT, on block %d, operation %d\n", header.Height, opCount)
simError = errors.New("Exited due to SIGTERM/SIGINT")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

@jackzampolin
Copy link
Member

Is this PR ready to go? Seems like this is necessary for debugging some of the bugs simulation uncovered.

@ValarDragon
Copy link
Contributor Author

Yup this should be good to merge, pending review / approval. Anyone whose debugging can just directly use this branch for now though.

Copy link
Contributor

@cwgoes cwgoes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

@cwgoes cwgoes merged commit 962b04d into develop Sep 11, 2018
@cwgoes cwgoes deleted the dev/sim_log_on_panic branch September 11, 2018 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants