"Unexpected end-of-stream reading tree for [<commit-id>]" while accessing a repository on Bitbucket Server

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問


プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Fisheye および Crucible は除く

要約

During migration of all the repositories to Git and Bitbucket, Bitbucket shows the following error, while navigating to one specific folder in one of the repositories:

"An error occurred while executing an external process: Unexpected end-of-stream reading tree for [<commit-hash-ID>]"

環境

Bitbucket version: 7.6/7.7

Git version: 2.23.0/2.29.2

Operating system: Windows Server 2016

診断

  • No issue when working with the repository with a Git client like clone or checkout.
  • No issues when checking the repository with 'git fsck --strict'.
  • This issue is only observed on the Bitbucket user interface and not on Git command line.

Log analysis

atlassian-bitbucket.log
ERROR [http-nio-80-exec-2] "GET /projects/<PROJECT-KEY>/repos/<REPOSITORY-SLUG>/browse/src/<REPOSITORY> HTTP/1.1" c.a.s.i.w.HandlerExceptionResolverImpl An error occurred while executing an external process: Unexpected end-of-stream reading tree for [<commit-hash-ID>]
com.atlassian.bitbucket.ServerException: An error occurred while executing an external process: Unexpected end-of-stream reading tree for [<commit-hash-ID>]
	at com.atlassian.bitbucket.scm.git.command.GitCommandExitHandler.evaluateThrowable(GitCommandExitHandler.java:120)
	at com.atlassian.bitbucket.scm.git.command.GitCommandExitHandler.onError(GitCommandExitHandler.java:208)
	at com.atlassian.bitbucket.scm.DefaultCommandExitHandler.onExit(DefaultCommandExitHandler.java:32)
	at com.atlassian.bitbucket.internal.process.nu.NioNuProcessHandler.callExitHandler(NioNuProcessHandler.java:285)
	at com.atlassian.bitbucket.internal.process.nu.NioNuProcessHandler.finish(NioNuProcessHandler.java:326)
	at com.atlassian.bitbucket.internal.process.nu.NioNuProcessHandler.onExit(NioNuProcessHandler.java:123)
	at com.zaxxer.nuprocess.windows.WindowsProcess.onExit(WindowsProcess.java:485)
	at com.zaxxer.nuprocess.windows.ProcessCompletions.cleanupProcess(ProcessCompletions.java:361)
	at com.zaxxer.nuprocess.windows.ProcessCompletions.process(ProcessCompletions.java:187)
	at com.zaxxer.nuprocess.windows.ProcessCompletions.run(ProcessCompletions.java:120)
	at com.zaxxer.nuprocess.windows.WindowsProcess.run(WindowsProcess.java:279)
	at com.zaxxer.nuprocess.windows.WinProcessFactory.runProcess(WinProcessFactory.java:51)
	at com.zaxxer.nuprocess.NuProcessBuilder.run(NuProcessBuilder.java:273)
	at com.atlassian.bitbucket.internal.process.nu.NuNioProcessHelper.run(NuNioProcessHelper.java:75)
	at com.atlassian.bitbucket.internal.process.NioCommand.call(NioCommand.java:52)
	at com.atlassian.stash.internal.content.DefaultContentService.streamDirectory(DefaultContentService.java:222)
	at com.atlassian.stash.internal.web.repos.RepositoryController.handleDirectory(RepositoryController.java:522)
	at com.atlassian.stash.internal.web.repos.RepositoryController.browseFilePath(RepositoryController.java:345)
	at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24)
	at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24)
	at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24)
	at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24)
	at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24)
	at com.atlassian.bitbucket.internal.importer.web.RepositoryImportFilter.doFilter(RepositoryImportFilter.java:64)
	at com.atlassian.stash.internal.spring.lifecycle.LifecycleJohnsonServletFilterModuleContainerFilter.doFilter(LifecycleJohnsonServletFilterModuleContainerFilter.java:42)
	at com.atlassian.bitbucket.internal.ratelimit.servlet.filter.RateLimitFilter.doFilter(RateLimitFilter.java:75)
	at com.atlassian.stash.internal.spring.lifecycle.LifecycleJohnsonServletFilterModuleContainerFilter.doFilter(LifecycleJohnsonServletFilterModuleContainerFilter.java:42)
	at com.atlassian.stash.internal.web.auth.AuthorizationFailureInterceptor.doFilterInternal(AuthorizationFailureInterceptor.java:39)
	at com.atlassian.stash.internal.spring.security.StashAuthenticationFilter.doFilter(StashAuthenticationFilter.java:85)
	at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doInsideSpringSecurityChain(BeforeLoginPluginAuthenticationFilter.java:112)
	at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doFilter(BeforeLoginPluginAuthenticationFilter.java:75)
	at com.atlassian.security.auth.trustedapps.filter.TrustedApplicationsFilter.doFilter(TrustedApplicationsFilter.java:94)
	at com.atlassian.oauth.serviceprovider.internal.servlet.OAuthFilter.doFilter(OAuthFilter.java:67)
	at com.atlassian.stash.internal.spring.lifecycle.LifecycleJohnsonServletFilterModuleContainerFilter.doFilter(LifecycleJohnsonServletFilterModuleContainerFilter.java:42)
	at com.atlassian.stash.internal.spring.lifecycle.LifecycleJohnsonServletFilterModuleContainerFilter.doFilter(LifecycleJohnsonServletFilterModuleContainerFilter.java:42)
	at com.atlassian.security.auth.trustedapps.filter.TrustedApplicationsFilter.doFilter(TrustedApplicationsFilter.java:94)
	at com.atlassian.oauth.serviceprovider.internal.servlet.OAuthFilter.doFilter(OAuthFilter.java:67)
	at com.atlassian.stash.internal.spring.lifecycle.LifecycleJohnsonServletFilterModuleContainerFilter.doFilter(LifecycleJohnsonServletFilterModuleContainerFilter.java:42)
	at com.atlassian.plugin.connect.plugin.auth.oauth2.DefaultSalAuthenticationFilter.doFilter(DefaultSalAuthenticationFilter.java:69)
	at com.atlassian.plugin.connect.plugin.auth.user.ThreeLeggedAuthFilter.doFilter(ThreeLeggedAuthFilter.java:109)
	at com.atlassian.jwt.internal.servlet.JwtAuthFilter.doFilter(JwtAuthFilter.java:37)
	at com.atlassian.analytics.client.filter.DefaultAnalyticsFilter.doFilter(DefaultAnalyticsFilter.java:26)
	at com.atlassian.analytics.client.filter.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:48)
	at com.atlassian.stash.internal.spring.lifecycle.LifecycleJohnsonServletFilterModuleContainerFilter.doFilter(LifecycleJohnsonServletFilterModuleContainerFilter.java:42)
	at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doBeforeBeforeLoginFilters(BeforeLoginPluginAuthenticationFilter.java:90)
	at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doFilter(BeforeLoginPluginAuthenticationFilter.java:73)
	at com.atlassian.stash.internal.request.DefaultRequestManager.doAsRequest(DefaultRequestManager.java:84)
	at com.atlassian.stash.internal.hazelcast.ConfigurableWebFilter.doFilter(ConfigurableWebFilter.java:38)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.lang.Thread.run(Thread.java:748)
	... 322 frames trimmed
	Suppressed: com.atlassian.bitbucket.ServerException: An error occurred while executing an external process: Unexpected end-of-stream reading tree for [<commit-hash-ID>]
		at com.atlassian.bitbucket.scm.git.command.GitCommandExitHandler.evaluateThrowable(GitCommandExitHandler.java:120)
		at com.atlassian.bitbucket.scm.git.command.GitCommandExitHandler.onError(GitCommandExitHandler.java:208)
		at com.atlassian.bitbucket.scm.DefaultCommandExitHandler.onExit(DefaultCommandExitHandler.java:32)
		at com.atlassian.bitbucket.internal.process.nu.NioNuProcessHandler.callExitHandler(NioNuProcessHandler.java:285)
		at com.atlassian.bitbucket.internal.process.nu.NioNuProcessHandler.finish(NioNuProcessHandler.java:326)
		at com.atlassian.bitbucket.internal.process.nu.NioNuProcessHandler.onExit(NioNuProcessHandler.java:123)
		at com.atlassian.bitbucket.internal.process.nu.LatchedNioNuProcessHandler.onExit(LatchedNioNuProcessHandler.java:38)
		at com.zaxxer.nuprocess.windows.WindowsProcess.onExit(WindowsProcess.java:485)
		at com.zaxxer.nuprocess.windows.ProcessCompletions.cleanupProcess(ProcessCompletions.java:361)
		at com.zaxxer.nuprocess.windows.ProcessCompletions.process(ProcessCompletions.java:187)
		at com.zaxxer.nuprocess.windows.ProcessCompletions.run(ProcessCompletions.java:120)
		at com.zaxxer.nuprocess.windows.WindowsProcess.run(WindowsProcess.java:279)
		at com.zaxxer.nuprocess.windows.WinProcessFactory.runProcess(WinProcessFactory.java:51)
		at com.zaxxer.nuprocess.NuProcessBuilder.run(NuProcessBuilder.java:273)
		at com.atlassian.stash.internal.concurrent.StateTransferringRunnable.run(StateTransferringRunnable.java:50)
		... 3 common frames omitted
	Caused by: java.lang.IllegalStateException: Unexpected end-of-stream reading tree for [<commit-hash-ID>]
		at com.atlassian.stash.internal.scm.git.command.lstree.DirectoryCollapsingContentTreeCallback$DirectoryCollapsingBatchCatFileStdioHandler.onContent(DirectoryCollapsingContentTreeCallback.java:262)
		at com.atlassian.stash.internal.scm.git.command.catfile.AbstractBatchCatFileStdioHandler.handleContent(AbstractBatchCatFileStdioHandler.java:209)
		at com.atlassian.stash.internal.scm.git.command.catfile.AbstractBatchCatFileStdioHandler.onStdout(AbstractBatchCatFileStdioHandler.java:76)
		at com.atlassian.bitbucket.internal.process.nu.NioNuProcessHandler.lambda$handleOutput$3(NioNuProcessHandler.java:363)
		at com.atlassian.bitbucket.internal.process.nu.NioNuProcessHandler.lambda$invokeCallback$4(NioNuProcessHandler.java:371)
		at com.atlassian.bitbucket.internal.process.nu.NioNuProcessHandler.invokeCallback(NioNuProcessHandler.java:379)
		at com.atlassian.bitbucket.internal.process.nu.NioNuProcessHandler.invokeCallback(NioNuProcessHandler.java:370)
		at com.atlassian.bitbucket.internal.process.nu.NioNuProcessHandler.handleOutput(NioNuProcessHandler.java:357)
		at com.atlassian.bitbucket.internal.process.nu.NioNuProcessHandler.onStdout(NioNuProcessHandler.java:183)
		at com.zaxxer.nuprocess.windows.WindowsProcess.readStdout(WindowsProcess.java:351)
		at com.zaxxer.nuprocess.windows.ProcessCompletions.process(ProcessCompletions.java:164)
		... 8 common frames omitted
Caused by: java.lang.IllegalStateException: Unexpected end-of-stream reading tree for [<commit-hash-ID>]
	at com.atlassian.stash.internal.scm.git.command.lstree.DirectoryCollapsingContentTreeCallback$DirectoryCollapsingBatchCatFileStdioHandler.onContent(DirectoryCollapsingContentTreeCallback.java:262)
	at com.atlassian.stash.internal.scm.git.command.catfile.AbstractBatchCatFileStdioHandler.handleContent(AbstractBatchCatFileStdioHandler.java:209)
	at com.atlassian.stash.internal.scm.git.command.catfile.AbstractBatchCatFileStdioHandler.onStdout(AbstractBatchCatFileStdioHandler.java:76)
	at com.atlassian.bitbucket.internal.process.nu.NioNuProcessHandler.lambda$handleOutput$3(NioNuProcessHandler.java:363)
	at com.atlassian.bitbucket.internal.process.nu.NioNuProcessHandler.lambda$invokeCallback$4(NioNuProcessHandler.java:371)
	at com.atlassian.bitbucket.internal.process.nu.NioNuProcessHandler.invokeCallback(NioNuProcessHandler.java:379)
	at com.atlassian.bitbucket.internal.process.nu.NioNuProcessHandler.invokeCallback(NioNuProcessHandler.java:370)
	at com.atlassian.bitbucket.internal.process.nu.NioNuProcessHandler.handleOutput(NioNuProcessHandler.java:357)
	at com.atlassian.bitbucket.internal.process.nu.NioNuProcessHandler.onStdout(NioNuProcessHandler.java:183)
	at com.zaxxer.nuprocess.windows.WindowsProcess.readStdout(WindowsProcess.java:351)
	at com.zaxxer.nuprocess.windows.ProcessCompletions.process(ProcessCompletions.java:164)
	at com.zaxxer.nuprocess.windows.ProcessCompletions.run(ProcessCompletions.java:120)
	at com.zaxxer.nuprocess.windows.WindowsProcess.run(WindowsProcess.java:279)
	at com.zaxxer.nuprocess.windows.WinProcessFactory.runProcess(WinProcessFactory.java:51)
	at com.zaxxer.nuprocess.NuProcessBuilder.run(NuProcessBuilder.java:273)
	at com.atlassian.stash.internal.concurrent.StateTransferringRunnable.run(StateTransferringRunnable.java:50)
	... 3 common frames omitted
atlassian-profiler.log
2020-11-12 11:13:21,304 | http-nio-80-exec-2 | @1F77Y0Nx673x2466757x1 | <username> | 12tlrup
[459.8ms] - "GET /projects/<PROJECT-KEY>/repos/<REPOSITORY-SLUG>/browse/src/<REPOSITORY> HTTP/1.1"
 [1.7ms] - Branch com.atlassian.bitbucket.repository.RefService.getDefaultBranch(Repository)
 [43.9ms] - Type com.atlassian.bitbucket.content.ContentService.getType(Repository,String,String)
  [43.8ms] - nio: C:\Program Files\Git\cmd\git.exe ls-tree -z refs/heads/master:src -- <REPOSITORY>
 [341.3ms] - void com.atlassian.bitbucket.content.ContentService.streamDirectory(Repository,String,String,boolean,ContentTreeCallback,PageRequest)
  [340.9ms] - nio: C:\Program Files\Git\cmd\git.exe ls-tree -z -l refs/heads/master:src/<REPOSITORY> --
 [59.7ms] - Render soy: bitbucket.internal.page.errors.errors.error500
  [1.4ms] - Optional com.atlassian.bitbucket.dmz.admin.banner.DmzAnnouncementBannerService.getActiveBanner()
   [1.4ms] - InternalAnnouncementBanner com.atlassian.stash.internal.banner.AnnouncementBannerDao.findEnabledByAudience(AnnouncementBannerAudience)
  [10.4ms] - void com.atlassian.plugin.webresource.WebResourceManager.includeResources(Writer,UrlMode)
   [2.8ms] [count: 2, avg: 1.4ms] - UserSettings com.atlassian.sal.api.usersettings.UserSettingsService.getUserSettings(UserKey)
atlassian-bitbucket-access.log
192.168.108.162,10.168.41.154 | https | i@1F77Y0Nx673x2466757x1 | - | 2020-11-12 11:13:20,850 | "GET /projects/<PROJECT-KEY>/repos/<REPOSITORY-SLUG>/browse/src/<REPOSITORY> HTTP/1.1" | "https://git.anton-paar.com/projects/<PROJECT-KEY>" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36" | - | - | - | - | - | 12tlrup | 
192.168.108.162,10.168.41.154 | https | o@1F77Y0Nx673x2466757x1 | <username> | 2020-11-12 11:13:21,304 | "GET /projects/<PROJECT-KEY>/repos/<REPOSITORY-SLUG>/browse/src/<REPOSITORY> HTTP/1.1" | "https://git.anton-paar.com/projects/<PROJECT-KEY>" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36" | 500 | 0 | 13473 | - | 460 | 12tlrup |

Findings from the HAR file:

HAR file contents for this URL
URL: <Bitbucket-Base-URL>/rest/api/latest/projects/<PROJECT-KEY>/repos/<REPOSITORY-SLUG>/browse/src/<REPOSITORY>?limit=1000	
RESPONSE:
{"errors":[{"context":null,"message":"An error occurred while executing an external process: Unexpected
 end-of-stream reading tree for [<commit-hash-ID>]","exceptionName":"com.atlassian
.bitbucket.ServerException"}]}

URL:<Bitbucket-Base-URL>/rest/api/latest/projects/<PROJECT-KEY>/repos/<REPOSITORY-SLUG>/browse/src/<REPOSITORY>?at=3c5cc1e4cd3035048226bae66638bdeb7c4995ac&limit=1000	
RESPONSE:
{"errors":[{"context":null,"message":"An error occurred while executing an external process: Unexpected
 end-of-stream reading tree for [<commit-hash-ID>]","exceptionName":"com.atlassian
.bitbucket.ServerException"}]}

原因

The cause of this issue could be because the repository having empty directory which was a PlasticSCM repository originally.

  • PlasticSCM supports empty directories
  • The repository was migrated to Git and pushed to Bitbucket Server
  • Bitbucket Server encountered the empty directory in the repository and as it was unexpected threw the below error:
"An error occurred while executing an external process: Unexpected end-of-stream reading tree for [<commit-hash-ID>]"

回避策

  • Bitbucket Server does not have functionality to fix this
  • This is not a bug within Bitbucket Server
  • It is not likely that code will be added to Bitbucket Server to handle empty directories since Bitbucket Server was built to work with Git repository and Git, unlike PlasticSCM, does not index empty directories.

A possible workaround would be to:

  • Add content to the directory, create a commit and push to Bitbucket Server. Bitbucket Server should allow you to navigate to the directory at that new commit since it will no longer have the empty sha that will illicit this error
  • Rewrite history so the commit that added the empty directory is removed

If neither option is within the scope of your abilities the best strategy would be to retain the services of an Atlassian Partner and go over this issue with them so they can walk you through how to get all of the tree objects in the repo to a good state that will work with Bitbucket Server.



最終更新日 2023 年 11 月 8 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.