Bug 663745 - JON 241: If Apache plug-in fails to parse/load a discovered Apache configuration file, discovery of remaining Apache processes is halted
JON 241: If Apache plug-in fails to parse/load a discovered Apache configurat...
Status: CLOSED CURRENTRELEASE
Product: RHQ Project
Classification: Other
Component: Plugins (Show other bugs)
3.0.0
Unspecified Unspecified
medium Severity medium (vote)
: ---
: ---
Assigned To: Lukas Krejci
Corey Welton
:
Depends On:
Blocks: jon241-bugs
  Show dependency treegraph
 
Reported: 2010-12-16 13:14 EST by Lukas Krejci
Modified: 2011-05-23 21:08 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 653695
Environment:
JON 2.4 Windows 2003 Apache HTTPD 2.2 Apache Plug-in
Last Closed: 2011-05-23 21:08:38 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Lukas Krejci 2010-12-16 13:14:13 EST
+++ This bug was initially created as a clone of Bug #653695 +++

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.

--- Additional comment from loleary@redhat.com on 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 1 Lukas Krejci 2010-12-16 13:47:19 EST
commit 510edfa8fac2234ef186b837e8119f7708aa6d18
Author: Lukas Krejci <lkrejci@redhat.com>
Date:   Thu Dec 16 19:45:36 2010 +0100

    BZ 663745 - refactor the apache discovery to continue processing the rest of process scan results after an error during processing one of them.
Comment 2 Sunil Kondkar 2010-12-21 04:57:22 EST
Verified on Jon241 build#52 (build number: 10966:3cea406)

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 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")

Observed that the Apache server with alternate configuration (C:\Program Files\Apache Software Foundation\00368619\Apache2.2\conf\httpd.conf) is discovered.
Comment 3 Corey Welton 2011-05-23 21:08:38 EDT
Bookkeeping - closing bug - fixed in recent release.

Note You need to log in before you can comment on or make changes to this bug.