Jenkins Scan bitbucket project

Hi,

does anyone experienced timeout in projects scan using Jenkins and Bitbucket Server?

In our setup on AKS from time to time we receive:

[Tue Aug 06 17:41:20 UTC 2024] Finished organization scan. Scan took 13 sec
FATAL: Failed to recompute children of XXX
java.net.SocketTimeoutException: Connect timed out
	at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(Unknown Source)
	at java.base/sun.nio.ch.NioSocketImpl.connect(Unknown Source)
	at java.base/java.net.SocksSocketImpl.connect(Unknown Source)
	at java.base/java.net.Socket.connect(Unknown Source)
	at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:368)
	at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142)
Caused: org.apache.http.conn.ConnectTimeoutException: Connect to XXXXXX:443 [XXXXX/1.2.3.4] failed: Connect timed out
	at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:151)
	at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:376)
	at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:393)
	at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
	at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)
	at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
	at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
	at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
	at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.executeMethodNoRetry(BitbucketServerAPIClient.java:1336)
	at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.executeMethod(BitbucketServerAPIClient.java:1309)
	at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getRequest(BitbucketServerAPIClient.java:963)
Caused: java.io.IOException: Communication error for request: GET https://XXXXXXXXXXXrest/api/1.0/projects/XXXX/repos/XXXXX/pull-requests?start=0&limit=200 HTTP/1.1
	at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getRequest(BitbucketServerAPIClient.java:993)
	at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getRequest(BitbucketServerAPIClient.java:953)
	at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getResources(BitbucketServerAPIClient.java:901)
	at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getPullRequests(BitbucketServerAPIClient.java:293)
	at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getPullRequests(BitbucketServerAPIClient.java:264)
	at com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource$1.create(BitbucketSCMSource.java:597)
	at com.cloudbees.jenkins.plugins.bitbucket.LazyIterable.iterator(LazyIterable.java:57)
	at com.cloudbees.jenkins.plugins.bitbucket.BranchDiscoveryTrait$ExcludeOriginPRBranchesSCMHeadFilter.isExcluded(BranchDiscoveryTrait.java:244)
	at jenkins.scm.api.trait.SCMSourceRequest.isExcluded(SCMSourceRequest.java:196)
	at jenkins.scm.api.trait.SCMSourceRequest.process(SCMSourceRequest.java:333)
	at com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource.retrieveBranches(BitbucketSCMSource.java:792)
	at com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource.retrieve(BitbucketSCMSource.java:632)
	at jenkins.scm.api.SCMSource._retrieve(SCMSource.java:372)
	at jenkins.scm.api.SCMSource.fetch(SCMSource.java:326)
	at jenkins.branch.MultiBranchProjectFactory$BySCMSourceCriteria.recognizes(MultiBranchProjectFactory.java:262)
	at jenkins.branch.OrganizationFolder$SCMSourceObserverImpl$1.recognizes(OrganizationFolder.java:1356)
	at jenkins.branch.OrganizationFolder$SCMSourceObserverImpl$1.complete(OrganizationFolder.java:1371)
	at jenkins.scm.api.trait.SCMNavigatorRequest.process(SCMNavigatorRequest.java:252)
	at jenkins.scm.api.trait.SCMNavigatorRequest.process(SCMNavigatorRequest.java:202)
	at com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMNavigator.visitSources(BitbucketSCMNavigator.java:529)
	at jenkins.branch.OrganizationFolder.computeChildren(OrganizationFolder.java:530)
	at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:269)
	at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:167)
	at jenkins.branch.OrganizationFolder$OrganizationScan.run(OrganizationFolder.java:915)
	at hudson.model.ResourceController.execute(ResourceController.java:101)
	at hudson.model.Executor.run(Executor.java:442)

Do you have any suggestion on how to investigate or resolve it?

Check the logs of the Bitbucket server to see if it is running out of resources. If there is a reverse proxy in front of the Bitbucket server, check the logs of the reverse proxy.