Import error leads to empty repository and inconsistent cache
This somehow happened today for this user. Error 500 when going to the page after an unsuccessful Bitbucket import.
ZenDesk: https://gitlab.zendesk.com/agent/tickets/31053 Sentry: https://sentry.gitlap.com/gitlab/gitlabcom/issues/9558/
Since the import failed, the clone did not succeed. Somehow the cache showed that the repo existed:
irb(main):001:0> proj = Project.find_with_namespace('redacted_group/redacted_project')
irb(main):002:0> proj.import_error
=> "Error importing repository ssh://*****@bitbucket.org/redacted_group/redacted_project.git into redacted_group/redacted_project - 994408\nCloning into bare repository '/var/opt/gitlab/git-data/repositories/redacted_group/redacted_project.git'...\nCorrupted MAC on input.\r\nssh_dispatch_run_fatal: Connection to 104.192.143.2 port 22: message authentication code incorrect\r\nfatal: The remote end hung up unexpectedly\nfatal: early EOF\nfatal: index-pack failed\n"
irb(main):004:0> proj.repository.exists?
=> true
irb(main):005:0> proj.repository.expire_exists_cache
=> nil
irb(main):006:0> proj.repository.exists?
=> false
I didn't see any logs in Kibana that indicated this project was deleted and recreated.
The .git directory also did not exist, which is why expiring the exists?
cache worked.