-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Input prefetcher handles partial tree artifacts and nested artifacts incorrectly #16333
Comments
In addition, it's possible for an action to consume only one of the files in a tree artifact (see |
…partial tree artifacts. The actions generated by SpawnActionTemplate and CppCompileActionTemplate contain individual TreeFileArtifacts, but not the respective TreeArtifact, in their inputs. This causes the input prefetcher to crash when building without the bytes, as it is only able to fetch entire tree artifacts and expects their input metadata to be available. This PR introduces an ActionInputPrefetcher#supportsPartialTreeArtifactInputs method signaling whether prefetching partial tree artifacts is supported; if not, the entire tree artifact is included in the inputs of any such actions. This is a temporary workaround to unblock the 6.0.0 release. The long-term plan is to fix bazelbuild#16333 to enable prefetching partial tree artifacts, and remove this workaround. Fixes bazelbuild#16987.
…partial tree artifacts. The actions generated by SpawnActionTemplate and CppCompileActionTemplate contain individual TreeFileArtifacts, but not the respective TreeArtifact, in their inputs. This causes the input prefetcher to crash when building without the bytes, as it is only able to fetch entire tree artifacts and expects their input metadata to be available. This PR introduces an ActionInputPrefetcher#supportsPartialTreeArtifactInputs method signaling whether prefetching partial tree artifacts is supported; if not, the entire tree artifact is included in the inputs of any such actions. This is a temporary workaround to unblock the 6.0.0 release. The long-term plan is to fix bazelbuild#16333 to enable prefetching partial tree artifacts, and remove this workaround. Fixes bazelbuild#16987.
…partial tree artifacts. The actions generated by SpawnActionTemplate and CppCompileActionTemplate contain individual TreeFileArtifacts, but not the respective TreeArtifact, in their inputs. This causes the input prefetcher to crash when building without the bytes, as it is only able to fetch entire tree artifacts and expects their input metadata to be available. This PR introduces an ActionInputPrefetcher#supportsPartialTreeArtifactInputs method signaling whether prefetching partial tree artifacts is supported; if not, the entire tree artifact is included in the inputs of any such actions. This is a temporary workaround to unblock the 6.0.0 release. The long-term plan is to fix bazelbuild#16333 to enable prefetching partial tree artifacts, and remove this workaround. Fixes bazelbuild#16987. PiperOrigin-RevId: 495050207 Change-Id: I7d29713085d2cf84ce5302394fc18ff2a96ec4be
…support partial tree artifacts. The actions generated by SpawnActionTemplate and CppCompileActionTemplate contain individual TreeFileArtifacts, but not the respective TreeArtifact, in their inputs. This causes the input prefetcher to crash when building without the bytes, as it is only able to fetch entire tree artifacts and expects their input metadata to be available. This PR introduces an ActionInputPrefetcher#supportsPartialTreeArtifactInputs method signaling whether prefetching partial tree artifacts is supported; if not, the entire tree artifact is included in the inputs of any such actions. This is a temporary workaround to unblock the 6.0.0 release. The long-term plan is to fix bazelbuild#16333 to enable prefetching partial tree artifacts, and remove this workaround. Fixes bazelbuild#16987. PiperOrigin-RevId: 495050207 Change-Id: I7d29713085d2cf84ce5302394fc18ff2a96ec4be
…support partial tree artifacts. The actions generated by SpawnActionTemplate and CppCompileActionTemplate contain individual TreeFileArtifacts, but not the respective TreeArtifact, in their inputs. This causes the input prefetcher to crash when building without the bytes, as it is only able to fetch entire tree artifacts and expects their input metadata to be available. This PR introduces an ActionInputPrefetcher#supportsPartialTreeArtifactInputs method signaling whether prefetching partial tree artifacts is supported; if not, the entire tree artifact is included in the inputs of any such actions. This is a temporary workaround to unblock the 6.0.0 release. The long-term plan is to fix bazelbuild#16333 to enable prefetching partial tree artifacts, and remove this workaround. Fixes bazelbuild#16987. PiperOrigin-RevId: 495050207 Change-Id: I7d29713085d2cf84ce5302394fc18ff2a96ec4be
…support partial tree artifacts. (#17013) The actions generated by SpawnActionTemplate and CppCompileActionTemplate contain individual TreeFileArtifacts, but not the respective TreeArtifact, in their inputs. This causes the input prefetcher to crash when building without the bytes, as it is only able to fetch entire tree artifacts and expects their input metadata to be available. This PR introduces an ActionInputPrefetcher#supportsPartialTreeArtifactInputs method signaling whether prefetching partial tree artifacts is supported; if not, the entire tree artifact is included in the inputs of any such actions. This is a temporary workaround to unblock the 6.0.0 release. The long-term plan is to fix #16333 to enable prefetching partial tree artifacts, and remove this workaround. Fixes #16987. PiperOrigin-RevId: 495050207 Change-Id: I7d29713085d2cf84ce5302394fc18ff2a96ec4be
…partial tree artifacts. The actions generated by SpawnActionTemplate and CppCompileActionTemplate contain individual TreeFileArtifacts, but not the respective TreeArtifact, in their inputs. This causes the input prefetcher to crash when building without the bytes, as it is only able to fetch entire tree artifacts and expects their input metadata to be available. This PR introduces an ActionInputPrefetcher#supportsPartialTreeArtifactInputs method signaling whether prefetching partial tree artifacts is supported; if not, the entire tree artifact is included in the inputs of any such actions. This is a temporary workaround to unblock the 6.0.0 release. The long-term plan is to fix #16333 to enable prefetching partial tree artifacts, and remove this workaround. Fixes #16987. PiperOrigin-RevId: 495050207 Change-Id: I7d29713085d2cf84ce5302394fc18ff2a96ec4be
Reopening because 25ba76c was just a workaround, and we have yet to fix it properly. |
Due to the existence of partial trees (tree artifacts whose files are not all produced by the same action) and nested artifacts (artifacts whose output path is a strict prefix of another artifact's), concurrent calls to the prefetcher might write to the same directory in the output tree, so they must synchronize when making the output directory temporarily writable. Fixes bazelbuild#16333.
Due to the existence of partial trees (tree artifacts whose files are not all produced by the same action) and nested artifacts (artifacts whose output path is a strict prefix of another artifact's), the prefetcher must not assume every tree artifact is fetched as a whole. In addition, concurrent actions calling the prefetcher might write to the same directory in the output tree, so they must synchronize when making the directory temporarily writable. Fixes bazelbuild#16333.
Due to the existence of partial trees (tree artifacts whose files are not all produced by the same action) and nested artifacts (artifacts whose output path is a strict prefix of another artifact's), the prefetcher must not assume every tree artifact is fetched as a whole. In addition, concurrent actions calling the prefetcher might write to the same directory in the output tree, so they must synchronize when making the directory temporarily writable. Fixes bazelbuild#16333.
Due to the existence of partial trees (tree artifacts whose files are not all produced by the same action) and nested artifacts (artifacts whose output path is a strict prefix of another artifact's), the prefetcher must not assume every tree artifact is fetched as a whole. In addition, concurrent actions calling the prefetcher might write to the same directory in the output tree, so they must synchronize when making the directory temporarily writable. Fixes bazelbuild#16333.
Due to the existence of partial trees (tree artifacts whose files are not all produced by the same action) and nested artifacts (artifacts whose output path is a strict prefix of another artifact's), the prefetcher must not assume every tree artifact is fetched as a whole. In addition, concurrent actions calling the prefetcher might write to the same directory in the output tree, so they must synchronize when making the directory temporarily writable. Fixes bazelbuild#16333.
@tjgq Should this be cherry-picked? |
Yes, but I'm not sure 6.1.0 is still accepting cherry-picks. If we decide to do an rc3, I'll cherry-pick it there. Otherwise, it will have to go into 6.2.0. |
Due to the existence of templated tree artifacts (tree artifacts where each file is produced by a separate action) and nested artifacts (artifacts whose output path is a descendant of another artifact's), the prefetcher must not assume every tree artifact is fetched as a whole. In addition, concurrent actions calling the prefetcher might write to the same directory in the output tree, so they must synchronize when making the directory temporarily writable. Fixes bazelbuild#16333. PiperOrigin-RevId: 513205572 Change-Id: I827c4643643f63c9425e63bdf9177805c5f0f409
Due to the existence of templated tree artifacts (tree artifacts where each file is produced by a separate action) and nested artifacts (artifacts whose output path is a descendant of another artifact's), the prefetcher must not assume every tree artifact is fetched as a whole. In addition, concurrent actions calling the prefetcher might write to the same directory in the output tree, so they must synchronize when making the directory temporarily writable. Fixes bazelbuild#16333. PiperOrigin-RevId: 513205572 Change-Id: I827c4643643f63c9425e63bdf9177805c5f0f409
…17735) Due to the existence of templated tree artifacts (tree artifacts where each file is produced by a separate action) and nested artifacts (artifacts whose output path is a descendant of another artifact's), the prefetcher must not assume every tree artifact is fetched as a whole. In addition, concurrent actions calling the prefetcher might write to the same directory in the output tree, so they must synchronize when making the directory temporarily writable. Fixes #16333. PiperOrigin-RevId: 513205572 Change-Id: I827c4643643f63c9425e63bdf9177805c5f0f409
@bazel-io fork 6.2.0 |
Due to the existence of templated tree artifacts (tree artifacts where each file is produced by a separate action) and nested artifacts (artifacts whose output path is a descendant of another artifact's), the prefetcher must not assume every tree artifact is fetched as a whole. In addition, concurrent actions calling the prefetcher might write to the same directory in the output tree, so they must synchronize when making the directory temporarily writable. Fixes bazelbuild#16333. PiperOrigin-RevId: 513205572 Change-Id: I827c4643643f63c9425e63bdf9177805c5f0f409
It's possible for artifacts to nest (i.e., to have a declare_file or declare_directory that descends from another declare_directory). If two nested inputs are presented to the input prefetcher, the common files will be downloaded twice and race against each other, potentially corrupting the input tree.
https://cs.opensource.google/bazel/bazel/+/master:src/main/java/com/google/devtools/build/lib/remote/AbstractActionInputPrefetcher.java;l=289;drc=05b97393ff7604f237d9d31bd63714f27fbe83f2
https://cs.opensource.google/bazel/bazel/+/master:src/main/java/com/google/devtools/build/lib/remote/AbstractActionInputPrefetcher.java;l=230;drc=05b97393ff7604f237d9d31bd63714f27fbe83f2
The text was updated successfully, but these errors were encountered: