THIS MOD IS NOT NEEDED ANYMORE AS OF MINECRAFT 1.19.4 - IT FIXED THE BUG.
This little mod rewrites one function of the advancements logic to make advancements checking faster, and use less recursion. It should prevent StackOverflowErrors with advancements.
If net.minecraft.class_2985.method_12885
appears in the crash log, this mod is likely going to fix it.
(Or net.minecraft.advancement.PlayerAdvancementTracker.updateDisplay
if you are using Not Enough Crashes).
This mod can be installed on the server-side only if you are having issues on a server, but it can also be useful on the client when playing in single-player words.