Skip to content

Commit 5a3258d

Browse files
Himani Anil Deshpandehimani2411
authored andcommitted
[DCV] Retry dcv-gl offline rpm installs to absorb rpm lock contention
The 'install dcv-gl dependencies offline' and 'install dcv-gl offline' execs sporadically failed with 'can't create transaction lock on /var/lib/rpm/.rpm.lock (Resource temporarily unavailable)' when a background dnf actor (dnf-makecache timer / PackageKit) held the rpm DB lock. Add retries 3 / retry_delay 5 (matching the sibling 'download dcv-gl dependencies' resource) so the install re-runs once the lock frees. Spec asserts the retry attributes and stubs the only_if dir guard.
1 parent 4fbcfe0 commit 5a3258d

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

cookbooks/aws-parallelcluster-platform/resources/dcv/partial/_rhel_common.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,16 @@ def install_dcv_gl
136136
execute 'install dcv-gl dependencies offline' do
137137
command "rpm -ivh #{dcv_gl_deps_dir}/*.rpm"
138138
only_if { ::Dir.exist?(dcv_gl_deps_dir) && !::Dir.empty?(dcv_gl_deps_dir) }
139+
retries 3
140+
retry_delay 5
139141
end
140142

141143
package = "#{node['cluster']['sources_dir']}/#{dcv_package}/#{dcv_gl}"
142144
# Install dcv-gl without repo access
143145
execute 'install dcv-gl offline' do
144146
command "rpm -ivh #{package}"
147+
retries 3
148+
retry_delay 5
145149
end
146150
end
147151
end

cookbooks/aws-parallelcluster-platform/spec/unit/resources/dcv_spec.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -849,6 +849,11 @@ def self.nothing(chef_run)
849849
allow_any_instance_of(Object).to receive(:arm_instance?).and_return(false)
850850
allow_any_instance_of(Object).to receive(:graphic_instance?).and_return(true)
851851
allow_any_instance_of(Object).to receive(:nvidia_installed?).and_return(true)
852+
dcv_gl_deps_dir = "#{sources_dir}/dcv-gl-deps"
853+
allow(::Dir).to receive(:exist?).and_call_original
854+
allow(::Dir).to receive(:empty?).and_call_original
855+
allow(::Dir).to receive(:exist?).with(dcv_gl_deps_dir).and_return(true)
856+
allow(::Dir).to receive(:empty?).with(dcv_gl_deps_dir).and_return(false)
852857
ConvergeDcv.configure(runner)
853858
end
854859
cached(:node) { chef_run.node }
@@ -868,8 +873,14 @@ def self.nothing(chef_run)
868873
is_expected.to run_execute('apt install dcv-gl')
869874
.with_command("apt -y install #{sources_dir}/#{dcv_package}/#{dcv_gl}")
870875
else
876+
is_expected.to run_execute('install dcv-gl dependencies offline')
877+
.with_command("rpm -ivh #{sources_dir}/dcv-gl-deps/*.rpm")
878+
.with_retries(3)
879+
.with_retry_delay(5)
871880
is_expected.to run_execute('install dcv-gl offline')
872881
.with_command("rpm -ivh #{sources_dir}/#{dcv_package}/#{dcv_gl}")
882+
.with_retries(3)
883+
.with_retry_delay(5)
873884
end
874885
end
875886

0 commit comments

Comments
 (0)