Skip to content

Commit b55dfc6

Browse files
committed
make sure to generate unique output file
1 parent 20469d4 commit b55dfc6

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

bin/spark-class2.cmd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,12 @@ if not "x%JAVA_HOME%"=="x" (
6363

6464
rem The launcher library prints the command to be executed in a single line suitable for being
6565
rem executed by the batch interpreter. So read all the output of the launcher into a variable.
66+
:gen
6667
set LAUNCHER_OUTPUT=%temp%\spark-class-launcher-output-%RANDOM%.txt
68+
rem SPARK-28302: %RANDOM% would return the same number if we call it instantly after last call,
69+
rem so we should make sure to generate unique file to avoid process collision of writing into a
70+
rem same file concurrently.
71+
if exist %LAUNCHER_OUTPUT% goto :gen
6772
"%RUNNER%" -Xmx128m -cp "%LAUNCH_CLASSPATH%" org.apache.spark.launcher.Main %* > %LAUNCHER_OUTPUT%
6873
for /f "tokens=*" %%i in (%LAUNCHER_OUTPUT%) do (
6974
set SPARK_CMD=%%i

0 commit comments

Comments
 (0)