{"action":"created","issue":{"url":"https://api.github.com/repos/bazelbuild/bazel/issues/5196","repository_url":"https://api.github.com/repos/bazelbuild/bazel","labels_url":"https://api.github.com/repos/bazelbuild/bazel/issues/5196/labels{/name}","comments_url":"https://api.github.com/repos/bazelbuild/bazel/issues/5196/comments","events_url":"https://api.github.com/repos/bazelbuild/bazel/issues/5196/events","html_url":"https://github.com/bazelbuild/bazel/issues/5196","id":322935540,"number":5196,"title":"xcode-locator-bin is run too many times","user":{"login":"jmmv","id":879272,"avatar_url":"https://avatars0.githubusercontent.com/u/879272?v=4","gravatar_id":"","url":"https://api.github.com/users/jmmv","html_url":"https://github.com/jmmv","followers_url":"https://api.github.com/users/jmmv/followers","following_url":"https://api.github.com/users/jmmv/following{/other_user}","gists_url":"https://api.github.com/users/jmmv/gists{/gist_id}","starred_url":"https://api.github.com/users/jmmv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmmv/subscriptions","organizations_url":"https://api.github.com/users/jmmv/orgs","repos_url":"https://api.github.com/users/jmmv/repos","events_url":"https://api.github.com/users/jmmv/events{/privacy}","received_events_url":"https://api.github.com/users/jmmv/received_events","type":"User","site_admin":false},"labels":[{"id":392620005,"url":"https://api.github.com/repos/bazelbuild/bazel/labels/category:%20rules%20%3E%20ObjC%20/%20iOS%20/%20J2ObjC","name":"category: rules > ObjC / iOS / J2ObjC","color":"d4c5f9","default":false}],"state":"open","locked":false,"assignee":{"login":"lberki","id":3524818,"avatar_url":"https://avatars1.githubusercontent.com/u/3524818?v=4","gravatar_id":"","url":"https://api.github.com/users/lberki","html_url":"https://github.com/lberki","followers_url":"https://api.github.com/users/lberki/followers","following_url":"https://api.github.com/users/lberki/following{/other_user}","gists_url":"https://api.github.com/users/lberki/gists{/gist_id}","starred_url":"https://api.github.com/users/lberki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lberki/subscriptions","organizations_url":"https://api.github.com/users/lberki/orgs","repos_url":"https://api.github.com/users/lberki/repos","events_url":"https://api.github.com/users/lberki/events{/privacy}","received_events_url":"https://api.github.com/users/lberki/received_events","type":"User","site_admin":false},"assignees":[{"login":"lberki","id":3524818,"avatar_url":"https://avatars1.githubusercontent.com/u/3524818?v=4","gravatar_id":"","url":"https://api.github.com/users/lberki","html_url":"https://github.com/lberki","followers_url":"https://api.github.com/users/lberki/followers","following_url":"https://api.github.com/users/lberki/following{/other_user}","gists_url":"https://api.github.com/users/lberki/gists{/gist_id}","starred_url":"https://api.github.com/users/lberki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lberki/subscriptions","organizations_url":"https://api.github.com/users/lberki/orgs","repos_url":"https://api.github.com/users/lberki/repos","events_url":"https://api.github.com/users/lberki/events{/privacy}","received_events_url":"https://api.github.com/users/lberki/received_events","type":"User","site_admin":false},{"login":"c-parsons","id":13687552,"avatar_url":"https://avatars0.githubusercontent.com/u/13687552?v=4","gravatar_id":"","url":"https://api.github.com/users/c-parsons","html_url":"https://github.com/c-parsons","followers_url":"https://api.github.com/users/c-parsons/followers","following_url":"https://api.github.com/users/c-parsons/following{/other_user}","gists_url":"https://api.github.com/users/c-parsons/gists{/gist_id}","starred_url":"https://api.github.com/users/c-parsons/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/c-parsons/subscriptions","organizations_url":"https://api.github.com/users/c-parsons/orgs","repos_url":"https://api.github.com/users/c-parsons/repos","events_url":"https://api.github.com/users/c-parsons/events{/privacy}","received_events_url":"https://api.github.com/users/c-parsons/received_events","type":"User","site_admin":false}],"milestone":null,"comments":9,"created_at":"2018-05-14T18:45:26Z","updated_at":"2018-05-25T14:01:51Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"While investigating https://github.com/bazelbuild/bazel/issues/4603, which spilled into https://github.com/google/santa/issues/260, we have discovered that Bazel is *building and running* `xcode-locator-bin` too many times. This may be exacerbating the issue we see in the original bug.\r\n\r\nThings I have found so far:\r\n\r\n* This tool is compiled and executed from https://source.bazel.build/bazel/+/master:tools/osx/xcode_configure.bzl;l=116?q=xcode_configure.bzl . This seems to be the only code where the compilation and execution happens. Adding a print statement there shows that the tool is run exactly once.\r\n\r\n* Instrumenting the `xcode_locator.m` file to record invocations shows that the tool is built and executed about 15 times. 14 for `local_config_cc` and once for `local_config_xcode`.\r\n\r\n* The print statement introduced in `xcode_configure.bzl` only triggers for the call that happens for `local_config_xcode`; all other calls happen earlier and don't trigger the print statement. It's unclear to me how the calls for `local_config_cc` skip the message printing given that they delegate to `xcode_configure.bzl` to actually run the tool.\r\n\r\n* Instrumenting `SkylarkExecutionResult.java` does show that we are calling `repository_ctx.execute()` multiple times.\r\n\r\n* I fear that we are running the CC autoconfiguration multiple times by mistake without noticing... but though that should trigger the print statement and it doesn't.\r\n\r\n* Mind you, adding a print statement at the beginning of `cc_configure` shows the message *after* all the spurious `xcode-locator` invocations have happened, and only once.\r\n\r\n* Not to mention that this all takes **seconds** to run. Fixing this could speed up clean builds significantly.\r\n\r\nAll of this stuff is pretty complex and I don't have sufficient context right now. Maybe the issue is easy to explain so looping in the experts before I spend more time on it."},"comment":{"url":"https://api.github.com/repos/bazelbuild/bazel/issues/comments/392067517","html_url":"https://github.com/bazelbuild/bazel/issues/5196#issuecomment-392067517","issue_url":"https://api.github.com/repos/bazelbuild/bazel/issues/5196","id":392067517,"user":{"login":"ulfjack","id":7355745,"avatar_url":"https://avatars0.githubusercontent.com/u/7355745?v=4","gravatar_id":"","url":"https://api.github.com/users/ulfjack","html_url":"https://github.com/ulfjack","followers_url":"https://api.github.com/users/ulfjack/followers","following_url":"https://api.github.com/users/ulfjack/following{/other_user}","gists_url":"https://api.github.com/users/ulfjack/gists{/gist_id}","starred_url":"https://api.github.com/users/ulfjack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ulfjack/subscriptions","organizations_url":"https://api.github.com/users/ulfjack/orgs","repos_url":"https://api.github.com/users/ulfjack/repos","events_url":"https://api.github.com/users/ulfjack/events{/privacy}","received_events_url":"https://api.github.com/users/ulfjack/received_events","type":"User","site_admin":false},"created_at":"2018-05-25T14:01:51Z","updated_at":"2018-05-25T14:01:51Z","author_association":"CONTRIBUTOR","body":"Sure, that won't hurt.\n\nOn Fri, May 25, 2018 at 12:52 PM Julio Merino <notifications@github.com>\nwrote:\n\n> Why is building the binary wrong? Shipping a prebuilt binary or rewriting\n> the code seems like a hack to avoid the underlying problem we trigger, not\n> a solution.\n>\n> The fact that we are triggering Skyframe restarts so many times seems more\n> concerning to me. Note that Bazel gets stuck for a few *seconds* while\n> this process takes place at analysis time, so I feel digging down the root\n> cause of the restarts could help performance as well.\n>\n> —\n> You are receiving this because you commented.\n> Reply to this email directly, view it on GitHub\n> <https://github.com/bazelbuild/bazel/issues/5196#issuecomment-392016607>,\n> or mute the thread\n> <https://github.com/notifications/unsubscribe-auth/AHA9YWKORDhXbjL0IFSFSAc9mPav1Ktmks5t1-JQgaJpZM4T-UDd>\n> .\n>\n"}}
{"actor":{"display_login":"ulfjack"}}