[SPARK-4952][Core]Handle ConcurrentModificationExceptions in SparkEnv.environmentDetails