Bug 810204 - Invalid destination regex of a calltime metric condition causes the reload of the condition cache of the whole agent to fail
Invalid destination regex of a calltime metric condition causes the reload of...
Status: CLOSED CURRENTRELEASE
Product: RHQ Project
Classification: Other
Component: Alerts, Core Server (Show other bugs)
unspecified
All All
urgent Severity high (vote)
: ---
: RHQ 4.4.0
Assigned To: RHQ Project Maintainer
Mike Foley
:
Depends On:
Blocks: 864259
  Show dependency treegraph
 
Reported: 2012-04-05 06:39 EDT by Lukas Krejci
Modified: 2013-09-01 05:58 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 864259 (view as bug list)
Environment:
Last Closed: 2013-09-01 05:58:51 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Lukas Krejci 2012-04-05 06:39:48 EDT
Description of problem:
When defining a calltime metric condition, one can specify a regular expression to limit the "destinations" that the condition is satisfied for.

When the regular expression is invalid, the exception causes the reloading of the whole condition cache for the whole agent to fail with an error message like this:

12:06:52,005 ERROR [AlertConditionCacheCoordinator] Error loading cache for agent[id=10001]
java.util.regex.PatternSyntaxException: Dangling meta character '*' near index 2
.**.*
  ^
        at java.util.regex.Pattern.error(Pattern.java:1713)
        at java.util.regex.Pattern.sequence(Pattern.java:1878)
        at java.util.regex.Pattern.expr(Pattern.java:1752)
        at java.util.regex.Pattern.compile(Pattern.java:1460)
        at java.util.regex.Pattern.<init>(Pattern.java:1133)
        at java.util.regex.Pattern.compile(Pattern.java:823)
        at org.rhq.enterprise.server.alert.engine.model.CallTimeDataCacheElement.<init>(CallTimeDataCacheElement.java:53)
        at org.rhq.enterprise.server.alert.engine.internal.AgentConditionCache.insertAlertConditionComposite(AgentConditionCache.java:202)
        at org.rhq.enterprise.server.alert.engine.internal.AgentConditionCache.loadCachesForAgent(AgentConditionCache.java:147)
        at org.rhq.enterprise.server.alert.engine.internal.AgentConditionCache.<init>(AgentConditionCache.java:105)
        at org.rhq.enterprise.server.alert.engine.internal.AlertConditionCacheCoordinator.reloadCachesForAgent(AlertConditionCacheCoordinator.java:146)
        at org.rhq.enterprise.server.alert.engine.AlertConditionCacheManagerBean.reloadCachesForAgent(AlertConditionCacheManagerBean.java:106)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
        at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
        at org.rhq.enterprise.server.common.PerformanceMonitorInterceptor.monitorHibernatePerformance(PerformanceMonitorInterceptor.java:32)
        at sun.reflect.GeneratedMethodAccessor119.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
...

The above error message was thrown when defining a calltime metric condition with a regex "*", which is an invalid regular expression but I assume a common mistake because it is a legal glob expression.

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

How reproducible:
always

Steps to Reproduce:
1. Inventory an AS4 with at least 1 WAR deployed
2. Go to the resource of the WAR
3. Define an alert with a single calltime condition (any type) with the regular expression "*" (without the quotes)
4. Save the alert
  
Actual results:
After a while, when the server reloads the condition cache, the above message appears in the server log

Expected results:
a more graceful failure - maybe just failing that single condition to reload - that seems to be the common case.

Additional info:
Comment 1 Lukas Krejci 2012-04-05 09:47:53 EDT
there is an info message being put into the server log for each condition that fails to load formatted along the lines of:

15:37:23,414 INFO  [AlertConditionCacheCoordinator] Failed to create CallTimeDataCacheElement with parameters: id=10011, operator=CHANGES, value=0.04, error message: The destination regular expression 'a[' is invalid: Unclosed character class near index 5
.*a[.*
     ^


master http://git.fedorahosted.org/git/?p=rhq/rhq.git;a=commitdiff;h=02e78dd72fcfcfd92dabf5703207b5b43bb92dbd
Author: Lukas Krejci <lkrejci@redhat.com>
Date:   Thu Apr 5 13:01:39 2012 +0200

    [BZ 810204] - Make sure an invalid destination regex in calltime condition
    doesn't blow up the whole agent condition cache reloading.
Comment 2 Heiko W. Rupp 2013-09-01 05:58:51 EDT
Bulk closing of items that are on_qa and in old RHQ releases, which are out for a long time and where the issue has not been re-opened since.

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