Actually, this unrelated to shuffle, because caches for both, ShuffleMapTasks and ResultsTasks, need to be cleaned. One nifty way I can think of keeping track of the lowest stage ID S in the DAGScheduler such that all stages with id <= S have completed. If that is somehow communicated to all the workers, then cleanup can be done. Though, there is a obvious problem of what happens when the id rolls around Integer.MAX_VALUE (though I am not sure how serious a problem that is).