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

signal SIGBUS: hardware error #16375

Open
BarrOff opened this issue Dec 16, 2020 · 9 comments
Open

signal SIGBUS: hardware error #16375

BarrOff opened this issue Dec 16, 2020 · 9 comments

Comments

@BarrOff
Copy link
Contributor

BarrOff commented Dec 16, 2020

I use Nim to implement a small game, the code and compilation instructions can be found here.

The game can be compiled with nim versions 1.0.x without issues and the game works (as far as currently implemented).

To compile using nim > 1.0 this patch has to be applied when compiling nim, because of this issue.
Using those versions, the game reproducibly crashes, whereas it works for Nim 1.0.x

Using the lldb debugger I could see that the game crashes when calling alloc0, producing the title message.

Example

For code and installation instructions, see here.

How to reproduce

When starting the game there is first a little info screen.
Simply pressing any button leads to the starting screen.
Pressing any button again should start the first level, but crashes.

Current Output

signal SIGBUS: hardware error

Additional Information

compiler versions tested: 1.0.10, 1.0.11, 1.2.6, 1.4.2, devel
operating systems: Windows 10, Linux, FreeBSD
c-compilers: gcc-10.2.0, gcc-9.3.0, gcc-8.3.0, clang-10.0.1, clang-11.0.0

@timotheecour
Copy link
Member

please minimize, see also this thread #16365 (comment)

@BarrOff
Copy link
Contributor Author

BarrOff commented Dec 17, 2020

@timotheecour sorry, but I can't determine what causes it. As it is part of a whole game, with many pieces interconnected, creating a minimal example is not really possible.

@timotheecour
Copy link
Member

timotheecour commented Dec 17, 2020

creating a minimal example is not really possible

of course it is, we all do it. Sometimes it takes a bit of effort and debugging to figure out how to reduce while preserving the bug. There are 2 dimensions:

  • spatial: reduce your code
  • temporal: git bisect on nim to figure out which commit in nim broke your code

@BarrOff
Copy link
Contributor Author

BarrOff commented Dec 18, 2020

Just did the git bisection, and found the commit 4005f0d to be the reason for this error.
Will take a look at what exactly is causes it tomorrow.

@timotheecour
Copy link
Member

great!

Using the lldb debugger I could see that the game crashes when calling alloc0, producing the title message.

can you also report a stacktrace? (eg bt in lldb), both pointing to nim sources and, if useful, to cgen sources
(IIRC --lineTrace:on or --lineDir:on would enable showing cgen sources instead of nim sources in stacktrace, in combination with --stacktrace:on --debugger:native)

@timotheecour
Copy link
Member

it's always possible to reduce. I've just done this for #14340 (comment)

please do it for this issue :)

@BarrOff
Copy link
Contributor Author

BarrOff commented Dec 18, 2020

Here is a stacktrace: https://gist.github.com/BarrOff/568a08d66eb792206ae2ef1af2cec360
DId this on Linux, there it creates a SIGSEGV. On FreeBSD it was allways SIGBUS, but at the exactly same place. I suppose differences in memory allocating are the reason for this.
Nevertheless, I will try to reduce it.

@BarrOff
Copy link
Contributor Author

BarrOff commented Dec 29, 2020

@timotheecour
I'm really sorry, but I can't seem to create a reduced model. Simply calling alloc0 fails, but I can't find what causes it.

@BarrOff
Copy link
Contributor Author

BarrOff commented Dec 29, 2020

Some fiddling around with the commit 4005f0d that causes the error, I can confirm the error must be related to the changes in lib/system/alloc.nim. Only reverting this file and the error disappears.

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

No branches or pull requests

3 participants