Bug 864259 - 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...
Product: JBoss Operations Network
Classification: JBoss
Component: Core Server (Show other bugs)
JON 3.0.1
All All
urgent Severity high
: ---
: JON 3.1.2
Assigned To: Lukas Krejci
Mike Foley
Depends On: 810204
  Show dependency treegraph
Reported: 2012-10-08 21:51 EDT by Larry O'Leary
Modified: 2013-09-11 06:57 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 810204
Last Closed: 2013-09-11 06:57:55 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 92253 None None None 2012-10-08 21:51:41 EDT

  None (edit)
Description Larry O'Leary 2012-10-08 21:51:40 EDT
+++ This bug was initially created as a clone of RHQ Bug #810204 +++

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

How reproducible:

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:

--- Additional comment from lkrejci@redhat.com on 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

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 1 Larry O'Leary 2012-10-08 21:52:43 EDT
Setting to ON_QA as this was committed to RHQ 4.4 (JON 3.1) and just still needs its fixed verified by QE.
Comment 2 Sunil Kondkar 2012-11-26 06:18:18 EST
Verified on 3.1.2.ER2 build.

With invalid destination regex entry in calltime alert condition on an AS4 WAR resource, there are no errors observed in server log. The server log displays below Info message:

2012-11-26 16:29:34,777 INFO  [org.rhq.enterprise.server.alert.engine.internal.AlertConditionCacheCoordinator] Failed to create CallTimeDataCacheElement with parameters: id=10001, operator=CHANGES, value=0.01, error message: The destination regular expression '*' is invalid: Dangling meta character '*' near index 2

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