Page 1 of 1

BrutalDoom crashes at (seemingly) random points on GZDoom

PostPosted: Tue May 21, 2019 7:53 am
by Christsnatcher
Hello guys,

I first posted about the issues I experience in the Brutal Doom topic on mod.db (https://www.moddb.com/mods/brutal-doom), but was advised to use the GZDoom forums, so here I am (https://i.gyazo.com/a67a1ef059072ac0229 ... 55dadc.png). The embedded link in my original post shows the actual error message: https://i.gyazo.com/02e85a239f353bf01f2 ... 6e73f0.jpg

This happens on all GZDoom builds from 3.7.2 if I'm not mistaken, both in x64 and x86 mode (yes, I was wrong about that in my mod.db post) and with all BrutalDoom builds up from RC7. The crashes are, as mentioned in the title, just seemingly random, as some of them (like the one I described) are 100% reproducible, e.g. picking up the single armor item in the little bathroom in Extermination Day when playing with BrutalDoom on GZDoom.

Many thanks in advance for looking into "my" issue, if you need any kind of additional data, just tell me.

Cheers!

Re: BrutalDoom crashes at (seemingly) random points on GZDoo

PostPosted: Tue May 21, 2019 8:09 am
by _mental_
Please describe how to reproduce this reliably. We need exact steps to be able to investigate this.

Re: BrutalDoom crashes at (seemingly) random points on GZDoo

PostPosted: Tue May 21, 2019 11:35 am
by Matt
Here's line 457 of the current GZDoom master inventory.zs, last updated March 3-4.

I'm guessing TryPickup is somehow being called with a null toucher defined, or the toucher being referred to is destroyed just before that call, but if that had been the case I would expect to see at least one reference to some ZS in BD itself.

picking up the single armor item in the little bathroom in Extermination Day when playing with BrutalDoom on GZDoom.
Would you be able to link to the exact files that you were using?

Re: BrutalDoom crashes at (seemingly) random points on GZDoo

PostPosted: Tue May 21, 2019 5:38 pm
by Christsnatcher
Hello,

thank you very much for looking into the issue I'm experiencing. Ok, I've zipped my basic GZDoom setup (gzdoom-bin-4-1-2b-x64 + audiopack v3 + BrutalDoom v21 Release build) and uploaded it to MEGA for you to check:

https://mega.nz/#!cNIF0YwA!XbmY4wkUMvNf ... rnbETVhDJM

I did not include DOOM.WAD due to obvious copyright issues, but I'm using the official "The Ultimate DOOM v1.9" .wad. I also added a basic launcher.bat solely for testing purposes as I usually run all source ports with mods via ZDL v3.2.2.3 beta.

To reproduce an exemplary crash the easiest way just run the .bat, choose E4 and "Hurt me plenty". When ingame, select the grenades and grab the shotgun right before you to make the troopers spawn. Now step back and throw a few grenades, you can be sure that the game will crash on a certain explosion, showing me the attached error messages.

If this doesn't help you and you need to investigate further, I'll try to 100% reproduce the Extermination Day armor item pickup crashing event and send you the data.

Cheers,

Christsnatcher

Re: BrutalDoom crashes at (seemingly) random points on GZDoo

PostPosted: Wed May 22, 2019 7:00 am
by _mental_
DLevelScript::activator (that has TObjPtr<AActor*> type) does not invoke GC read barrier when it's passed to ellipsis function like ScriptUtil::Exec().
The problem was introduced with this commit with removal of internal GiveInventory() function.
Nulls are no longer assigned to condemned objects, and pointer to such destroyed actors may be passed to script functions.
Sooner or later, a read barrier will be triggered. The exact location where VM abort exception will be thrown depends on particular code path.

Here is how I propose to fix it.

Alternatively, we can cast activator to AActor* when needed to insert read barriers implicitly.
This will reduce the number of changed lines, but will make things not so obvious as well.

Re: BrutalDoom crashes at (seemingly) random points on GZDoo

PostPosted: Wed May 22, 2019 7:48 am
by Graf Zahl
In that case a different solution is needed. The TObjPtr should never be passed to a vararg function at all, the pointer must be extracted beforehand.
And for most other places this change is totally unnecessary.

Re: BrutalDoom crashes at (seemingly) random points on GZDoo

PostPosted: Wed May 22, 2019 7:57 am
by _mental_
OK, it's the alternative solution I mentioned, with explicit cast for TObjPtr<> instances. There is no designated member function (which is not overloaded operator) to extract a pointer.

Re: BrutalDoom crashes at (seemingly) random points on GZDoo

PostPosted: Wed May 22, 2019 8:01 am
by Graf Zahl
Then such a function should be added.

Re: BrutalDoom crashes at (seemingly) random points on GZDoo

PostPosted: Wed May 22, 2019 8:47 am
by _mental_

Re: BrutalDoom crashes at (seemingly) random points on GZDoo

PostPosted: Thu May 23, 2019 4:52 pm
by Christsnatcher
Thank you very much guys, awesome support!!!