Skip to content

Commit c7f5c81

Browse files
larsrc-googlecopybara-github
authored andcommitted
Avoid creating many distinct suffixes for the atomic writes of action inputs.
PiperOrigin-RevId: 515354520 Change-Id: I0b7fbe964f378c66fe69f9cfabc729718b9811a7
1 parent 10587b1 commit c7f5c81

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main/java/com/google/devtools/build/lib/sandbox/SandboxHelpers.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -468,14 +468,17 @@ public SandboxInputs processInputFiles(
468468
PathFragment pathFragment = e.getKey();
469469
ActionInput actionInput = e.getValue();
470470
if (actionInput instanceof VirtualActionInput) {
471+
// TODO(larsrc): Figure out which VAIs actually require atomicity, maybe avoid it.
471472
VirtualActionInput input = (VirtualActionInput) actionInput;
472473
byte[] digest =
473474
input.atomicallyWriteRelativeTo(
474475
execRootPath,
475476
// When 2 actions try to atomically create the same virtual input, they need to have
476477
// a different suffix for the temporary file in order to avoid racy write to the
477478
// same one.
478-
".sandbox" + tempFileUniquifierForVirtualInputWrites.incrementAndGet());
479+
"_sandbox"
480+
+ tempFileUniquifierForVirtualInputWrites.incrementAndGet()
481+
+ ".virtualinputlock");
479482
virtualInputs.put(input, digest);
480483
}
481484

0 commit comments

Comments
 (0)