{"action":"created","issue":{"url":"https://api.github.com/repos/saltstack/salt/issues/31293","repository_url":"https://api.github.com/repos/saltstack/salt","labels_url":"https://api.github.com/repos/saltstack/salt/issues/31293/labels{/name}","comments_url":"https://api.github.com/repos/saltstack/salt/issues/31293/comments","events_url":"https://api.github.com/repos/saltstack/salt/issues/31293/events","html_url":"https://github.com/saltstack/salt/issues/31293","id":134425078,"number":31293,"title":"Git Pillars lose HEAD reference over time","user":{"login":"deuscapturus","id":5497572,"avatar_url":"https://avatars.githubusercontent.com/u/5497572?v=3","gravatar_id":"","url":"https://api.github.com/users/deuscapturus","html_url":"https://github.com/deuscapturus","followers_url":"https://api.github.com/users/deuscapturus/followers","following_url":"https://api.github.com/users/deuscapturus/following{/other_user}","gists_url":"https://api.github.com/users/deuscapturus/gists{/gist_id}","starred_url":"https://api.github.com/users/deuscapturus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deuscapturus/subscriptions","organizations_url":"https://api.github.com/users/deuscapturus/orgs","repos_url":"https://api.github.com/users/deuscapturus/repos","events_url":"https://api.github.com/users/deuscapturus/events{/privacy}","received_events_url":"https://api.github.com/users/deuscapturus/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/saltstack/salt/labels/Bug","name":"Bug","color":"e11d21"},{"url":"https://api.github.com/repos/saltstack/salt/labels/Core","name":"Core","color":"fef2c0"},{"url":"https://api.github.com/repos/saltstack/salt/labels/High%20Severity","name":"High Severity","color":"ff9143"},{"url":"https://api.github.com/repos/saltstack/salt/labels/Info%20Needed","name":"Info Needed","color":"c7def8"},{"url":"https://api.github.com/repos/saltstack/salt/labels/P2","name":"P2","color":"155fb5"},{"url":"https://api.github.com/repos/saltstack/salt/labels/Pillar","name":"Pillar","color":"006b75"},{"url":"https://api.github.com/repos/saltstack/salt/labels/TEAM%20Core","name":"TEAM Core","color":"A9A9A9"}],"state":"open","locked":false,"assignee":{"login":"terminalmage","id":328598,"avatar_url":"https://avatars.githubusercontent.com/u/328598?v=3","gravatar_id":"","url":"https://api.github.com/users/terminalmage","html_url":"https://github.com/terminalmage","followers_url":"https://api.github.com/users/terminalmage/followers","following_url":"https://api.github.com/users/terminalmage/following{/other_user}","gists_url":"https://api.github.com/users/terminalmage/gists{/gist_id}","starred_url":"https://api.github.com/users/terminalmage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/terminalmage/subscriptions","organizations_url":"https://api.github.com/users/terminalmage/orgs","repos_url":"https://api.github.com/users/terminalmage/repos","events_url":"https://api.github.com/users/terminalmage/events{/privacy}","received_events_url":"https://api.github.com/users/terminalmage/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/saltstack/salt/milestones/75","html_url":"https://github.com/saltstack/salt/milestones/B%202","labels_url":"https://api.github.com/repos/saltstack/salt/milestones/75/labels","id":1528466,"number":75,"title":"B 2","description":"","creator":{"login":"meggiebot","id":12242451,"avatar_url":"https://avatars.githubusercontent.com/u/12242451?v=3","gravatar_id":"","url":"https://api.github.com/users/meggiebot","html_url":"https://github.com/meggiebot","followers_url":"https://api.github.com/users/meggiebot/followers","following_url":"https://api.github.com/users/meggiebot/following{/other_user}","gists_url":"https://api.github.com/users/meggiebot/gists{/gist_id}","starred_url":"https://api.github.com/users/meggiebot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meggiebot/subscriptions","organizations_url":"https://api.github.com/users/meggiebot/orgs","repos_url":"https://api.github.com/users/meggiebot/repos","events_url":"https://api.github.com/users/meggiebot/events{/privacy}","received_events_url":"https://api.github.com/users/meggiebot/received_events","type":"User","site_admin":false},"open_issues":29,"closed_issues":11,"state":"open","created_at":"2016-01-20T22:45:36Z","updated_at":"2016-02-25T05:35:42Z","due_on":"2016-02-29T07:00:00Z","closed_at":null},"comments":18,"created_at":"2016-02-17T22:51:15Z","updated_at":"2016-02-25T06:04:54Z","closed_at":null,"body":"We have a salt master configured with several git pillar repos.  About once a day we start getting these errors:\r\n```\r\nError occured fetching git_pillar remote 'staging git@github.com:myorg/saltstack-pillars.git': Reference 'HEAD' not found \r\nException caught while initializing git_pillar remote 'staging git@github.com:myorg/saltstack-pillars.git': tuple index out of range \r\n```\r\n\r\nWe resolve the issue each day by deleting /var/cache/salt/master/git_pillar\r\n\r\nLooking into /var/cache/salt/master/git_pillar/c245a5b583965a1bc938b8104013601c/.git/  I see that HEAD is actually missing.  What would cause HEAD to be deleted randomly?\r\n\r\nmaster config: (all other gitpillar settings are default)\r\n```\r\next_pillar:\r\n  - git:\r\n    - staging git@github.com:myorg/saltstack-pillars.git:\r\n      - privkey: /root/.ssh/id_rsa2\r\n      - pubkey: /root/.ssh/id_rsa2.pub\r\n      - env: base\r\n  - git:\r\n    - master git@github.com:myorg/saltstack-pillars-serverconfig.git:\r\n      - privkey: /root/.ssh/id_rsa3\r\n      - pubkey: /root/.ssh/id_rsa3.pub\r\n      - env: base\r\n  - git:\r\n    - master git@github.com:myorg/saltstack-primedirective.git:\r\n      - privkey: /root/.ssh/id_rsa4\r\n      - pubkey: /root/.ssh/id_rsa4.pub\r\n      - env: base\r\n      - root: pillars\r\n  - git:\r\n    - master git@github.com:myorg/saltstack-paths.git:\r\n      - privkey: /root/.ssh/id_rsa5\r\n      - pubkey: /root/.ssh/id_rsa5.pub\r\n      - env: base\r\n      - root: pillars\r\n```\r\n\r\n\r\n```\r\nSalt Version:\r\n           Salt: 2015.8.5\r\n \r\nDependency Versions:\r\n         Jinja2: 2.7.3\r\n       M2Crypto: 0.21.1\r\n           Mako: Not Installed\r\n         PyYAML: 3.11\r\n          PyZMQ: 14.5.0\r\n         Python: 2.6.9 (unknown, Dec 17 2015, 01:08:55)\r\n           RAET: Not Installed\r\n        Tornado: 4.2.1\r\n            ZMQ: 4.0.5\r\n           cffi: Not Installed\r\n       cherrypy: 3.2.2\r\n       dateutil: 2.1\r\n          gitdb: 0.6.4\r\n      gitpython: 1.0.1\r\n          ioflo: Not Installed\r\n        libgit2: 0.20.0\r\n        libnacl: Not Installed\r\n   msgpack-pure: Not Installed\r\n msgpack-python: 0.4.6\r\n   mysql-python: Not Installed\r\n      pycparser: Not Installed\r\n       pycrypto: 2.6.1\r\n         pygit2: 0.20.3\r\n   python-gnupg: 0.3.7\r\n          smmap: 0.9.0\r\n        timelib: Not Installed\r\n \r\nSystem Versions:\r\n           dist:   \r\n        machine: x86_64\r\n        release: 4.1.13-19.30.amzn1.x86_64\r\n```\r\n\r\nThe same error appears in https://github.com/saltstack/salt/issues/28298 which should be resolved in 2015.8.5, so I don't think they are the same issue."},"comment":{"url":"https://api.github.com/repos/saltstack/salt/issues/comments/188629834","html_url":"https://github.com/saltstack/salt/issues/31293#issuecomment-188629834","issue_url":"https://api.github.com/repos/saltstack/salt/issues/31293","id":188629834,"user":{"login":"terminalmage","id":328598,"avatar_url":"https://avatars.githubusercontent.com/u/328598?v=3","gravatar_id":"","url":"https://api.github.com/users/terminalmage","html_url":"https://github.com/terminalmage","followers_url":"https://api.github.com/users/terminalmage/followers","following_url":"https://api.github.com/users/terminalmage/following{/other_user}","gists_url":"https://api.github.com/users/terminalmage/gists{/gist_id}","starred_url":"https://api.github.com/users/terminalmage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/terminalmage/subscriptions","organizations_url":"https://api.github.com/users/terminalmage/orgs","repos_url":"https://api.github.com/users/terminalmage/repos","events_url":"https://api.github.com/users/terminalmage/events{/privacy}","received_events_url":"https://api.github.com/users/terminalmage/received_events","type":"User","site_admin":false},"created_at":"2016-02-25T06:04:54Z","updated_at":"2016-02-25T06:04:54Z","body":"No problem! Thanks for helping to troubleshoot this. I did not account for this since my testing was only with a few minions, not enough to trigger this race condition.\r\n\r\nWhile I'm at it, I'm also making the functions which perform a checkout smarter. If HEAD currently points where the desired branch/tag points, then no checkout will be done. This should drastically reduce the number of checkouts performed and make the race condition very unlikely. That, coupled with the locking, should take care of this issue altogether."}}