forked from ManageIQ/manageiq
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Kill workers that don't stop after a configurable time
Previously, we'd gracefully ask them to exit and if the queue work they're doing, takes 1 hour to do, they'd exceed memory thresholds, keep running until the work is done and finally respond to the exit request. Now, we mark them as 'stopping' when they exceed a threshold and they have up to 10 minutes to finish before we'd kill them. This value is configurable in the 'stopping_timeout' field in each worker's advanced settings. https://bugzilla.redhat.com/show_bug.cgi?id=1395736
- Loading branch information
Showing
5 changed files
with
71 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
describe MiqServer::WorkerManagement::Monitor do | ||
context "#check_not_responding" do | ||
let(:server) { EvmSpecHelper.local_miq_server } | ||
let(:worker) do | ||
FactoryGirl.create(:miq_worker, | ||
:type => "MiqGenericWorker", | ||
:miq_server => server, | ||
:pid => 12345, | ||
:last_heartbeat => 5.minutes.ago) | ||
end | ||
|
||
before do | ||
server.setup_drb_variables | ||
server.worker_add(worker.pid) | ||
end | ||
|
||
it "destroys an unresponsive 'stopping' worker" do | ||
worker.update(:last_heartbeat => 20.minutes.ago) | ||
server.stop_worker(worker) | ||
server.check_not_responding | ||
server.reload | ||
expect(server.miq_workers).to be_empty | ||
expect { worker.reload }.to raise_error(ActiveRecord::RecordNotFound) | ||
end | ||
|
||
it "monitors recently heartbeated 'stopping' workers" do | ||
worker.update(:last_heartbeat => 1.minute.ago) | ||
server.stop_worker(worker) | ||
server.check_not_responding | ||
server.reload | ||
expect(server.miq_workers.first.id).to eq(worker.id) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters