Skip to content

Commit f1744fa

Browse files
committed
MapR [SPARK-1108] Parallel jobs running causes errors with manageSSLKeys.sh (Permission denied) (apache#1048)
Co-authored-by: Egor Krivokon <>
1 parent b841862 commit f1744fa

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

core/src/main/scala/org/apache/spark/SecurityManager.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ private[spark] class SecurityManager(
139139
val fs = FileSystem.get(hadoopConf)
140140

141141
// If the manageSSLKeys.sh script is not present, copy it from local spark folder
142-
if (! fs.exists(new Path(mfsManageSslKeysScriptRemote))) {
142+
if (!fs.exists(new Path(mfsManageSslKeysScriptRemote))) {
143143
val mfsBaseDirPath = new Path(mfsBaseDir)
144144
if (!fs.exists(mfsBaseDirPath)) {
145145
fs.mkdirs(mfsBaseDirPath)
@@ -150,7 +150,9 @@ private[spark] class SecurityManager(
150150
val localBaseDir = s"$currentUserHomeDir/__spark-internal__/security_keys"
151151
val manageSslKeysScriptLocal = s"$localBaseDir/$certGeneratorName"
152152

153-
fs.copyToLocalFile(new Path(mfsManageSslKeysScriptRemote), new Path(manageSslKeysScriptLocal))
153+
if (!fs.exists(new Path(manageSslKeysScriptLocal))) {
154+
fs.copyToLocalFile(new Path(mfsManageSslKeysScriptRemote), new Path(manageSslKeysScriptLocal))
155+
}
154156
val manageSslKeysLocalFile = new File(manageSslKeysScriptLocal)
155157

156158
manageSslKeysLocalFile.setExecutable(true)
@@ -163,7 +165,7 @@ private[spark] class SecurityManager(
163165

164166
while (s"pgrep -fl $certGeneratorName".lineStream_!.nonEmpty) {
165167
logInfo("manageSSLKeys.sh script is busy, waiting...")
166-
Thread.sleep(500)
168+
Thread.sleep(5000)
167169
}
168170
val res = s"$manageSslKeysScriptLocal $sslKeyStorePass" ! ProcessLogger(stdWriter println, stdWriter println)
169171
stdWriter.close()

0 commit comments

Comments
 (0)