Skip to content

Crashes without stack trace #1357

@lazysegtree

Description

@lazysegtree

Like #1353 , sometimes superfile can crash without printing a stack trace.

FYI, most crash I saw so far had a stack trace. Example #542

One way to reproduce it is via doing out of range access on slice from a tea.Cmd goroutine. For example, by returning the below value in Update().

func() tea.Msg {
			s := []int{}
			s[100] = 9
			return nil
		},

I could see no stack trace in Iterm2, but I could see it in Ghostty(that too, only sometimes)

Image Image

bubbletea has recoverFromPanic and recoverFromGoPanic where they call debug.PrintStack(), but I guess that sometimes, the output to stderr is lost as bubbletea is still controlling the terminal.

Path forward.

  • Give users option of --custom-recover. There we will configure our tea.Program with tea.WithoutCatchPanics(), and catch panics from p.Run() ourselves. We would also need to take care of restoring terminal via p.Kill/p.Quit/p.RestoreTerminal. Maybe we should keep it as the default way superfile works, till we can ensure that all panics will show stack trace on all terminals. After all panics might be rare and might not be reproducible.
  • Create a minimal reproducible example, understand and study about the terminal cleanup of bubbletea, and try to pinpoint issues ourself. Open an issue with bubble tea for further help if needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdifficulty:hardfor devsFeatures/Fixes that will help the developersrequire expertiseIssues that needs and expertise in superfile's codebase and/or golang to be able to fix effectively.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions