[SOLVED] Need help: Runner.exe exited with non-zero status (-1073741819) crash when reading a large string from a file

Tuna

Member
Hello everyone. I am not the most knowledgeable person when it comes to GML, but I can usually get around my issues and make things work. This has not been the case while dealing with this problem. I have been googling and trying different solutions for a couple days now.

My "game" is a simple one that is just for reading one or more HTML files, creating a folder for each, and extracting all of its images to its respective folder. I have been unable to get past reading the HTML files and making their folders because I am running into an issue when reading some of them. Not all of the files cause this issue, but it seems to be the ones where at least one of the base64 lines for an image are exceptionally long. I am adding each line of an individual file to a temporary list in order of the lines. If I restart the program and load a problem file again, it crashes when reading the same line it did the time before. The problem lines are usually around 150,000 characters. Could this be causing a crash in itself? If so is there a good way to read such a large string? I don't believe a memory leak is happening because I am clearing/destroying a list after using it, and I have watched on my resource manager and not seen spikes of any sort when a crash happens.

I am using an extension from the marketplace called Unboxed filesystem by kagamma to have access to files outside of the sandbox. I am doing this on GMS2 v2.3.0.529 Runtime v2.3.0.401 on Windows 10.

Here is the output. The compile errors window never has anything to say when this happens.

Code:
**********************************.
Entering main loop.
**********************************.
>Dialogue initiated.
>File(s) loaded.
[FUNC] string_splitter_files
 >Putting filenames into list
[ENDFUNC] string_splitter_files
>Destination folder loaded.
[FUNC] iterate_files
    [FUNC] read_html
     >Reading C:\Users\nigr3\Desktop\broken-picture-phone-recovery-master\bpp\bpp-1592622831089.html into list...
      >Reading line 1
      >Reading line 2
      >Reading line 3
      >Reading line 4
      >Reading line 5
      >Reading line 6
      >Reading line 7
      >Reading line 8
      >Reading line 9
      >Reading line 10
      >Reading line 11
      >Reading line 12
      >Reading line 13
      >Reading line 14
      >Reading line 15
      >Reading line 16
      >Reading line 17
      >Reading line 18
      >Reading line 19
      >Reading line 20
      >Reading line 21
      >Reading line 22
      >Reading line 23
      >Reading line 24
      >Reading line 25
      >Reading line 26


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

elapsed time 00:00:00.0581519s for command "cmd" /c subst Z: /d started at 11/22/2020 23:12:41
"cmd"  /c subst Y: /d

elapsed time 00:00:00.0587835s for command "cmd" /c subst Y: /d started at 11/22/2020 23:12:41
"cmd"  /c subst X: /d

elapsed time 00:00:00.0582920s for command "cmd" /c subst X: /d started at 11/22/2020 23:12:41
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.
and finally, here is the script that reads each line into the list, the last script that is doing anything before a crash.

GML:
function read_html(file){
show_debug_message("    [FUNC] read_html");
show_debug_message("     >Reading "+argument[0]+" into list...");

var thefile = argument[0];
var str = "";
var num = 0;
var line = 0;
var thelist = ds_list_create();
var read = file_text_open_read_ue(thefile);

while (!file_text_eof_ue(read))
   {
   show_debug_message("      >Reading line "+string(line+1));
   ds_list_insert(thelist,line,file_text_readln_ue(read));
   line++;
   }

file_text_close_ue(read);
show_debug_message("    [ENDFUNC] read_html");
return thelist;
}
If there is any other information I can give, I would be happy to. This is driving me crazy. I would appreciate any help very much.
 

Yal

🐧 *penguin noises*
GMC Elder
"Runner exited with non-zero status" literally means any error in existence could have happened (zero status means that the program terminated gracefully, nonzero status means it crashed or reported failure).

My educated guess is that there's a memory error of some sort (150k characters is a pretty long string), perhaps the function that base64-decodes a string allocates 10000 bytes because "that will definitely be enough" but then the 150,000 read causes a buffer overflow.

I looked up the return code you're getting, the least significant byte (where the actual error code is) is -251 = 5 which means "I/O error", so I'd guess the file read itself fails because the line is too long.
 

Yal

🐧 *penguin noises*
GMC Elder
Write a catch-try. You're almost certainly exceeding the string-buffer limit though, yeah.
catch (and custom uncaught exception handlers) doesn't work on OS-level issues, and "out of memory" is the most common OS-level issue you can run into... not sure if this'd help.
 

Tuna

Member
catch (and custom uncaught exception handlers) doesn't work on OS-level issues, and "out of memory" is the most common OS-level issue you can run into... not sure if this'd help.
Write a catch-try. You're almost certainly exceeding the string-buffer limit though, yeah.
Thanks for the responses. I will look into what a catch-try is even if it might not work because it sounds useful to know either way. I'm guessing by the lack of suggestions that there might not be a simple workaround to such a long string? Perhaps Gamemaker just isnt a viable way to make a large(150k char lines) file extractor? Anyway I appreciate the help and I'm glad at least my suspicion of the long string is confirmed.
 
Last edited:

Tuna

Member
I believe I solved my issue. Not sure why this fixed it though. I was looking around in the Windows Game Options, and I noticed the "Disable file system sandbox" option. Kind of defeats the purpose of the extension I'm using. Didnt realize that was an option. So I turned that on and changed my extension functions to normal GM file reading functions. Now it seems to be working fine. Hallelujah. Thanks again, everyone. Marking thread as solved.
 
Top