Issue Summary
This is reproducible on Data Center: yes
Steps to Reproduce
- Attempt to download an LFS object which does not exist from a mirror. For example make a request on {/rest/git-lfs/storage/MYPROJECT/myrepo/6fe6940562c9665302a2cb3f401d7fcc8144eb32ae58790ceb1bd3c6346e5594}
- Inspect HTTP status code
Expected Results
The HTTP status code should be 404
Actual Results
HTTP status code is 500. Although the response body does include the response from the upstream that suggests the mirror wasn't able to download it because it does not exist:
{
"message": "Response [{\"objects\":[{\"oid\":\"6fe6940562c9665302a2cb3f401d7fcc8144eb32ae58790ceb1bd3c6346e5594\",\"size\":0,\"error\":{\"message\":\"Object does not exist on the server\",\"code\":404}}]}] contains error action"
}
If you inspect the atlassian-bitbucket.log on the mirror the following is also logged:
2023-09-06 01:56:06,133 ERROR [http-nio-7990-exec-157] example-stash-bot *89EQ3Ex116x22885696x1 oldhsp 11.22.33.44,55.66.77.88 "GET /rest/git-lfs/storage/MYPROJECT/myrepo/6fe6940562
c9665302a2cb3f401d7fcc8144eb32ae58790ceb1bd3c6346e5594 HTTP/1.1" c.a.b.i.s.g.lfs.http.LfsHttpScmUtils Un-mapped exception
java.lang.RuntimeException: Response [{"objects":[{"oid":"6fe6940562c9665302a2cb3f401d7fcc8144eb32ae58790ceb1bd3c6346e5594","size":0,"error":{"message":"Object does not exist on the server"
,"code":404}}]}] contains error action
at com.atlassian.bitbucket.internal.scm.git.lfs.mirror.DefaultUpstreamLfsClient.parseDownloadAction(DefaultUpstreamLfsClient.java:208)
at com.atlassian.bitbucket.internal.scm.git.lfs.mirror.DefaultUpstreamLfsClient.getDownloadAction(DefaultUpstreamLfsClient.java:386)
at com.atlassian.bitbucket.internal.scm.git.lfs.mirror.DefaultUpstreamLfsClient.requestObject(DefaultUpstreamLfsClient.java:170)
at com.atlassian.bitbucket.internal.scm.git.lfs.mirror.LfsContentProvider.apply(LfsContentProvider.java:23)
at com.atlassian.util.contentcache.internal.AbstractCacheEntry$BaseAccess.streamToCache(AbstractCacheEntry.java:362)
at com.atlassian.util.contentcache.internal.AbstractCacheEntry$CacheEntryAccess.stream(AbstractCacheEntry.java:452)
at com.atlassian.bitbucket.internal.scm.git.lfs.mirror.MirrorEmbeddedStoreService$CachedObjectStreamingOutput.write(MirrorEmbeddedStoreService.java:104)
Given this is essentially a user error and not a system error nothing should be logged, or perhaps a debug level event only.
Workaround
Currently there is no known workaround for this behavior. A workaround will be added here when available