Bug 833547

Summary: make agent shutdown timeout configurable
Product: [Other] RHQ Project Reporter: Charles Crouch <ccrouch>
Component: AgentAssignee: Josejulio Martínez <jmartine>
Status: POST --- QA Contact: Mike Foley <mfoley>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 4.4CC: finwemartinez, hbrock, hrupp, jmartine, myarboro
Target Milestone: ---Keywords: EasyFix
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Charles Crouch 2012-06-19 14:25:12 EDT
(1:00:30 PM) mazz: ips: I can't remember if there is "pull the pin" suicide code in that shutdown hook
(1:00:48 PM) mazz: by that I mean, it tries to kindly wait, but if the threads don't die, we eventually call System.exit()
(1:00:56 PM) mazz: is that the 100s timeout you are talking about?
(1:01:18 PM) mazz:             // set our timebomb to ensure the agent dies
(1:01:18 PM) mazz:             spawnKillThread(1000L * 60 * 5);
(1:01:41 PM) mazz:     /**
(1:01:41 PM) mazz:      * If something goes wrong and the VM does not die on its own when we think it should,
(1:01:41 PM) mazz:      * the thread created by this method will explicitly kill the VM.
(1:01:41 PM) mazz:      * Calling this method sets a timebomb that will kill the VM after a timer runs out.
(1:01:41 PM) mazz:      * There is no way to stop this timebomb short of performing 007-type heroics.
(1:01:42 PM) mazz:      * 
(1:01:42 PM) mazz:      * @param doomsday the number of milliseconds that the VM has left to live; once this
(1:01:43 PM) mazz:      *        time expires, a kill thread will execute System.exit(0).
(1:01:43 PM) mazz:      */
(1:01:44 PM) mazz:     public void spawnKillThread(final long doomsday) {
(1:01:50 PM) mazz: so after 5 minutes, the agent should eventually die
(1:02:28 PM) mazz: during shutdown, we should see a daemon thread named "RHQ Agent Kill Thread" in the thread dump
(1:03:00 PM) mazz: so it seems to me that no more than 5m should elapse before the agent VM process dies

spawnKillThread(1000L * 60 * 5) should be configurable if people want to change this behaviour, but keep its current default.
Comment 2 Josejulio 2015-10-26 18:35:16 EDT
Made the agent shutdown time configurable: https://github.com/rhq-project/rhq/pull/191
Comment 3 Josejulio Martínez 2016-01-25 12:20:03 EST
commit cb99af60bececc64eba8b3ed12621d0028010755
Author: Josejulio Martínez Magaña <jmartine@redhat.com>
Date:   Mon Oct 26 14:41:37 2015 -0600

    Bug 833547 - make agent shutdown timeout configurable
    Takes the configuration from AgentConfiguration.
    Created the defaults in AgentConfigurationConstants.
    The configuration is taken from the entry: "rhq.agent.agent-update.exit-timeout-msecs".
Comment 4 Mike McCune 2016-03-28 18:47:43 EDT
This bug was accidentally moved from POST to MODIFIED via an error in automation, please see mmccune@redhat.com with any questions