Can you confirm for which version of 7.x this code worked? As far as I can see all requests through RepositoryBuildStatusService#search, regardless of which method overload is used, pass through this validation requiring REPO_READ permissions:
Could it be possible that you were previously using LegacyBuildStatusService#findAll, as this method for searching for builds only required Permission.LICENSED_USER, as these older builds were not scoped to a repository.
I’m trying to follow this instruction to setup Bitbucket Mesh. But the link for Bitbucket Mesh leads to Bitbucket 8.0.0 eap05 and when I download and unpack it, it doesn’t have
Neither does it contain MESH_HOME variable (I’m running recursive ‘grep’ through the <installation-directory>). How can I setup Mesh to make sure our app works with it correctly?
I’d also like to report an issue: we’re using GitCommandBuilderFactory to run a lot of Git commands pretty often, we implement our own CommandExitHandler but often (though not predictably) CommandExitHandler#onExit is executed with exitCode=-1001 and the following throwable:
UNKNOWN io.grpc.StatusRuntimeException: UNKNOWN
at io.grpc.Status.asRuntimeException(Status.java:535)
at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:479)
at io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39)
at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23)
at io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40)
at com.atlassian.stash.internal.scm.git.mesh.LastSeenClientInterceptor$LastSeenClientListener.onClose(LastSeenClientInterceptor.java:40)
at io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39)
at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23)
at io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40)
at com.atlassian.stash.internal.scm.git.mesh.StatefulClientCallListener.onClose(StatefulClientCallListener.java:34)
at io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39)
at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23)
at io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40)
at com.atlassian.stash.internal.scm.git.mesh.DeadlinePropagatingClientInterceptor$DeadlinePropagatingListener.onClose(DeadlinePropagatingClientInterceptor.java:156)
at com.atlassian.stash.internal.scm.git.mesh.ErrorHandlingClientInterceptor$ErrorHandlingCall$1.onClose(ErrorHandlingClientInterceptor.java:136)
at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:562)
at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:70)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:743)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:722)
at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
I would note that this happens more often when we run more Git commands. The main log has a corresponding exception:
2022-05-10 21:15:01,754 WARN [mesh-grpc-request:thread-79] c.a.s.i.s.g.m.DefaultMeshSidebandRegistry sidecar (http://localhost:7777): Reopening sideband channel failed
io.grpc.StatusRuntimeException: UNKNOWN: Uncaught exception in the SynchronizationContext. Re-thrown.
at io.grpc.Status.asRuntimeException(Status.java:526)
at io.grpc.internal.RetriableStream$1.uncaughtException(RetriableStream.java:75)
at io.grpc.SynchronizationContext.drain(SynchronizationContext.java:97)
at io.grpc.SynchronizationContext.execute(SynchronizationContext.java:127)
at io.grpc.internal.RetriableStream.drain(RetriableStream.java:328)
at io.grpc.internal.RetriableStream.start(RetriableStream.java:387)
at io.grpc.internal.ClientCallImpl.startInternal(ClientCallImpl.java:289)
at io.grpc.internal.ClientCallImpl.start(ClientCallImpl.java:191)
at com.atlassian.stash.internal.scm.git.mesh.ErrorHandlingClientInterceptor$ErrorHandlingCall.start(ErrorHandlingClientInterceptor.java:122)
at io.grpc.ForwardingClientCall.start(ForwardingClientCall.java:32)
at com.atlassian.stash.internal.scm.git.mesh.MetadataClientInterceptor$1.start(MetadataClientInterceptor.java:43)
at com.atlassian.stash.internal.scm.git.mesh.StateTransferringClientInterceptor$1.start(StateTransferringClientInterceptor.java:36)
at com.atlassian.stash.internal.scm.git.mesh.LastSeenClientInterceptor$1.start(LastSeenClientInterceptor.java:23)
at io.grpc.stub.ClientCalls.startCall(ClientCalls.java:332)
at io.grpc.stub.ClientCalls.asyncStreamingRequestCall(ClientCalls.java:323)
at io.grpc.stub.ClientCalls.asyncBidiStreamingCall(ClientCalls.java:111)
at com.atlassian.bitbucket.mesh.rpc.v1.ManagementServiceGrpc$ManagementServiceStub.sideband(ManagementServiceGrpc.java:808)
at com.atlassian.stash.internal.scm.git.mesh.DefaultMeshSidebandRegistry$SidebandChannel.reopen(DefaultMeshSidebandRegistry.java:255)
at com.atlassian.stash.internal.scm.git.mesh.DefaultMeshSidebandRegistry$SidebandChannel.onCompleted(DefaultMeshSidebandRegistry.java:149)
at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:477)
at io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39)
at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23)
at io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40)
at com.atlassian.stash.internal.scm.git.mesh.LastSeenClientInterceptor$LastSeenClientListener.onClose(LastSeenClientInterceptor.java:40)
at io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39)
at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23)
at io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40)
at com.atlassian.stash.internal.scm.git.mesh.StatefulClientCallListener.onClose(StatefulClientCallListener.java:34)
at com.atlassian.stash.internal.scm.git.mesh.ErrorHandlingClientInterceptor$ErrorHandlingCall$1.onClose(ErrorHandlingClientInterceptor.java:136)
at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:562)
at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:70)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:743)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:722)
at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.lang.Thread.run(Thread.java:829)
... 1 frame trimmed
Caused by: java.util.concurrent.RejectedExecutionException: Task io.grpc.internal.SerializingExecutor@67c47830 rejected from java.util.concurrent.ThreadPoolExecutor@54917e81[Shutting down, pool size = 1, active threads = 1, queued tasks = 0, completed tasks = 2833]
at java.base/java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2055)
at java.base/java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:825)
at java.base/java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1355)
at io.grpc.internal.SerializingExecutor.schedule(SerializingExecutor.java:102)
at io.grpc.internal.SerializingExecutor.execute(SerializingExecutor.java:95)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.onReady(ClientCallImpl.java:793)
at io.grpc.internal.RetriableStream$3.run(RetriableStream.java:288)
at io.grpc.SynchronizationContext.drain(SynchronizationContext.java:95)
... 35 common frames omitted
This never happened with the previous Bitbucket versions. It seems like the thread pool is too small and the policy is to reject execution if there’re no free thread. Could this be fixed on Bitbucket side? Or is there an option for that?
Our app runs a lot of Git commands and sometimes we encounter into the following error:
2022-05-10 21:15:01,754 WARN [mesh-grpc-request:thread-79] c.a.s.i.s.g.m.DefaultMeshSidebandRegistry sidecar (http://localhost:7777): Reopening sideband channel failed
io.grpc.StatusRuntimeException: UNKNOWN: Uncaught exception in the SynchronizationContext. Re-thrown.
at io.grpc.Status.asRuntimeException(Status.java:526)
at io.grpc.internal.RetriableStream$1.uncaughtException(RetriableStream.java:75)
at io.grpc.SynchronizationContext.drain(SynchronizationContext.java:97)
at io.grpc.SynchronizationContext.execute(SynchronizationContext.java:127)
at io.grpc.internal.RetriableStream.drain(RetriableStream.java:328)
at io.grpc.internal.RetriableStream.start(RetriableStream.java:387)
at io.grpc.internal.ClientCallImpl.startInternal(ClientCallImpl.java:289)
at io.grpc.internal.ClientCallImpl.start(ClientCallImpl.java:191)
at com.atlassian.stash.internal.scm.git.mesh.ErrorHandlingClientInterceptor$ErrorHandlingCall.start(ErrorHandlingClientInterceptor.java:122)
at io.grpc.ForwardingClientCall.start(ForwardingClientCall.java:32)
at com.atlassian.stash.internal.scm.git.mesh.MetadataClientInterceptor$1.start(MetadataClientInterceptor.java:43)
at com.atlassian.stash.internal.scm.git.mesh.StateTransferringClientInterceptor$1.start(StateTransferringClientInterceptor.java:36)
at com.atlassian.stash.internal.scm.git.mesh.LastSeenClientInterceptor$1.start(LastSeenClientInterceptor.java:23)
at io.grpc.stub.ClientCalls.startCall(ClientCalls.java:332)
at io.grpc.stub.ClientCalls.asyncStreamingRequestCall(ClientCalls.java:323)
at io.grpc.stub.ClientCalls.asyncBidiStreamingCall(ClientCalls.java:111)
at com.atlassian.bitbucket.mesh.rpc.v1.ManagementServiceGrpc$ManagementServiceStub.sideband(ManagementServiceGrpc.java:808)
at com.atlassian.stash.internal.scm.git.mesh.DefaultMeshSidebandRegistry$SidebandChannel.reopen(DefaultMeshSidebandRegistry.java:255)
at com.atlassian.stash.internal.scm.git.mesh.DefaultMeshSidebandRegistry$SidebandChannel.onCompleted(DefaultMeshSidebandRegistry.java:149)
at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:477)
at io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39)
at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23)
at io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40)
at com.atlassian.stash.internal.scm.git.mesh.LastSeenClientInterceptor$LastSeenClientListener.onClose(LastSeenClientInterceptor.java:40)
at io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39)
at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23)
at io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40)
at com.atlassian.stash.internal.scm.git.mesh.StatefulClientCallListener.onClose(StatefulClientCallListener.java:34)
at com.atlassian.stash.internal.scm.git.mesh.ErrorHandlingClientInterceptor$ErrorHandlingCall$1.onClose(ErrorHandlingClientInterceptor.java:136)
at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:562)
at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:70)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:743)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:722)
at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.lang.Thread.run(Thread.java:829)
... 1 frame trimmed
Caused by: java.util.concurrent.RejectedExecutionException: Task io.grpc.internal.SerializingExecutor@67c47830 rejected from java.util.concurrent.ThreadPoolExecutor@54917e81[Shutting down, pool size = 1, active threads = 1, queued tasks = 0, completed tasks = 2833]
at java.base/java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2055)
at java.base/java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:825)
at java.base/java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1355)
at io.grpc.internal.SerializingExecutor.schedule(SerializingExecutor.java:102)
at io.grpc.internal.SerializingExecutor.execute(SerializingExecutor.java:95)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.onReady(ClientCallImpl.java:793)
at io.grpc.internal.RetriableStream$3.run(RetriableStream.java:288)
at io.grpc.SynchronizationContext.drain(SynchronizationContext.java:95)
... 35 common frames omitted
It looks like the relevant thread pool becomes depleted and the policy is to reject execution of Git commands upon depletion. This never happened with older Bitbucket versions. Is there any way to solve that problem at Bitbucket level (maybe change the policy or make the thread pool grow)?
In case it’s helpful to anyone, we were able to use AbstractCommandInputOutputHandler, from the dependency @RomanStoffel mentioned (com.atlassian.bitbucket.server/bitbucket-scm-common) to replace CommandOutputHandler with very minimal effort. We simply override its latching functionality with our own process() method(s), and throw an UnsupportedOperationException for any that we don’t use.
There seem to be a number of regressions related to command handlers. Noting the following two issues we found, in case anyone else is running into them: