• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Game unpredictably crashes with no error between two events

Anixias

Member
Hi, all.

I'm making a game in GMS2.3 (IDE v2.3.1.536, Runtime v2.3.1.406).
The crash occurs with both VM (in normal mode and using the Debugger) and YYC.
I don't recall this issue happening until I updated from 2.3 to 2.3.1, and it seems to be of no fault of my code.

The basics are like this:
I have a whole lot of stuff going on all over the place. A window system that calls embedded functions on its elements, nested surface rendering, etc. etc.
This crash is very very unpredictable. 75% of the time, it doesn't crash. The other 25%, it freezes the game for about 2 seconds, then crashes.
It only occurs after you choose a character, it loads the maps, and pops open the map selection window. However, it doesn't usually crash immediately. It can take anywhere from 0 ~ 2 seconds before it freezes, then closes.
Here is my relevant output log:
Code:
    GameManager::BeginStep -- begin
        GameManager::BeginStep::input::process -- begin
        GameManager::BeginStep::input::process -- end
        GameManager::BeginStep::state::process -- begin
        GameManager::BeginStep::state::process -- end
        GameManager::BeginStep::__GLOBAL::windows[0]::process -- begin
        GameManager::BeginStep::__GLOBAL::windows[0]::process -- end
    GameManager::BeginStep -- end
    GameManager::Step -- begin
    GameManager::Step -- end
    GameManager::PreDraw -- begin
    GameManager::PreDraw -- end
    GameManager::DrawGUI -- begin
    GameManager::DrawGUI -- end
    GameManager::DrawGUIEnd -- begin
    GameManager::DrawGUIEnd -- end
    GameManager::BeginStep -- begin
        GameManager::BeginStep::input::process -- begin
        GameManager::BeginStep::input::process -- end
        GameManager::BeginStep::state::process -- begin
        GameManager::BeginStep::state::process -- end
        GameManager::BeginStep::__GLOBAL::windows[0]::process -- begin
        GameManager::BeginStep::__GLOBAL::windows[0]::process -- end
    GameManager::BeginStep -- end
    GameManager::Step -- begin
    GameManager::Step -- end
    GameManager::PreDraw -- begin
    GameManager::PreDraw -- end
    GameManager::DrawGUI -- begin
    GameManager::DrawGUI -- end
    GameManager::DrawGUIEnd -- begin
    GameManager::DrawGUIEnd -- end
    GameManager::BeginStep -- begin
        GameManager::BeginStep::input::process -- begin
        GameManager::BeginStep::input::process -- end
        GameManager::BeginStep::state::process -- begin
        GameManager::BeginStep::state::process -- end
        GameManager::BeginStep::__GLOBAL::windows[0]::process -- begin
        GameManager::BeginStep::__GLOBAL::windows[0]::process -- end
    GameManager::BeginStep -- end
    GameManager::Step -- begin
    GameManager::Step -- end
    GameManager::PreDraw -- begin
    GameManager::PreDraw -- end
    GameManager::DrawGUI -- begin
    GameManager::DrawGUI -- end
    GameManager::DrawGUIEnd -- begin
    GameManager::DrawGUIEnd -- end


Y:\textbased_rpg_41D95E3A_YYC\textbased_rpg.exe exited with non-zero status (-1073741819)
elapsed time 00:01:33.1102722s for command "C:\ProgramData/GameMakerStudio2/Cache/runtimes\runtime-2.3.1.406/bin/Igor.exe" -j=128 -options="C:\Users\Anixias\AppData\Local\GameMakerStudio2\GMS2TEMP\build.bff" -q -- Windows Run started at 12/10/2020 14:57:23
"cmd"  /c subst Z: /d

elapsed time 00:00:00.0429309s for command "cmd" /c subst Z: /d started at 12/10/2020 14:58:56
"cmd"  /c subst Y: /d

elapsed time 00:00:00.0449285s for command "cmd" /c subst Y: /d started at 12/10/2020 14:58:56
"cmd"  /c subst X: /d

elapsed time 00:00:00.0424329s for command "cmd" /c subst X: /d started at 12/10/2020 14:58:56
FAILED: Run Program Complete
For the details of why this build failed, please review the whole log above and also see your Compile Errors window.
I include my debug messages for the last few full steps before the crash. There seems to be no way to reproduce this reliably. Sometimes it crashes, sometimes it doesn't. I can crash, then immediately run the game again and not crash, following the exact same menu steps.

There are no errors in the output log from the build step.
There is literally no code between "GameManager:: DrawGUIEnd -- end" and "GameManager::BeginStep -- begin". It goes straight from that one debug message to the next, verified by running the debugger line by line. It just closes with no error. The unhandled exception function doesn't catch it.

Things I've tried:
- Cleaning the cache about a million times
- Deleting and reinstalling the runtime
- Commenting out the unhandled exception script
- Adding a billion debug messages everywhere to pinpoint the crash (and as such, I discovered it's crashing between two events, with none of my code running before it closes)
- Checking memory usage (max is 37 MB)
- Running with gml_release_mode(true); and false
- VM, YYC, Debugger, release configuration, Default configuration
- Running through the map loader line-by-line (before I found out it's crashing between the Draw GUI End and Begin Step events)

Notes:
I have one manager object, obj_game_manager, that manages everything in the game. There are no objects that run their own code external to the influence of this manager object. Nothing is running Draw Gui End or Begin Step code except this object, so there is literally nothing happening between those two events, where it crashes.
 
Last edited:

O.Stogden

Member
I'm also getting a crash when I open the lobby on my game. Like you, it crashes only periodically, always within 2 seconds of entering the lobby. If it didn't crash, I can exit and re-enter the room as many times as I want and it will never crash again. Then on reboot of the game, it's a coin flip as to whether it will work.

I have been developing the game for over 2 years, and I didn't get the crash in GMS 1.4 or GMS 2.2.5. I can't say whether it started in 2.3.0 or 2.3.1, but I want to say 2.3.1.

The game loads a fairly large map upon entering the lobby, about 15000x15000, and it loads a text file with level data, it loads the level fine as I can see it before the game crashes, sometimes even get a chance to click a button before it closes too. I'm not sure of any alarmed objects that might cause a crash, regardless of that, it didn't crash in 2.2.5.

Probably isn't shedding anymore light on the situation, just wanted to say that I'm having a similar problem that recently appeared.

Debugger graph and Windows Task Manager both show no spike in memory usage, which is what I've previously experienced when the game crashes with no warning or error. The memory usage never exceeds 125MB.
 
Last edited:

Anixias

Member
Everything you said is exactly applicable to my issue! If it doesn't crash, I can cancel the map select and go back to it over and over without it crashing, and can sometimes manage to click through the crash and start playing the game for a brief moment before it finally closes.
My Debugger also has no memory spike right before the crash.
 

O.Stogden

Member
I'm not sure if the error code is helpful or not, as it is identical on mine. (-1073741819)

Here's my log, without any detailed debug messages like yours:

Code:
**********************************.
Entering main loop.
**********************************.
Audio group 2 -> Loaded
Resizing swap chain...
Received stats and achievements from Steam
Battle Arena Template.blvl
test.wiplvl
PLAYERS: 0
AI: 8
GHOSTS: 0
Audio group 1 -> Loaded
WE'VE BEEN CLICKED 4
LOADING MAP
PLAYERS: 0
AI: 0
GHOSTS: 0


X://windows/Runner.exe exited with non-zero status (-1073741819)
elapsed time 00:00:15.2588741s for command "C:\ProgramData/GameMakerStudio2/Cache/runtimes\runtime-2.3.1.406/bin/Igor.exe" -j=8 -options="C:\Users\Oliver Stogden\AppData\Local\GameMakerStudio2\GMS2TEMP\build.bff" -v -- Windows Run started at 12/10/2020 22:15:15
"cmd"  /c subst Z: /d

elapsed time 00:00:00.0455095s for command "cmd" /c subst Z: /d started at 12/10/2020 22:15:31
"cmd"  /c subst Y: /d

elapsed time 00:00:00.0370061s for command "cmd" /c subst Y: /d started at 12/10/2020 22:15:31
"cmd"  /c subst X: /d

elapsed time 00:00:00.0340045s for command "cmd" /c subst X: /d started at 12/10/2020 22:15:31
FAILED: Run Program Complete

Seems like it might need reporting to YYG, although I don't know how to replicate it in a simple project, mine is a full-fledged game that's got hundreds of objects and tens of thousands of lines of code to go through. They'd need an example project that does it.
 

Anixias

Member
If I knew how to reproduce the error reliably, I'd report it. I just can't figure out what the context is for the crash.
 

O.Stogden

Member
I hid the view that serves as the "map preview" as it used compatibility scripts (view_set) so I thought it might cause issues, but it still can crash with the view invisible and all view codes commented out.

I'll mess around and see if I can get the crashing to stop, might narrow it down.

Does your game create a large amount of objects or anything just before the crash? Mine right now is making about 500 objects in the level preview, which is the main thing I could think of that might cause an issue.
 

Anixias

Member
My game is almost entirely built on structs, it's a simple text-based game with some UI elements.
Right before the crash, maps are loaded from your worlds. These are each roughly 60KB. In my case, it doesn't matter how many or how few maps there are, it will crash on any number. But, as mentioned previously, it only sometimes crashes.
 

O.Stogden

Member
It seems likely this is an issue from loading text files then.

My files vary in range from 30-170KB.

The file it loads upon lobby entry is 158KB.

Stopping the lobby loading a file appears to have stopped the crashing...

EDIT: What event do you load your text files in? My object that loads text files has "alarm[0]=1" in the create event when the room starts, so it loads the text file in the alarm 0 event, 1 step into the room being created. I changed it to 10 steps incase the game needed some breathing room, but it still crashed. Possible it's related to loading files from an alarm event maybe?
 
Last edited:

FrostyCat

Redemption Seeker
There are still reports of the garbage collector causing crashes in GMS 2.3.1. As a diagnostic measure, try turning it off with gc_enable(false);, and if it stops crashing that way, turn it back on again and print out gc_get_stats() to look for patterns leading up to the crash.
 

O.Stogden

Member
There are still reports of the garbage collector causing crashes in GMS 2.3.1. As a diagnostic measure, try turning it off with gc_enable(false);, and if it stops crashing that way, turn it back on again and print out gc_get_stats() to look for patterns leading up to the crash.
Thanks Frosty, it seems likely this is the case.

I ran it about 8 times with it disabled and haven't had a crash yet. And the 1-2 second delay would fit in with how long the GC usually takes to clear up garbage after a big change (such as a room change).

I'll see if I can get more info on what the GC is doing.

EDIT: GC log for the last 5 steps before a crash:

Code:
Traversal time = 0
Collection time = 0
Objects Touched = 0
Objects Collected = 0
GC_Frame = 127
Gen Collected = 1
Num Of Gen = 5
Objects in Gen = [ 3027,0,707,0,2864 ]
Traversal time = 0
Collection time = 0
Objects Touched = 0
Objects Collected = 0
GC_Frame = 127
Gen Collected = 1
Num Of Gen = 5
Objects in Gen = [ 3029,0,707,0,2864 ]
Traversal time = 0
Collection time = 0
Objects Touched = 0
Objects Collected = 0
GC_Frame = 127
Gen Collected = 1
Num Of Gen = 5
Objects in Gen = [ 3031,0,707,0,2864 ]
Traversal time = 0
Collection time = 0
Objects Touched = 0
Objects Collected = 0
GC_Frame = 127
Gen Collected = 1
Num Of Gen = 5
Objects in Gen = [ 3033,0,707,0,2864 ]
Traversal time = 0
Collection time = 0
Objects Touched = 0
Objects Collected = 0
GC_Frame = 127
Gen Collected = 1
Num Of Gen = 5
Objects in Gen = [ 3035,0,707,0,2864 ]
 
Last edited:

Anixias

Member
Yep, that seems to be the issue for me as well. I haven't encountered the crash yet after disabling the garbage collector.
 
C

Carotaa

Guest
I got the similar problem recently too, with the same return code: non-zero status (-1073741819)

But I have found than these code will cause the crash:

GML:
// set layer drawing surfaces
var _l = ds_list_size(_de_layer_list);
for(var i=0; i<_l; i++)
{
    var temp = _de_layer_list[|i];
    
    layer_script_begin(temp, test);
    layer_script_end(temp, test);
}

function test(){ 
       // do nothing
}
It's in a Room Start Event and It will crash, when I repeatedly call room_goto_next() function about 13 times.

If just call that function less than 13 times, very thing will be fine.
 
I got the similar problem recently too, with the same return code: non-zero status (-1073741819)

But I have found than these code will cause the crash:

GML:
// set layer drawing surfaces
var _l = ds_list_size(_de_layer_list);
for(var i=0; i<_l; i++)
{
    var temp = _de_layer_list[|i];
   
    layer_script_begin(temp, test);
    layer_script_end(temp, test);
}

function test(){
       // do nothing
}
It's in a Room Start Event and It will crash, when I repeatedly call room_goto_next() function about 13 times.

If just call that function less than 13 times, very thing will be fine.
Thanks so much for commenting this. I have a pretty large game and I've been looking for why everything just shuts down with no error codes for a lot of people. There is definitely something wrong with the layer_script code during the room_change events.
 
i would like to say this glitch / error is still prevelent in the newest versions of gamemaker im running on mac os silicon , and disabling the garbage collector did infact work.
 
Top