-
Notifications
You must be signed in to change notification settings - Fork 238
chore: better output on errors #2879
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -7,6 +7,7 @@ | |||||
| "os" | ||||||
| "os/signal" | ||||||
| "path/filepath" | ||||||
| "runtime" | ||||||
| "strings" | ||||||
| "syscall" | ||||||
| "time" | ||||||
|
|
@@ -21,12 +22,12 @@ | |||||
| "github.com/evstack/ev-node/node" | ||||||
| rollconf "github.com/evstack/ev-node/pkg/config" | ||||||
| genesispkg "github.com/evstack/ev-node/pkg/genesis" | ||||||
| "github.com/evstack/ev-node/pkg/p2p" | ||||||
| "github.com/evstack/ev-node/pkg/p2p/key" | ||||||
| "github.com/evstack/ev-node/pkg/signer" | ||||||
| "github.com/evstack/ev-node/pkg/signer/file" | ||||||
| ) | ||||||
|
|
||||||
| const DefaultMaxBlobSize = 2 * 1024 * 1024 // 2MB | ||||||
| const DefaultMaxBlobSize = 1.5 * 1024 * 1024 // 1.5MB | ||||||
|
|
||||||
| // ParseConfig is an helpers that loads the node configuration and validates it. | ||||||
| func ParseConfig(cmd *cobra.Command) (rollconf.Config, error) { | ||||||
|
|
@@ -82,7 +83,7 @@ | |||||
| executor coreexecutor.Executor, | ||||||
| sequencer coresequencer.Sequencer, | ||||||
| da coreda.DA, | ||||||
| p2pClient *p2p.Client, | ||||||
| nodeKey *key.NodeKey, | ||||||
| datastore datastore.Batching, | ||||||
| nodeConfig rollconf.Config, | ||||||
| genesis genesispkg.Genesis, | ||||||
|
|
@@ -138,7 +139,7 @@ | |||||
| sequencer, | ||||||
| da, | ||||||
| signer, | ||||||
| p2pClient, | ||||||
| nodeKey, | ||||||
|
Check failure on line 142 in pkg/cmd/run_node.go
|
||||||
alpe marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| genesis, | ||||||
| datastore, | ||||||
| metrics, | ||||||
|
|
@@ -155,8 +156,10 @@ | |||||
| go func() { | ||||||
| defer func() { | ||||||
| if r := recover(); r != nil { | ||||||
| err := fmt.Errorf("node panicked: %v", r) | ||||||
| logger.Error().Interface("panic", r).Msg("Recovered from panic in node") | ||||||
| buf := make([]byte, 1024) | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The buffer size of 1024 bytes for capturing the stack trace might be too small for complex panics, potentially leading to truncated and incomplete stack traces. This would hinder debugging, which is contrary to the goal of this PR. It's recommended to use a larger buffer. For example, Go's
Suggested change
|
||||||
| n := runtime.Stack(buf, false) | ||||||
| err := fmt.Errorf("node panicked: %v\nstack trace:\n%s", r, buf[:n]) | ||||||
| logger.Error().Interface("panic", r).Str("stacktrace", string(buf[:n])).Msg("Recovered from panic in node") | ||||||
| select { | ||||||
| case errCh <- err: | ||||||
| default: | ||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.