Bug 653695

Summary: If Apache plug-in fails to parse/load a discovered Apache configuration file, discovery of remaining Apache processes is halted
Product: [Other] RHQ Project Reporter: Larry O'Leary <loleary>
Component: PluginsAssignee: Lukas Krejci <lkrejci>
Status: CLOSED CURRENTRELEASE QA Contact: Sunil Kondkar <skondkar>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.0.0CC: cwelton
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 663745 (view as bug list) Environment:
JON 2.4 Windows 2003 Apache HTTPD 2.2 Apache Plug-in
Last Closed: 2013-09-02 03:17:27 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 625146    
Attachments:
Description Flags
Proposed patch based off rhq master none

Description Larry O'Leary 2010-11-15 18:09:07 EST
If more than one Apache process is running on a platform and discovery fails to load or parse the configuration file of one of the Apache instances, the entire discovery process is terminated leaving all Apache instances un-discovered.

This is due to an exception that can bubble up and break the loop which iterates through each Apache instance in org.rhq.plugins.apache.ApacheServerDiscoveryComponent.discoverResources(ResourceDiscoveryContext<PlatformComponent> discoveryContext) when loadParser(serverConfigFile.getAbsolutePath(), serverRoot) is invoked.

To reproduce (in JON 2.4):
  1) Install Apache on a Windows platform at its default location (for example: C:\Program Files\Apache Software Foundation\Apache2.2)

  2) Do not register Apache to start as a service, if it is, un-register it or set the service from Auto start to Manual start

  3) Move the httpd.conf file from the Apache conf directory to an alternate location (For example: from C:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd.conf to C:\Program Files\Apache Software Foundation\00368619\Apache2.2\conf\httpd.conf)

  4) Register an instance of Apache as a Windows Service and point it to the alternate configuration file (For example: "C:\Program Files\Apache Software Foundation\Apache2.2\bin\httpd.exe" -k install -n "Apache_00368619" -f "C:\Program Files\Apache Software Foundation\00368619\Apache2.2\conf\httpd.conf")

  5) Have the Agent perform discovery

The result should be that the configuration file could not be found for the first process discovered and the real process (with alternate configuration) will not be discovered due to the first process failing to be discovered.
Comment 1 Larry O'Leary 2010-11-15 18:21:18 EST
Created attachment 460693 [details]
Proposed patch based off rhq master

Here is the proposed patch that will address this bug. It is confined to the specific test case described in the bug's original description.
Comment 3 Lukas Krejci 2010-12-16 13:30:00 EST
commit bfa4afdfdf10b80f08113fcb31b301d5e2e958e1
Author: Lukas Krejci <lkrejci@redhat.com>
Date:   Thu Dec 16 19:25:54 2010 +0100

    BZ 653695 - refactor the apache discovery to continue processing the rest of process scan results after an error during processing one of them.
Comment 4 Corey Welton 2011-01-03 23:23:51 EST
Sunil, please look at this one while you all have the JON/Windows/Apache instance up.
Comment 5 Corey Welton 2011-01-06 10:06:08 EST
Removing blocker against jon241 version of this bug
Comment 6 Sunil Kondkar 2011-01-07 07:20:57 EST
Verified on rhq 4.0.0-Snapshot build number:779b977 and also on jon241 build#62 (build number: 10993:e37f225)

1) Installed Apache 2.2.17 on a Windows platform at its default location
(C:\Program Files\Apache Software Foundation\Apache2.2)

2) Set the Apache service from Auto start to Manual start.

3) Moved the httpd.conf file from the Apache conf directory to an alternate
location (For example: from C:\Program Files\Apache Software
Foundation\Apache2.2\conf\httpd.conf to C:\Program Files\Apache Software
Foundation\00368619\Apache2.2\conf\httpd.conf)

4) Registered an instance of Apache as a Windows Service and pointed it to the
alternate configuration file (For example: "C:\Program Files\Apache Software
Foundation\Apache2.2\bin\httpd.exe" -k install -n "Apache_00368619" -f
"C:\Program Files\Apache Software
Foundation\00368619\Apache2.2\conf\httpd.conf")

Observed that the Apache server with alternate configuration (C:\Program
Files\Apache Software Foundation\00368619\Apache2.2\conf\httpd.conf) is
discovered.
Comment 7 Heiko W. Rupp 2013-09-02 03:17:27 EDT
Bulk closing of issues that were VERIFIED, had no target release and where the status changed more than a year ago.