Further musing, but why should any environment variables be sent from the driver program to the executor? Since memoryPerSlave is sent explicitly via the LaunchExecutor message, would you want any other environment variables to really affect the executor?

Seems like the Worker should know its own SPARK_HOME, SPARK_CLASSPATH, etc., such that it would be a bad idea if these driver-side variables (especially if the driver program is spark-shell and so has these variables even if the user hasn't explicitly set them) affects what ExecutorRunner does.

(Note that ExecutorRunner itself taking LaunchExecutor.memory and using that to set SPARK_MEM before calling run still makes sense to me, because SPARK_MEM is like a hidden implementation detail.)

Sorry for the dissertation on what is probably a simple issue.