Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
add crash-report capabilities #574
Conversation
fileName := "crashreport_" + time.Now().Format("20060102150405") + ".txt" | ||
currDir, err := osext.ExecutableFolder() | ||
if err != nil { | ||
panic(err) |
umbynos
Nov 30, 2020
Author
Collaborator
I don't know if it's correct to panic inside a defer
function. Maybe it's better to log the error. Returning the error is not possible.
I don't know if it's correct to panic inside a defer
function. Maybe it's better to log the error. Returning the error is not possible.
@@ -111,6 +111,9 @@ func main() { | |||
os.Exit(0) | |||
} | |||
|
|||
// function used to save panic to a file (WIP) | |||
defer panicToFile() | |||
|
umbynos
Nov 30, 2020
Author
Collaborator
To try the feature I added
panic("test")
after the defer
and the file generated contains this stacktrace:
stacktrace from panic:
goroutine 1 [running, locked to thread]:
runtime/debug.Stack(0x0, 0x0, 0x0)
/home/linuxbrew/.linuxbrew/Cellar/go/1.15.3/libexec/src/runtime/debug/stack.go:24 +0xa5
main.panicToFile()
/home/umberto/Nextcloud/8tb/Lavoro/arduino-create-agent/main.go:165 +0x22d
panic(0xa09400, 0xb0ebb0)
/home/linuxbrew/.linuxbrew/Cellar/go/1.15.3/libexec/src/runtime/panic.go:975 +0x4c6
main.main()
/home/umberto/Nextcloud/8tb/Lavoro/arduino-create-agent/main.go:117 +0x98
And this is stderr:
panic: test [recovered]
panic: test
goroutine 1 [running, locked to thread]:
main.panicToFile()
/home/umberto/Nextcloud/8tb/Lavoro/arduino-create-agent/main.go:170 +0x49b
panic(0xa09400, 0xb0ebb0)
/home/linuxbrew/.linuxbrew/Cellar/go/1.15.3/libexec/src/runtime/panic.go:975 +0x4c6
main.main()
/home/umberto/Nextcloud/8tb/Lavoro/arduino-create-agent/main.go:117 +0x98
To try the feature I added
panic("test")
after the defer
and the file generated contains this stacktrace:
stacktrace from panic:
goroutine 1 [running, locked to thread]:
runtime/debug.Stack(0x0, 0x0, 0x0)
/home/linuxbrew/.linuxbrew/Cellar/go/1.15.3/libexec/src/runtime/debug/stack.go:24 +0xa5
main.panicToFile()
/home/umberto/Nextcloud/8tb/Lavoro/arduino-create-agent/main.go:165 +0x22d
panic(0xa09400, 0xb0ebb0)
/home/linuxbrew/.linuxbrew/Cellar/go/1.15.3/libexec/src/runtime/panic.go:975 +0x4c6
main.main()
/home/umberto/Nextcloud/8tb/Lavoro/arduino-create-agent/main.go:117 +0x98
And this is stderr:
panic: test [recovered]
panic: test
goroutine 1 [running, locked to thread]:
main.panicToFile()
/home/umberto/Nextcloud/8tb/Lavoro/arduino-create-agent/main.go:170 +0x49b
panic(0xa09400, 0xb0ebb0)
/home/linuxbrew/.linuxbrew/Cellar/go/1.15.3/libexec/src/runtime/panic.go:975 +0x4c6
main.main()
/home/umberto/Nextcloud/8tb/Lavoro/arduino-create-agent/main.go:117 +0x98
Problems still to be solved:
|
…ort" This reverts commit e539837.
I've changed the approach: now everything happening on stderr is redirected to the crash-report saved locally. I've followed this issue There's still work to do regarding stdout and stderr. Now every output is redirected to the file (maybe because stdout and stderr are treated the same way(?)) |
Example of crash-report generated on windows. |
Useful suggestions/enhancements:
|
The output of GIN debug was redirected to stderr instead of stdout
Please check if the PR fulfills these requirements
before creating one)
feature
Sometimes the agent crashes without apparent reason
A file containing a crash-report is generated in that same folder containing the executable (e.g. in Linux it's in
~/ArduinoCreateAgent-<version>/
) when the agent crashes. It should allow users to better report issues, and developers to better understand and fix bugs.The file is named
crashreport_yyyyMMddHHmmss.txt
and should contain something like:no