It seems like the only case where the could happen would be if the number of active stages is greater than 1000 (RETAINED_STAGES), in which case trimIfNecessary() will remove some entries in stageIdToPool.  Was this the case in the experiment you were running?  In either case, I agree with Patrick that it would be good to put this in its own pull request, since it's separate from the scheduler changes.