WickedEngine icon indicating copy to clipboard operation
WickedEngine copied to clipboard

"Corrupted doubly-linked list"

Open metaleap opened this issue 1 year ago • 2 comments

On an Arch Linux with KDE on X11, running latest Wicked Editor release v0.71.563, when I close the window with Alt+F4 (whether I did anything or loaded anything or did nothing at all), it always ends with these 2 terminal prints:

corrupted double-linked list
Aborted (core dumped)

Doesn't break things of course, since that's happening at the end.. but maybe it points to some odd lurking bug underneath..

metaleap avatar Sep 17 '24 14:09 metaleap

I believe it's basically a bug in Jolt, the recommended way of cleaning up will cause Jolt to do a double free once it's closing itself. Creating a bug report for Jolt is on my todo list.

brakhane avatar Sep 17 '24 15:09 brakhane

This is not happening for me on Windows.

turanszkij avatar Sep 18 '24 05:09 turanszkij

I believe it's basically a bug in Jolt, the recommended way of cleaning up will cause Jolt to do a double free once it's closing itself. Creating a bug report for Jolt is on my todo list.

Did ya? Because I'd add it to my issue-tracking subs if so =)

(Seems like the only websearch result on this-error-message-AND-jolt is this very here Issue tho... maybe no-one else ever posted about it before us. But countless results without "Jolt" in the query, many of the posts mentioning that this message, refers specifically to the glibc allocator's internal linked list (apparently there's such a thing). Of course it could still be Jolt's doing nonetheless, and either way according to above comment apparently only Linux to top it off..)

metaleap avatar Jan 01 '25 10:01 metaleap

I recently did some more testing and the "double linked list" error is not the Jolt related one, it always seems to happen in conjunction with the Vulkan drivers.

The Jolt issue is that somehow UnregisterTypes() in Wicked's Jolt destructor seems to be called after the atexit handler of Jolt, which also calls UnregisterTypes, causing PhysicsMaterial::sDefault to be nullptr and a Segmentation Fault. I haven't been able to create a minimal reproducible example yet; as soon as I do, I'll create an issue in the Jolt github

brakhane avatar Jan 01 '25 11:01 brakhane

Actually I managed to reliably reproduce the issue, it is indeed caused by Jolt. As a workaround, you can uncomment the JoltDestroyer in wiPhysics_Jolt.cpp for now since its only job is to clean up at shutdown; unless you're checking for memory leaks, there's no harm done in not deallocating before exiting.

I've reported the problem in jrouwe/JoltPhysics#1458

brakhane avatar Jan 16 '25 18:01 brakhane