Bug 656496 - [apache] Plugin fails to work if the httpd.conf contains an Include directive with non-existent path
Summary: [apache] Plugin fails to work if the httpd.conf contains an Include directive...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: RHQ Project
Classification: Other
Component: Plugins
Version: 4.0.0
Hardware: Unspecified
OS: Unspecified
high
medium vote
Target Milestone: ---
: ---
Assignee: RHQ Project Maintainer
QA Contact: Corey Welton
URL:
Whiteboard:
Depends On: 656476
Blocks: jon30-bugs
TreeView+ depends on / blocked
 
Reported: 2010-11-23 21:03 UTC by Lukas Krejci
Modified: 2011-05-24 01:13 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 656476
Environment:
Last Closed:


Attachments (Terms of Use)

Description Lukas Krejci 2010-11-23 21:03:22 UTC
+++ This bug was initially created as a clone of Bug #656476 +++

Description of problem:

Exception during discovery:

2010-11-23 19:56:30,012 WARN  [InventoryManager.discovery-1] (rhq.core.pc.inventory.InventoryManager)- Failure during discovery for [Apache Virtual Host] Resources - failed after 26 ms.
java.lang.Exception: Discovery component invocation failed.
        at org.rhq.core.pc.util.DiscoveryComponentProxyFactory$ComponentInvocationThread.call(DiscoveryComponentProxyFactory.java:283)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:619)
Caused by: org.rhq.plugins.apache.parser.ApacheParserException: java.lang.IllegalStateException: Could not list files in /etc/httpd/bogus
        at org.rhq.plugins.apache.parser.ApacheConfigReader.searchFile(ApacheConfigReader.java:62)
        at org.rhq.plugins.apache.parser.ApacheConfigReader.buildTree(ApacheConfigReader.java:19)
        at org.rhq.plugins.apache.ApacheServerComponent.loadParser(ApacheServerComponent.java:883)
        at org.rhq.plugins.apache.ApacheVirtualHostServiceDiscoveryComponent.discoverResources(ApacheVirtualHostServiceDiscoveryComponent.java:77)
        at sun.reflect.GeneratedMethodAccessor46.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.rhq.core.pc.util.DiscoveryComponentProxyFactory$ComponentInvocationThread.call(DiscoveryComponentProxyFactory.java:279)
        ... 5 more
Caused by: java.lang.IllegalStateException: Could not list files in /etc/httpd/bogus
        at org.rhq.augeas.util.Glob.match(Glob.java:132)
        at org.rhq.plugins.apache.parser.ApacheParserImpl.getIncludeFiles(ApacheParserImpl.java:48)
        at org.rhq.plugins.apache.parser.ApacheParserImpl.addDirective(ApacheParserImpl.java:25)
        at org.rhq.plugins.apache.parser.ApacheConfigReader.searchFile(ApacheConfigReader.java:50)
        ... 12 more


Exception during measurement collection:
2010-11-23 20:04:42,301 WARN  [MeasurementManager.collector-1] (rhq.core.pc.measurement.MeasurementCollectorRunner)- Failure to collect measurement data for Resource[id=10227, type=Apache Virtual Host, key=localhost.localdomain:443, name=127.0.0.1:443, parent=127.0.0.1:80] - cause: org.rhq.rhqtransform.AugeasRhqException:java.lang.IllegalStateException: java.lang.IllegalStateException: java.lang.IllegalStateException: Could not list files in /etc/httpd/bogus -> java.lang.IllegalStateException:java.lang.IllegalStateException: java.lang.IllegalStateException: Could not list files in /etc/httpd/bogus -> java.lang.IllegalStateException:java.lang.IllegalStateException: Could not list files in /etc/httpd/bogus -> java.lang.IllegalStateException:Could not list files in /etc/httpd/bogus

Version-Release number of selected component (if applicable):
3.0.0

How reproducible:
always

Steps to Reproduce:
1. edit the httpd.conf to contain an Include directive with a non-existing path
2. run discovery or try to edit configuration of already inventoried apache server (after having enabled Augeas support in its connection properties), watch agent.log for measurement collections.
  
Actual results:
discovery fails with an exception in the description, configuration fails, measurement collection fails

Expected results:
the plugin should work even though the httpd fails to start with such invalid configuration so that the user can use the plugin to try and investigate the situation...

Additional info:

Comment 1 Lukas Krejci 2010-11-26 13:53:48 UTC
commit 3e03058e6b276b66affd1529d684882db3cc3a13
Author: Lukas Krejci <lkrejci@redhat.com>
Date:   Fri Nov 26 14:48:32 2010 +0100

    A cherry-pick and adaptation of the original fix ae99b5bc0bf42909308a9d1efc09cee77d06ffc1 in release-3.0.0 branch:
    
    a couple of robustness enhancements to the apache plugin:
    BZ 656449 - use the matching algorithm between SNMP values and augeas nodes also
      when matching the vhost node by resource key, because resource key
      in RHQ 3 is based on the SNMP value.
    BZ 652247 - Log the SNMP errors only on DEBUG level during discovery because SNMP isn't
      required for it to work.
    BZ 656476 - Do not fail the discovery if a non-existent directory is used in an Include directive
    BZ 652247, BZ 656491 - Do not choke on invalid/unresolvable hostnames in VirtualHost or ServerName directives

Comment 2 Sunil Kondkar 2011-03-11 11:56:07 UTC
Verified on build#1086 (Version: 4.0.0-SNAPSHOT Build Number: 7b2d9f6)

Edited the httpd.conf to contain an Include directive with a non-existing path and ran discovery.
The plugin discovers apache instance and metrics are collected.

Marking as verified.

Comment 3 Corey Welton 2011-05-24 01:13:20 UTC
Bookkeeping - closing bug - fixed in recent release.

Comment 4 Corey Welton 2011-05-24 01:13:21 UTC
Bookkeeping - closing bug - fixed in recent release.

Comment 5 Corey Welton 2011-05-24 01:13:21 UTC
Bookkeeping - closing bug - fixed in recent release.


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