TemplePlus icon indicating copy to clipboard operation
TemplePlus copied to clipboard

Seemingly random crash

Open dolio opened this issue 4 years ago • 13 comments

I got a game crash shortly after fighting a bunch of air bugbears. I'll attach the log and dump file.

I don't have much of a clue as to what caused it. I was just walking the party back to the stairs at the time. I guess maybe it's the bad particle ID mentioned in the log? TemplePlus.log 4686c1e2-da92-4435-844b-a1e45665a55a.zip

I think I was running the most recent build from the countersong PR.

dolio avatar Sep 06 '21 05:09 dolio

It says you were running pre-3039, which is Sagenlicht's PR build... you should probably stick to master, not sure that was up to date (but I don't know if that's the root cause).

Unfortunately for some reason I can't load the debug symbols so it's hard to tell where and why it crashed, but it seems to be in SpellSoundPlay for the Bear's Endurance spell removal. Do you have a savegame that demonstrates it?

DudeMcDude avatar Sep 07 '21 06:09 DudeMcDude

I don't. A second time doing stuff on that floor didn't cause it to happen, either. If I get something similar to happen again, I'll try to get a relevant save.

dolio avatar Sep 07 '21 17:09 dolio

The worst kind of bug - the one you know users will quickly find on release :P

DudeMcDude avatar Sep 07 '21 20:09 DudeMcDude

I did get another crash that might be related. It was shortly after loading, so I tried reproducing it but couldn't. The crash happened when casting web on a dozen guys in the temple back door fight (which of course plays a lot of overlapping sounds, although the crash seemed to occur before any sound). I could upload a save, but I imagine it wouldn't be very useful.

The behavior seems like some kind of race condition, I guess probably in the sound system given what you mentioned before.

dolio avatar Sep 12 '21 21:09 dolio

Well it may or may not be related... Do you have a dump+log?

DudeMcDude avatar Sep 13 '21 02:09 DudeMcDude

Here

Unfortunately I didn't have the full memory dump setting turned on yet.

dolio avatar Sep 13 '21 14:09 dolio

It's crashing while trying to print the spell target list actually (during GetInt32() for someone's obj_f_description field). So it looks like a corrupt object issue. Interesting...

Also I found an issue with the spell Silence - used target.obj instead of target_item.obj. Probably unrelated though.

DudeMcDude avatar Sep 14 '21 03:09 DudeMcDude

Also probably unrelated, but you have an error in action 1702:

[2021-09-12 16:34:31.783] [core] [error] An error occurred while calling event GetActionCostType for script action01702_full_meteor.py. [2021-09-12 16:34:31.783] [core] [info] Python: Traceback (most recent call last): [2021-09-12 16:34:31.783] [core] [info] Python: File "rules/d20_actions/action01702_full_meteor.py", line 15, in GetActionCostType [2021-09-12 16:34:31.784] [core] [info] Python: NameError [2021-09-12 16:34:31.784] [core] [info] Python: : [2021-09-12 16:34:31.784] [core] [info] Python: global name 'D20ACT_Free_Action' is not defined

That's your Melf's Minute Meteors mod I think?

DudeMcDude avatar Sep 14 '21 03:09 DudeMcDude

Yeah. I haven't gotten around to finishing that up. It wouldn't be causing random errors, would it?

dolio avatar Sep 14 '21 04:09 dolio

No, it doesn't seem likely. The curious thing here is that it must have gone through all the objects in the target list when the engine built it, so presumably they were ok up to that point. Might help pin down the source of error...

DudeMcDude avatar Sep 14 '21 04:09 DudeMcDude

I cannot load this crash dump hmm.... Probably something related to wine.

Can you do a winedbg <crashdumpfile>.dmp and then just type bt on your end, @dolio ?

shartte avatar Sep 14 '21 20:09 shartte

ah, before you do that, can you place the .pdb file from this zip next to TemplePlus.exe ? https://ci.appveyor.com/api/buildjobs/5b5qkeam8834jhcm/artifacts/TemplePlusSymbols-0.1.0-pre%2B3069.zip

shartte avatar Sep 14 '21 20:09 shartte

winedbg doesn't seem to like it, either. Just complains about an invalid address 0x00c350a00000002b. Backtrace is empty.

dolio avatar Sep 14 '21 23:09 dolio

Alright, finally figured this one out (the first one; the 2nd one was handled in #692)

Every spell condition in the game has the standard self-cleanup hook d20_mods_spells__teleport_prepare. This removes spell conditions when the caster is not in the party. One exception to this rule is... 🥁 🥁 🥁 🥁 🥁 🥁 Bear's Endurance! Which is the spell that was being removed when the crash happened.

As the logfile shows, what happens here is as follows:

  1. After entering Temple Level 2, Belsornig casts Bear's endurance
  2. Map change to Temple Level 1
  3. Coming back to Temple Level2 -> the spell condition was still active, except with an invalid caster handle.
  4. sp-Endurance countdown finishes, triggering the crash

Should be easy to fix I guess, though it's getting really annoying chasing all these invalid handle errors. I'm starting to think the real solution is to just persist object handles across maps...

DudeMcDude avatar Sep 23 '22 21:09 DudeMcDude