karolherbst , Englisch
@karolherbst@chaos.social avatar

today: debugging a memory corruption which goes away with libasan...

karolherbst OP ,
@karolherbst@chaos.social avatar

"tcache_thread_shutdown(): unaligned tcache chunk detected" 😢

and it happens on application exit and like.. ahhhhh....

dotstdy ,
@dotstdy@mastodon.social avatar

@karolherbst crashes on shutdown are just fast paths for exiting! It's a feature!

karolherbst OP ,
@karolherbst@chaos.social avatar

anyway, I think this happens, because my threads continue to run even after everything else was released.

So yeah, that's not great, but also shouldn't cause any issues. What I think is causing issues is mostly just how things run at application exit and sometimes the order could mess things up?

Not quite sure :) Maybe it's just LLVM trashing the memory, but I'm also too lazy to dig why exactly this happens.

Anyway, I should terminate my threads early regardless.

karolherbst OP ,
@karolherbst@chaos.social avatar

tldr: JoinHandle doesn't stop your threads on drop.

karolherbst OP ,
@karolherbst@chaos.social avatar

that wasn't too bad: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29880

Though I still don't know what causing the memory issue, but now I'll just blame "undefined order" when exit is run and move on with life 🙃

permik ,
@permik@mastodon.online avatar

@karolherbst Huh, that seems kind of a footgun for the threads not to stop on drop, but getting detached. Link to the comment in the docs:
https://doc.rust-lang.org/src/std/thread/mod.rs.html#597

Should we have a stop-on-drop variant of the thread primitive in the std?

karolherbst OP ,
@karolherbst@chaos.social avatar

@permik maybe? That certainly would make my use case easier to deal with.

matk ,
@matk@mastodon.social avatar

@karolherbst I love those! Somehow I seem to attract this bug in particular, and the result is always something silly (like memory-pool/GC quirks, or integers being cast between 64 and 32 bit at a bad spot).
Only once was it a compiler error ^^

VegaHarmonia ,

@karolherbst I thought for a second you said lesbian

karolherbst OP ,
@karolherbst@chaos.social avatar

@VegaHarmonia I knew I was doing something wrong

  • Alle
  • Abonniert
  • Moderiert
  • Favoriten
  • random
  • haupteingang
  • Alle Magazine