cb-hackers / cbEnchanted

A new runtime for CoolBasic
13 stars 3 forks source link

Sometimes crashes on macOS #169

Open valscion opened 7 years ago

valscion commented 7 years ago

It might start with no task bar at all, and garbled contents

screen shot 2017-08-06 at 23 22 03

Or then it only contains a black window and does not respond to ESC

screen shot 2017-08-06 at 23 23 20

Or then it crashes on start:

https://gist.github.com/valscion/1d270e9a0b0fef0c0f3b22d4123c2e93

valscion commented 7 years ago

Ok, I got a hang now. With HCDEBUG log level, it turns out that the hang came with SCREEN command, op-code 481

INFO: Initialized
4
HCDEBUG: [1]: OpCode: 73
HCDEBUG: [1] Push Int 0
HCDEBUG: [6]: OpCode: 73
HCDEBUG: [6] Push Int 0
HCDEBUG: [11]: OpCode: 73
HCDEBUG: [11] Push Int 0
HCDEBUG: [16]: OpCode: 73
HCDEBUG: [16] Push Int 0
HCDEBUG: [21]: OpCode: 73
HCDEBUG: [21] Push Int 0
HCDEBUG: [26]: OpCode: 67
HCDEBUG: Command: 98
HCDEBUG: [31]: OpCode: 73
HCDEBUG: [31] Push Int 0
HCDEBUG: [36]: OpCode: 73
HCDEBUG: [36] Push Int 0
HCDEBUG: [41]: OpCode: 73
HCDEBUG: [41] Push Int 0
HCDEBUG: [46]: OpCode: 73
HCDEBUG: [46] Push Int 0
HCDEBUG: [51]: OpCode: 73
HCDEBUG: [51] Push Int 0
HCDEBUG: [56]: OpCode: 67
HCDEBUG: Command: 97
HCDEBUG: [61]: OpCode: 73
HCDEBUG: [61] Push Int 7
HCDEBUG: [66]: OpCode: 73
HCDEBUG: [66] Push Int 1
HCDEBUG: [71]: OpCode: 73
HCDEBUG: [71] Push Int 0
HCDEBUG: [76]: OpCode: 73
HCDEBUG: [76] Push Int 0
HCDEBUG: [81]: OpCode: 73
HCDEBUG: [81] Push Int 0
HCDEBUG: [86]: OpCode: 73
HCDEBUG: [86] Push Int 0
HCDEBUG: [91]: OpCode: 67
HCDEBUG: Command: 99
HCDEBUG: [96]: OpCode: 73
HCDEBUG: [96] Push Int 600
HCDEBUG: [101]: OpCode: 73
HCDEBUG: [101] Push Int 600
HCDEBUG: [106]: OpCode: 73
HCDEBUG: [106] Push Int 0
HCDEBUG: [111]: OpCode: 73
HCDEBUG: [111] Push Int 1
HCDEBUG: [116]: OpCode: 67
HCDEBUG: Command: 481
valscion commented 7 years ago

And now I got the case with no task bar, however the contents were all black this time. Maybe it's some sort of random memory that gets printed to the screen...

screen shot 2017-08-07 at 10 25 39

I added extensive logging to bisect what part hangs, and it's likely to be al_create_display in gfxinterface.cpp. These lines are the ones that hang:

window = al_create_display(400, 300);
windowMode = WindowMode::Windowed;
defaultWidth = 400;
defaultHeight = 300;
newWidth = defaultWidth;
newHeight = defaultHeight;
defaultAspectRatio = (float)defaultWidth / (float)defaultHeight;
valscion commented 7 years ago

Now I got a hang with SCREEN command. It seems to get stuck in an infinite loop. Here's a sample of the hanged process: https://gist.githubusercontent.com/valscion/1d270e9a0b0fef0c0f3b22d4123c2e93/raw/b9cf4fb552ab4c239e3d94b78c6c32b84c8cf023/4.3-sample.log

screen shot 2017-08-07 at 10 27 57

It got stuck on line al_resize_display(window, width, height); here: https://github.com/cb-hackers/cbEnchanted/blob/c45d3a6/src/gfxinterface.cpp#L159

valscion commented 7 years ago

Stuck again on SCREEN, same as the one above.

https://gist.github.com/valscion/c22cebbcb8c99dcceae1f0f740cc4f4a

valscion commented 7 years ago

Ok, now I got my ENTIRE MACBOOK to freeze (even the mouse didn't move) and had to do a hard shutdown. The malfunctioning code is the window = al_create_display(400, 300); done during GFX initialization phase.

These could be about some memory trying to be rendered to the screen or something... I don't see why the entire macbook would hang otherwise :scream:

HCDEBUG: [1702] 67
HCDEBUG: [1707] 67
HCDEBUG: [1712] 73
HCDEBUG: [1717] 67
INFO: Preparsing ready
INFO: Event queue created
INFO: [GFX]: 1
INFO: [GFX]: 2
INFO: [GFX]: 3
(and the entire macbook freezed at this point)
valscion commented 7 years ago

Wehee, kernel panic!

https://gist.github.com/valscion/62a6d85786c1272d97a16c14d1e8f70d