-
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
reject symlink outputs from cachable actions #4840
Comments
Agree, this impacted us too until I sprinkled some "no-cache" tags. |
That sounds good to me. We should probably output a decent error message indicating that this action should be tagged "no-cache". Do you want to work on this @benjaminp? |
@nicolov for which rules did you encounter this behavior? |
This applies for all rules that try to symlink. For example, tensorflow has
some genrules that gather headers from the system and symlink them into the
execroot.
…On Thu, Mar 15, 2018 at 4:58 AM Jakob Buchgraber ***@***.***> wrote:
@nicolov <https://github.com/nicolov> for which rules did you encounter
this behavior?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4840 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AKO4BxnS-hmGeY0KYOWwLw4Xwi4FUQKRks5teldYgaJpZM4SpwOT>
.
|
Sure, I can work on a patch. |
Thank you @benjaminp |
Hey @benjaminp, I have discussed this issue with a few people on the Bazel team:
|
Thanks for the guidance.
I think it should be an error. Warnings are fine for informing users about transient conditions like the remote cache being down. An action producing symlinks is similar to an action not producing promised artifacts. It's an unambiguous deterministic function of the (gen)rule implementation. |
Sounds reasonable :). Thanks. |
… to a remote cache. The remote cache protocol only knows about regular files and directories. Currently, during action output upload, symlinks are resolved into regular files. This means cached "executions" of an action may have different output file types than the original execution, which can be a footgun. This CL bans symlinks from cachable spawn outputs and fixes bazelbuild#4840. The interface of SpawnCache.CacheHandle.store is refactored: 1. The outputs parameter is removed, since that can be retrieved from the underlying Spawn. 2. It can now throw ExecException in order to fail actions. Change-Id: I0d1d94d48779b970bb5d0840c66a14c189ab0091
… to a remote cache. The remote cache protocol only knows about regular files and directories. Currently, during action output upload, symlinks are resolved into regular files. This means cached "executions" of an action may have different output file types than the original execution, which can be a footgun. This CL bans symlinks from cachable spawn outputs and fixes bazelbuild#4840. The interface of SpawnCache.CacheHandle.store is refactored: 1. The outputs parameter is removed, since that can be retrieved from the underlying Spawn. 2. It can now throw ExecException in order to fail actions. Change-Id: I0d1d94d48779b970bb5d0840c66a14c189ab0091
… to a remote cache. The remote cache protocol only knows about regular files and directories. Currently, during action output upload, symlinks are resolved into regular files. This means cached "executions" of an action may have different output file types than the original execution, which can be a footgun. This CL bans symlinks from cachable spawn outputs and fixes bazelbuild#4840. The interface of SpawnCache.CacheHandle.store is refactored: 1. The outputs parameter is removed, since that can be retrieved from the underlying Spawn. 2. It can now throw ExecException in order to fail actions. Change-Id: I0d1d94d48779b970bb5d0840c66a14c189ab0091
… to a remote cache. The remote cache protocol only knows about regular files and directories. Currently, during action output upload, symlinks are resolved into regular files. This means cached "executions" of an action may have different output file types than the original execution, which can be a footgun. This CL bans symlinks from cachable spawn outputs and fixes bazelbuild#4840. The interface of SpawnCache.CacheHandle.store is refactored: 1. The outputs parameter is removed, since that can be retrieved from the underlying Spawn. 2. It can now throw ExecException in order to fail actions. Change-Id: I0d1d94d48779b970bb5d0840c66a14c189ab0091
Am I understanding correctly that this behavior will need to be changed when https://docs.google.com/document/d/1gnOYszitgrLVet3sQk-TKGqIcpkkDsc6aw-izoo-d64/edit# is implemented? |
Ah, I wasn't aware of that proposal. Yes, if the remote cache correctly handles symlinks, it shouldn't be necessary to ban them. |
@ola-rozenfeld is there a time frame for implementing this? |
Yes, we actually plan to do it this quarter. We plan to implement all the
outstanding proposals in
https://docs.google.com/document/d/12c3oAPgedckLpue2yj0xGgJTEOyUm4mXWWBJ157J-8I/edit?ts=5aabd397#
as a major API version change. We are also moving the API protos to our own
repo (out of googleapis), to facilitate discussion.
…On Tue, Apr 10, 2018 at 4:12 AM Jakob Buchgraber ***@***.***> wrote:
@ola-rozenfeld <https://github.com/ola-rozenfeld> is there a time frame
for implementing this?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4840 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AYoKuE62SCeE6jjmSVK-R_s6ot8AwrPBks5tnGmFgaJpZM4SpwOT>
.
|
Can we reopen this since the change was reverted? |
…cache. This is mostly a roll-forward of 4465dae, which was reverted by fa36d2f. The main difference is that the new behavior is now gated behind the --noremote_allow_symlink_upload flag. https://docs.google.com/document/d/1gnOYszitgrLVet3sQk-TKGqIcpkkDsc6aw-izoo-d64 is a design proposal to support symlinks in the remote cache, which would render this change moot. I'd like to be able to prevent incorrect cache behavior until that change is implemented, though. This fixes bazelbuild#4840 (again). Change-Id: I2136cfe82c2e1a8a9f5856e12a37d42cabd0e299
I ll roll the change forward once the |
The remote caching protocol doesn't know about symlinks, and the remote spawn strategy currently converts all symlink into regular files when uploading to the cache. This behavior is insidious because local execution preserves symlinks. So, local and remote execution may yield different results if symlinks are involved:
Handling symlinks in remote caching seems tricky. (What if the link target is absolute?) Therefore, I propose that trying to upload a symlink output to the cache should be an error.
The text was updated successfully, but these errors were encountered: