sarutak commented on code in PR #59061:
URL: https://github.com/apache/spark/pull/59061#discussion_r4172425733
##########
core/src/test/scala/org/apache/spark/util/UtilsSuite.scala:
##########
@@ -572,6 +573,37 @@ class UtilsSuite extends SparkFunSuite with
ResetSystemProperties {
assert(!Utils.createDirectory(scenario8))
}
+ test("chmod700 leaves rwx------ under concurrent calls on the same path") {
+ // Workers in local-cluster mode share local root dirs and can chmod the
same
+ // per-application directory concurrently; the stat-then-chmod File.set*
sequence
+ // interleaves into broken permission sets, so chmod700 must be atomic.
+
assume(FileSystems.getDefault.supportedFileAttributeViews().contains("posix"))
+ withTempDir { dir =>
+ // Start from a permissive mode so the assertion cannot pass vacuously
under umask 077.
+ Files.setPosixFilePermissions(dir.toPath,
PosixFilePermissions.fromString("rwxr-xr-x"))
+ (1 to 10).foreach { _ =>
+ val threads = (1 to 4).map { _ =>
+ new Thread(() => (1 to 20).foreach(_ => Utils.chmod700(dir)))
+ }
+ threads.foreach(_.start())
+ threads.foreach(_.join())
+ assert(
Review Comment:
> The CyclicBarrier suggested in the other thread would not change this
either, since it only aligns thread starts while the assertion still samples
the quiescent post-join state.
Agreed.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]