Patch adds another variable - commitMemory (Fetch complete size). A merge is triggered only if this size exceeds mergeThreshold. Added a check to ensure mergeThreshold is greater than the maxSingleShuffleLimit.
Earlier - usedMemory (reserved) was used for this computation - which meant a single segment way below mergeThreshold could lead to a merge to disk.
Have run several gridmix runs with the patch applied - without a hang. Not including a unit test - writing one would likely change way more in the shuffle code to be able to recreate the scenario.