Skip to content

Commit 07aae13

Browse files
balasankarcRobert Marshall
authored andcommitted
Set max memory for node only on 32 bit OSs
Prevent out of memory errors when compiling node assets on 32-bit operating systems. Closes https://gitlab.com/gitlab-org/omnibus-gitlab/-/issues/8207 Signed-off-by: Balasankar "Balu" C <[email protected]>
1 parent b5be70d commit 07aae13

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

config/software/gitlab-rails.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,9 @@
158158
'PATH' => "#{install_dir}/embedded/bin:#{Gitlab::Util.get_env('PATH')}",
159159
'SKIP_STORAGE_VALIDATION' => 'true',
160160
'SKIP_DATABASE_CONFIG_VALIDATION' => 'true',
161-
'NODE_OPTIONS' => '--max_old_space_size=3584'
162161
}
162+
assets_compile_env['NODE_OPTIONS'] = '--max_old_space_size=3584' if OhaiHelper.is_32_bit?
163+
163164
assets_compile_env['NO_SOURCEMAPS'] = 'true' if Gitlab::Util.get_env('NO_SOURCEMAPS')
164165
command 'yarn install --pure-lockfile --production'
165166

lib/gitlab/ohai_helper.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,10 @@ def raspberry_pi?
180180
os_platform == 'raspbian'
181181
end
182182

183+
def is_32_bit?
184+
`getconf LONG_BIT`.strip == "32"
185+
end
186+
183187
def gcc_target
184188
ohai['languages']['c']['gcc']['target']
185189
end

0 commit comments

Comments
 (0)