You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "panbingkun (via GitHub)" <gi...@apache.org> on 2024/03/16 12:44:48 UTC

Re: [PR] [SPARK-23015][WINDOWS] Fix bug in Windows where starting multiple Spark instances within the same second causes a failure [spark]

panbingkun commented on code in PR #43706:
URL: https://github.com/apache/spark/pull/43706#discussion_r1527168162


##########
bin/spark-class2.cmd:
##########
@@ -64,12 +64,9 @@ if not "x%JAVA_HOME%"=="x" (
 rem The launcher library prints the command to be executed in a single line suitable for being
 rem executed by the batch interpreter. So read all the output of the launcher into a variable.
 :gen
-set LAUNCHER_OUTPUT=%temp%\spark-class-launcher-output-%RANDOM%%TIME::=0%.txt
-rem Remove space between the RANDOM and TIME output
-set LAUNCHER_OUTPUT=%LAUNCHER_OUTPUT: =%
-rem SPARK-28302: %RANDOM% would return the same number if we call it instantly after last call,
-rem so we should make it sure to generate unique file to avoid process collision of writing into
-rem the same file concurrently.
+FOR /F %%a IN ('POWERSHELL -COMMAND "$([guid]::NewGuid().ToString())"') DO (SET NEWGUID=%%a)

Review Comment:
   If we use the `GUID` mechanism, do we still need this logic? 
   ```
   :gen
   ...
   if exist %LAUNCHER_OUTPUT% goto :gen
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org