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

Segmentation fault shortly after yielding from a debug hook #360

Open
viluon opened this issue Jul 8, 2024 · 0 comments
Open

Segmentation fault shortly after yielding from a debug hook #360

viluon opened this issue Jul 8, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@viluon
Copy link

viluon commented Jul 8, 2024

Description

The emulator crashes while running crash.lua − a suite of automated tests with coverage tracking.

Reproduction steps

Steps to reproduce the behavior:

  1. Run craftos (PUC Lua flavour)
  2. Launch crash.lua --coverage=only-enabled. Don't forget to pass this argument, or edit crash.lua to set the appropriate flags by default.
  3. If the emulator did not crash, quit it and repeat from step 1. Sometimes a pause of 0-2 seconds after step 1 can help.

Expected behaviour

The emulator does not crash.

Screenshots and traces

Screenshots

image

image

image

image

image

Coredumps

This core dump was captured from a headless instance of CraftOS-PC running in GitHub Actions CI (Ubuntu 22).

Debugging with rr

You can use rr to precisely replay a crash and debug it consistently without having to reproduce it yourself.

First, install rr and optionally set up debuginfod, I recommend nixseparatedebuginfod for NixOS. Next, download the rr trace1 and decompress it to ~/.local/share/rr/. Checkout CraftOS-PC at version v2.8.2 and navigate to craftos2-lua/src/.

Finally, run rr replay ~/.local/share/rr/craftos-29 and debug away.

The trace has been rr packed so it should work on any sufficiently young x64 system. The closer you get to the following, the more likely it is to work without issues:
image

Environment

  • OS: NixOS 24.05, Ubuntu 22.04
  • CraftOS-PC Version: v2.8.2 from nixpkgs, v2.8.2 from @MCJack123's PPA
  • Compiled from source? See above

Additional context

  • This crash seems to be nondeterministic.
  • In instances where CraftOS-PC doesn't segfault when running the program as explained above, the program (which should behave as a deterministic unit test runner) displays different behaviour to being run without tracing. Some unit tests fail with tracing and pass without. Take this with a grain of salt, as it's a complicated piece of code, and I didn't investigate this in-depth.

Footnotes

  1. Unfortunately, the recording is 60+ MB, even with 7z compression. GitHub puts a 25 MB limit on file uploads. Feel free to ping me if the link expires.

@viluon viluon added the bug Something isn't working label Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant