Scan ran out of memory in Bitbucket pipeline on a file that only has a few line

  • ALM used: Bitbucket Cloud

  • CI system used: Bitbucket Cloud

  • Scanner command: Basic pipe in Bitbucket pipeline: sonarsource/sonarcloud-scan:1.4.0

  • Languages of the repository: Javascript

  • Error observed:
    We already bumped the pipeline step for Sonarcloud scan to 2X and 7000 docker memory. It still failed with exceeded memory error.

The log shows:


` docker container run \`

2

`   --volume=/opt/atlassian/pipelines/agent/build:/opt/atlassian/pipelines/agent/build \`

3

`   --volume=/opt/atlassian/pipelines/agent/ssh:/opt/atlassian/pipelines/agent/ssh:ro \`

4

`   --volume=/usr/local/bin/docker:/usr/local/bin/docker:ro \`

5

`   --volume=/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes:/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes \`

6

`   --volume=/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes/sonarsource/sonarcloud-scan:/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes/sonarsource/sonarcloud-scan \`

7

`   --workdir=$(pwd) \`

8

`   --label=org.bitbucket.pipelines.system=true \`

9

`   --env=BITBUCKET_STEP_TRIGGERER_UUID="$BITBUCKET_STEP_TRIGGERER_UUID" \`

10

`   --env=BITBUCKET_REPO_FULL_NAME="$BITBUCKET_REPO_FULL_NAME" \`

11

`   --env=BITBUCKET_GIT_HTTP_ORIGIN="$BITBUCKET_GIT_HTTP_ORIGIN" \`

12

`   --env=BITBUCKET_PROJECT_UUID="$BITBUCKET_PROJECT_UUID" \`

13

`   --env=BITBUCKET_REPO_IS_PRIVATE="$BITBUCKET_REPO_IS_PRIVATE" \`

14

`   --env=BITBUCKET_WORKSPACE="$BITBUCKET_WORKSPACE" \`

15

`   --env=BITBUCKET_SSH_KEY_FILE="$BITBUCKET_SSH_KEY_FILE" \`

16

`   --env=BITBUCKET_REPO_OWNER_UUID="$BITBUCKET_REPO_OWNER_UUID" \`

17

`   --env=BITBUCKET_BRANCH="$BITBUCKET_BRANCH" \`

18

`   --env=BITBUCKET_REPO_UUID="$BITBUCKET_REPO_UUID" \`

19

`   --env=BITBUCKET_PROJECT_KEY="$BITBUCKET_PROJECT_KEY" \`

20

`   --env=BITBUCKET_PARALLEL_STEP_COUNT="$BITBUCKET_PARALLEL_STEP_COUNT" \`

21

`   --env=BITBUCKET_REPO_SLUG="$BITBUCKET_REPO_SLUG" \`

22

`   --env=CI="$CI" \`

23

`   --env=BITBUCKET_REPO_OWNER="$BITBUCKET_REPO_OWNER" \`

24

`   --env=BITBUCKET_PARALLEL_STEP="$BITBUCKET_PARALLEL_STEP" \`

25

`   --env=BITBUCKET_STEP_RUN_NUMBER="$BITBUCKET_STEP_RUN_NUMBER" \`

26

`   --env=BITBUCKET_BUILD_NUMBER="$BITBUCKET_BUILD_NUMBER" \`

27

`   --env=BITBUCKET_GIT_SSH_ORIGIN="$BITBUCKET_GIT_SSH_ORIGIN" \`

28

`   --env=BITBUCKET_PIPELINE_UUID="$BITBUCKET_PIPELINE_UUID" \`

29

`   --env=BITBUCKET_COMMIT="$BITBUCKET_COMMIT" \`

30

`   --env=BITBUCKET_CLONE_DIR="$BITBUCKET_CLONE_DIR" \`

31

`   --env=PIPELINES_JWT_TOKEN="$PIPELINES_JWT_TOKEN" \`

32

`   --env=BITBUCKET_STEP_UUID="$BITBUCKET_STEP_UUID" \`

33

`   --env=BITBUCKET_DOCKER_HOST_INTERNAL="$BITBUCKET_DOCKER_HOST_INTERNAL" \`

34

`   --env=DOCKER_HOST="tcp://host.docker.internal:2375" \`

35

`   --env=BITBUCKET_PIPE_SHARED_STORAGE_DIR="/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes" \`

36

`   --env=BITBUCKET_PIPE_STORAGE_DIR="/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes/sonarsource/sonarcloud-scan" \`

37

`   --env=SONAR_TOKEN="${SONAR_TOKEN}" \`

38

`   --add-host="host.docker.internal:$BITBUCKET_DOCKER_HOST_INTERNAL" \`

39

`   sonarsource/sonarcloud-scan:1.4.0`

40

`Unable to find image 'sonarsource/sonarcloud-scan:1.4.0' locally`

41

`1.4.0: Pulling from sonarsource/sonarcloud-scan`

42

`743f2d6c1f65: Pulling fs layer`

43

`5c14188d0980: Pulling fs layer`

44

`84a54a21b0f2: Pulling fs layer`

45

`d9d1bc98b287: Pulling fs layer`

46

`c99e982badff: Pulling fs layer`

47

`50c6b4dfde57: Pulling fs layer`

48

`a561eaec2f8f: Pulling fs layer`

49

`ea88b09234a3: Pulling fs layer`

50

`83613aeae58d: Pulling fs layer`

51

`5d476eee175a: Pulling fs layer`

52

`3d3951d29cc9: Pulling fs layer`

53

`d9d1bc98b287: Waiting`

54

`c99e982badff: Waiting`

55

`50c6b4dfde57: Waiting`

56

`a561eaec2f8f: Waiting`

57

`ea88b09234a3: Waiting`

58

`83613aeae58d: Waiting`

59

`3d3951d29cc9: Waiting`

60

`5d476eee175a: Waiting`

61

`84a54a21b0f2: Verifying Checksum`

62

`84a54a21b0f2: Download complete`

63

`5c14188d0980: Download complete`

64

`d9d1bc98b287: Download complete`

65

`743f2d6c1f65: Verifying Checksum`

66

`743f2d6c1f65: Download complete`

67

`c99e982badff: Download complete`

68

`ea88b09234a3: Verifying Checksum`

69

`ea88b09234a3: Download complete`

70

`a561eaec2f8f: Verifying Checksum`

71

`a561eaec2f8f: Download complete`

72

`5d476eee175a: Verifying Checksum`

73

`5d476eee175a: Download complete`

74

`743f2d6c1f65: Pull complete`

75

`50c6b4dfde57: Verifying Checksum`

76

`50c6b4dfde57: Download complete`

77

`5c14188d0980: Pull complete`

78

`3d3951d29cc9: Download complete`

79

`84a54a21b0f2: Pull complete`

80

`83613aeae58d: Verifying Checksum`

81

`83613aeae58d: Download complete`

82

`d9d1bc98b287: Pull complete`

83

`c99e982badff: Pull complete`

84

`50c6b4dfde57: Pull complete`

85

`a561eaec2f8f: Pull complete`

86

`ea88b09234a3: Pull complete`

87

`83613aeae58d: Pull complete`

88

`5d476eee175a: Pull complete`

89

`3d3951d29cc9: Pull complete`

90

`Digest: sha256:8b3690666e34b17bbab84370e569151742f06f21575fbe05e5c066c160b7c968`

91

`Status: Downloaded newer image for sonarsource/sonarcloud-scan:1.4.0`

92

`INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties`

93

`INFO: Project root configuration file: NONE`

94

`INFO: SonarScanner 4.6.2.2472`

95

`INFO: Java 11.0.3 Oracle Corporation (64-bit)`

96

`INFO: Linux 5.15.0-1037-aws amd64`

97

`INFO: Bitbucket Cloud Pipelines detected, no host variable set. Defaulting to sonarcloud.io.`

98

`INFO: User cache: /root/.sonar/cache`

99

`INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties`

100

`INFO: Project root configuration file: NONE`

101

`INFO: Analyzing on SonarQube server 8.0.0.42876`

102

`INFO: Default locale: "en", source code encoding: "UTF-8" (analysis is platform dependent)`

103

`INFO: Load global settings`

104

`INFO: Load global settings (done) | time=541ms`

105

`INFO: Server id: 1BD809FA-AWHW8ct9-T_TB3XqouNu`

106

`INFO: User cache: /root/.sonar/cache`

107

`INFO: Load/download plugins`

108

`INFO: Load plugins index`

109

`INFO: Load plugins index (done) | time=524ms`

110

`INFO: Load/download plugins (done) | time=23206ms`

111

`INFO: Loaded core extensions: developer-scanner`

112

`INFO: Found an active CI vendor: 'Bitbucket Pipelines'`

113

`INFO: Detected project key 'rivaltech_distribution' from 'Bitbucket Cloud Pipelines'`

114

`INFO: Detected organization key 'rivaltech' from 'Bitbucket Cloud Pipelines'`

115

`INFO: Load project settings for component key: 'rivaltech_distribution'`

116

`INFO: Load project settings for component key: 'rivaltech_distribution' (done) | time=490ms`

117

`INFO: Process project properties`

118

`INFO: Execute project builders`

119

`INFO: Execute project builders (done) | time=2ms`

120

`INFO: Project key: rivaltech_distribution`

121

`INFO: Base dir: /opt/atlassian/pipelines/agent/build`

122

`INFO: Working dir: /opt/atlassian/pipelines/agent/build/.scannerwork`

123

`INFO: Load project branches`

124

`INFO: Load project branches (done) | time=492ms`

125

`INFO: Check ALM binding of project 'rivaltech_distribution'`

126

`INFO: Detected project binding: BOUND`

127

`INFO: Check ALM binding of project 'rivaltech_distribution' (done) | time=479ms`

128

`INFO: Load project pull requests`

129

`INFO: Load project pull requests (done) | time=519ms`

130

`INFO: Load branch configuration`

131

`INFO: Detected analysis for branch 'master'`

132

`INFO: Auto-configuring branch master`

133

`INFO: Load branch configuration (done) | time=3ms`

134

`INFO: Load quality profiles`

135

`INFO: Load quality profiles (done) | time=541ms`

136

`INFO: Load active rules`

137

`INFO: Load active rules (done) | time=5603ms`

138

`INFO: Organization key: rivaltech`

139

`INFO: Branch name: master, type: long-lived`

140

`INFO: Load project repositories`

141

`INFO: Load project repositories (done) | time=497ms`

142

`INFO: Indexing files...`

143

`INFO: Project configuration:`

144

`INFO:   Excluded sources: **/build-wrapper-dump.json, **/__tests__/**/*, **/__testutils__/**/*, **/__mocks__/**/*, template.yaml, **/tests/integration/**/*`

145

`INFO:   Excluded tests: **/__tests__/**/*, **/__testutils__/**/*, **/__mocks__/**/*`

146

`INFO:   Excluded sources for coverage: **/__tests__/**/*, **/__testutils__/**/*, **/__mocks__/**/*`

147

`INFO: 133 files indexed`

148

`INFO: 389 files ignored because of inclusion/exclusion patterns`

149

`INFO: 45906 files ignored because of scm ignore settings`

150

`INFO: Quality profile for js: Sonar way`

151

`INFO: Quality profile for json: SonarQube Way`

152

`INFO: Quality profile for yaml: Sonar way`

153

`INFO: ------------- Run sensors on module rivaltech_distribution`

154

`INFO: Load metrics repository`

155

`INFO: Load metrics repository (done) | time=488ms`

156

`INFO: Sensor cache enabled`

157

`INFO: Load sensor cache`

158

`INFO: Load sensor cache (608 KB) | time=1578ms`

159

`INFO: Sensor IaC CloudFormation Sensor [iac]`

160

`INFO: 0 source files to be analyzed`

161

`INFO: 0/0 source files have been analyzed`

162

`INFO: Sensor IaC CloudFormation Sensor [iac] (done) | time=89ms`

163

`INFO: Sensor IaC Kubernetes Sensor [iac]`

164

`INFO: 0 source files to be analyzed`

165

`INFO: 0/0 source files have been analyzed`

166

`INFO: Sensor IaC Kubernetes Sensor [iac] (done) | time=10ms`

167

`INFO: Sensor C# Project Type Information [csharp]`

168

`INFO: Sensor C# Project Type Information [csharp] (done) | time=1ms`

169

`INFO: Sensor C# Analysis Log [csharp]`

170

`INFO: Sensor C# Analysis Log [csharp] (done) | time=13ms`

171

`INFO: Sensor C# Properties [csharp]`

172

`INFO: Sensor C# Properties [csharp] (done) | time=0ms`

173

`INFO: Sensor HTML [web]`

174

`INFO: Sensor HTML [web] (done) | time=4ms`

175

`INFO: Sensor TextAndSecretsSensor [text]`

176

`INFO: 125 source files to be analyzed`

177

`INFO: 125/125 source files have been analyzed`

178

`INFO: Sensor TextAndSecretsSensor [text] (done) | time=440ms`

179

`INFO: Sensor VB.NET Project Type Information [vbnet]`

180

`INFO: Sensor VB.NET Project Type Information [vbnet] (done) | time=1ms`

181

`INFO: Sensor VB.NET Analysis Log [vbnet]`

182

`INFO: Sensor VB.NET Analysis Log [vbnet] (done) | time=13ms`

183

`INFO: Sensor VB.NET Properties [vbnet]`

184

`INFO: Sensor VB.NET Properties [vbnet] (done) | time=0ms`

185

`INFO: Sensor JaCoCo XML Report Importer [jacoco]`

186

`INFO: 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml`

187

`INFO: No report imported, no coverage information will be imported by JaCoCo XML Report Importer`

188

`INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=1ms`

189

`INFO: Sensor JavaScript/TypeScript analysis [javascript]`

190

`INFO: 97 source files to be analyzed`

191

`INFO: 3/97 files analyzed, current file: /opt/atlassian/pipelines/agent/build/src/controllers/invites.js`

192

`INFO: 7/97 files analyzed, current file: /opt/atlassian/pipelines/agent/build/src/functions/deliver.js`

193

`INFO: 24/97 files analyzed, current file: /opt/atlassian/pipelines/agent/build/src/functions/distribution-helper.js`

194

`INFO: 51/97 files analyzed, current file: /opt/atlassian/pipelines/agent/build/src/lambdas/process-event.js`

195

`INFO: 51/97 files analyzed, current file: /opt/atlassian/pipelines/agent/build/src/lambdas/process-event.js`

196

`INFO: 51/97 files analyzed, current file: /opt/atlassian/pipelines/agent/build/src/lambdas/process-event.js`

197

`INFO: 52/97 files analyzed, current file: /opt/atlassian/pipelines/agent/build/app-coverage.config.js`

198

`INFO: 52/97 files analyzed, current file: /opt/atlassian/pipelines/agent/build/app-coverage.config.js`

199

`INFO: 52/97 files analyzed, current file: /opt/atlassian/pipelines/agent/build/app-coverage.config.js`

200

`INFO: 52/97 files analyzed, current file: /opt/atlassian/pipelines/agent/build/app-coverage.config.js`

201

`INFO: 52/97 files analyzed, current file: /opt/atlassian/pipelines/agent/build/app-coverage.config.js`

202

`INFO: 52/97 files analyzed, current file: /opt/atlassian/pipelines/agent/build/app-coverage.config.js`

203

`time="2023-06-23T22:02:27Z" level=error msg="error waiting for container: unexpected EOF"`

This specific file that got stuck only has a few lines, so not sure why this ran out of memory:

/opt/atlassian/pipelines/agent/build/app-coverage.config.js

const config = {
  testRegex: 'app-jest.js',
  collectCoverage: true
}

module.exports = config

Hey there.

We’re aware of an ongoing issue with the performance of Javascript/Typescript Analysis. Take a look over here to find some details/a workaround.