Rare freeze in Total Chaos with recent devbuilds

Fri Nov 02, 2018 4:30 am

Sometimes while doing inventory management in the mod, there's a chance gzdoom will freeze up completely out of the blue. I haven't been able to figure out what exactly causes this, as the mod only provides compiled ACS.

Here's a stack trace, here. From what I've been able to tell in gdb, DBaseStatusBar::DetachMessage enters an infinite loop. I'd send in a full coredump but it's 5GB in size. Even compressed it's still supermassive.

I'm linking a save here. Just open the inventory and hover over some items, move them around, etc. Eventually the freeze should happen.

Re: Rare freeze in Total Chaos with recent devbuilds

Fri Nov 02, 2018 5:08 am

What's the last version that doesn't freeze?

Re: Rare freeze in Total Chaos with recent devbuilds

Fri Nov 02, 2018 7:28 am

It's going to take me quite a while to bisect this. Hold on.

Re: Rare freeze in Total Chaos with recent devbuilds

Fri Nov 02, 2018 8:52 am

You mentioned recent devbuilds, so I thought you know some versions that don't freeze.

Re: Rare freeze in Total Chaos with recent devbuilds

Fri Nov 02, 2018 9:17 am

I have bad news. The last commit that doesn't seem to have the bug no matter how hard I try is e4d2ec8, and, unfortunately, I cannot track down which of the commits after it introduced the bug, because the vast majority of them won't compile or just crash on launch. a388b6c is the oldest commit that works AND has the bug, and it's 20 commits apart from the last good one. I would first go for anything that touches the DHUDMessage class.

Re: Rare freeze in Total Chaos with recent devbuilds

Fri Nov 02, 2018 10:24 am

So it was probably the thing I added just for you - i.e. serialization of the BrokenText class. All changes in that area are connected to it.
Do I need to say that I absolutely hate linked list data structures? They provide little to no advantage in most cases but endless trouble if something goes wrong.

This is a textbook example where a vector would have been better, but this code is simply too old.

Re: Rare freeze in Total Chaos with recent devbuilds

Fri Nov 02, 2018 1:31 pm

Then the vintage build will hang as well, there are devbuilds for it as well.

Re: Rare freeze in Total Chaos with recent devbuilds

Sat Nov 03, 2018 3:38 am

Did someone else experience this problem? Because I cannot reproduce it and there are no other reports in Total Chaos topic.
Now let me guess. It freezes with GZDoom built by GCC with -O3 optimization level (and maybe with -O2), right? Did you tried with Debug configuration?

Re: Rare freeze in Total Chaos with recent devbuilds

Sat Nov 03, 2018 4:15 am

The freeze still happens in Debug. The while loop on shared_sbar.cpp at line 788 just goes on endlessly.

Re: Rare freeze in Total Chaos with recent devbuilds

Sat Nov 03, 2018 6:49 am

OK, this rules out the misoptimization. Still, are you sure that this loop executes infinitely? I'm trying to figure out, do we really have a cycle in that linked list?

Re: Rare freeze in Total Chaos with recent devbuilds

Sat Nov 03, 2018 4:15 pm

From what I'm getting by stepping repeatedly in gdb, it is exactly that while loop.