Bug 864259 - Invalid destination regex of a calltime metric condition causes the reload of the condition cache of the whole agent to fail
Summary: Invalid destination regex of a calltime metric condition causes the reload of...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Operations Network
Classification: JBoss
Component: Core Server
Version: JON 3.0.1
Hardware: All
OS: All
urgent
high
Target Milestone: ---
: JON 3.1.2
Assignee: Lukas Krejci
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On: 810204
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-10-09 01:51 UTC by Larry O'Leary
Modified: 2018-11-27 20:09 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 810204
Environment:
Last Closed: 2013-09-11 10:57:55 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 92253 0 None None None 2012-10-09 01:51:41 UTC

Description Larry O'Leary 2012-10-09 01:51:40 UTC
+++ 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):
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:

--- Additional comment from lkrejci 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
.*a[.*
     ^


master http://git.fedorahosted.org/git/?p=rhq/rhq.git;a=commitdiff;h=02e78dd72fcfcfd92dabf5703207b5b43bb92dbd
Author: Lukas Krejci <lkrejci>
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-09 01:52:43 UTC
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 11:18:18 UTC
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.