RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1224378 - ccs_config_validate chews on long lines
Summary: ccs_config_validate chews on long lines
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: cluster
Version: 6.7
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Christine Caulfield
QA Contact: cluster-qe@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-05-22 17:53 UTC by Radek Steiger
Modified: 2015-08-17 12:47 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-08-17 12:47:33 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Radek Steiger 2015-05-22 17:53:20 UTC
> Description of problem:

Too many attributes in a single config element causes ccs_config_validate to get stuck on validation, although it eventually finishes after a significant amount of time. Looking into process list it looks like xmllint is the one to be so resource demanding.

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

cman-3.0.12.1-73.el6.x86_64

> How reproducible:

Always

> Steps to Reproduce:

1. Configure a fence or resource agent that provides 20 or more possible arguments (see followup comments)
2. Validate config with ccs_config_validate

> Actual results:

Validation time grows significantly with higher number of agent arguments.

> Expected results:

Validation takes no more than a couple of seconds.

Comment 1 Radek Steiger 2015-05-22 18:01:09 UTC
Emerson fencing agent with validation times depending on # of attributes
------------------------------------------------------------------------

[root@virt-100 cluster]# time ccs_config_validate 
Configuration validates

real	153m24.830s
user	152m17.036s
sys	0m2.553s


[root@virt-100 cluster]# cat cluster.conf | tr '\t' ' '
<?xml version="1.0"?>
<cluster config_version="40" name="virt-100">
 <clusternodes>
  <clusternode name="virt-100" nodeid="1">
   <fence>
    <method name="Method">
     <device name="Emerson" port="22"/>
    </method>
   </fence>
  </clusternode>
 </clusternodes>
 <fencedevices>
  <fencedevice agent="fence_emerson" community="public" ipaddr="emerson.example.com" login="emerson" login_timeout="10" name="Emerson" passwd="fittipaldi" passwd_script="/usr/local/bin/myscript" power_timeout="30" power_wait="10" retry_on="5" shell_timeout="30" snmp_auth_prot="SHA" snmp_priv_passwd="fittipaldi" snmp_priv_passwd_script="/usr/local/bin/myscript" snmp_priv_prot="AES" snmp_sec_level="noAuthNoPriv" snmp_version="2c" udpport="161"/>
 </fencedevices>
</cluster>

***********

[root@virt-100 tmp]# time ccs_config_validate -f /tmp/cluster.conf 
Configuration validates

real	3m5.494s
user	3m5.057s
sys	0m0.054s

<fencedevice agent="fence_emerson" community="public" ipaddr="emerson.example.com" login="emerson" login_timeout="10" name="Emerson" passwd="fittipaldi" power_timeout="30" power_wait="10" retry_on="5" shell_timeout="30" snmp_auth_prot="SHA" snmp_priv_passwd="fittipaldi" snmp_priv_prot="AES" snmp_sec_level="noAuthNoPriv"  snmp_version="2c" udpport="161"/>

***********

[root@virt-100 tmp]# time ccs_config_validate -f /tmp/cluster.conf 
Configuration validates

real	0m35.295s
user	0m35.174s
sys	0m0.036s

<fencedevice agent="fence_emerson" community="public" ipaddr="emerson.example.com" login="emerson" login_timeout="10" name="Emerson" passwd="fittipaldi" power_timeout="30" power_wait="10" retry_on="5" shell_timeout="30" snmp_auth_prot="SHA" snmp_priv_passwd="fittipaldi" snmp_priv_prot="AES" snmp_version="2c" udpport="161"/>

***********

[root@virt-100 tmp]# time ccs_config_validate -f /tmp/cluster.conf 
Configuration validates

real	0m7.432s
user	0m7.363s
sys	0m0.032s

<fencedevice agent="fence_emerson" community="public" ipaddr="emerson.example.com" login="emerson" login_timeout="10" name="Emerson" passwd="fittipaldi" power_timeout="30" power_wait="10" retry_on="5" shell_timeout="30" snmp_auth_prot="SHA" snmp_priv_passwd="fittipaldi" snmp_version="2c" udpport="161"/>

***********

[root@virt-100 tmp]# time ccs_config_validate -f /tmp/cluster.conf 
Configuration validates

real	0m2.054s
user	0m2.003s
sys	0m0.020s

<fencedevice agent="fence_emerson" community="public" ipaddr="emerson.example.com" login="emerson" login_timeout="10" name="Emerson" passwd="fittipaldi" power_timeout="30" power_wait="10" retry_on="5" shell_timeout="30" snmp_auth_prot="SHA" snmp_version="2c" udpport="161"/>

***********

[root@virt-100 tmp]# time ccs_config_validate -f /tmp/cluster.conf 
Configuration validates

real	0m0.676s
user	0m0.625s
sys	0m0.023s

<fencedevice agent="fence_emerson" community="public" ipaddr="emerson.example.com" login="emerson" login_timeout="10" name="Emerson" passwd="fittipaldi" power_timeout="30" power_wait="10" retry_on="5" shell_timeout="30" snmp_version="2c" udpport="161"/>

***********

[root@virt-100 tmp]# time ccs_config_validate -f /tmp/cluster.conf 
Configuration validates

real	0m0.269s
user	0m0.219s
sys	0m0.022s

<fencedevice agent="fence_emerson" community="public" ipaddr="emerson.example.com" login="emerson" login_timeout="10" name="Emerson" passwd="fittipaldi" power_timeout="30" power_wait="10" retry_on="5" shell_timeout="30" udpport="161"/>

Comment 2 Radek Steiger 2015-05-22 18:24:08 UTC
SAP resource agent with validation times depending on # of attributes
---------------------------------------------------------------------

[root@virt-100 tmp]# time ccs_config_validate -f /tmp/cluster.conf 
Configuration validates

real	10m1.649s
user	9m59.879s
sys	0m0.156s


[root@virt-100 tmp]# cat /tmp/cluster.conf | tr '\t' ' '
<?xml version="1.0"?>
<cluster config_version="54" name="virt-100">
 <clusternodes>
  <clusternode name="virt-100" nodeid="1">
   <fence>
    <method name="Method"/>
   </fence>
  </clusternode>
 </clusternodes>
 <rm>
  <service autostart="0" name="sg1" recovery="relocate">
   <SAPDatabase AUTOMATIC_RECOVER="1" DBJ2EE_ONLY="1" DBTYPE="ORA" DB_JARS="java" DIR_BOOTSTRAP="/opt/j2ee" DIR_EXECUTABLE="/sap" DIR_SECSTORE="/opt/sec" JAVA_HOME="/opt/java" NETSERVICENAME="oracle" POST_START_USEREXIT="/opt/bin/script" POST_STOP_USEREXIT="/opt/bin/script" PRE_START_USEREXIT="/opt/bin/script" PRE_STOP_USEREXIT="/opt/bin/script" SID="sap" STRICT_MONITORING="1" __enforce_timeouts="1" __failure_expire_time="30" __independent_subtree="2" __max_failures="5"/>
  </service>
 </rm>
</cluster>


*************

[root@virt-100 tmp]# time ccs_config_validate -f /tmp/cluster.conf 
Configuration validates

real	0m19.818s
user	0m19.596s
sys	0m0.056s

<SAPDatabase AUTOMATIC_RECOVER="1" DBJ2EE_ONLY="1" DBTYPE="ORA" DB_JARS="java" DIR_BOOTSTRAP="/opt/j2ee" DIR_EXECUTABLE="/sap" DIR_SECSTORE="/opt/sec" JAVA_HOME="/opt/java" NETSERVICENAME="oracle" POST_START_USEREXIT="/opt/bin/script" POST_STOP_USEREXIT="/opt/bin/script" PRE_START_USEREXIT="/opt/bin/script" PRE_STOP_USEREXIT="/opt/bin/script" SID="sap" STRICT_MONITORING="1" __enforce_timeouts="1" __independent_subtree="2"/>

*************

[root@virt-100 tmp]# time ccs_config_validate -f /tmp/cluster.conf 
Configuration validates

real	0m4.489s
user	0m4.418s
sys	0m0.023s

<SAPDatabase AUTOMATIC_RECOVER="1" DBJ2EE_ONLY="1" DBTYPE="ORA" DB_JARS="java" DIR_BOOTSTRAP="/opt/j2ee" DIR_EXECUTABLE="/sap" DIR_SECSTORE="/opt/sec" JAVA_HOME="/opt/java" NETSERVICENAME="oracle" POST_START_USEREXIT="/opt/bin/script" POST_STOP_USEREXIT="/opt/bin/script" PRE_START_USEREXIT="/opt/bin/script" PRE_STOP_USEREXIT="/opt/bin/script" SID="sap" STRICT_MONITORING="1" __independent_subtree="2"/>

*************

[root@virt-100 tmp]# time ccs_config_validate -f /tmp/cluster.conf 
Configuration validates

real	0m1.202s
user	0m1.136s
sys	0m0.018s

<SAPDatabase AUTOMATIC_RECOVER="1" DBJ2EE_ONLY="1" DBTYPE="ORA" DB_JARS="java" DIR_BOOTSTRAP="/opt/j2ee" DIR_EXECUTABLE="/sap" DIR_SECSTORE="/opt/sec" JAVA_HOME="/opt/java" NETSERVICENAME="oracle" POST_START_USEREXIT="/opt/bin/script" POST_STOP_USEREXIT="/opt/bin/script" PRE_START_USEREXIT="/opt/bin/script" PRE_STOP_USEREXIT="/opt/bin/script" SID="sap" STRICT_MONITORING="1"/>


*************

[root@virt-100 tmp]# time ccs_config_validate -f /tmp/cluster.conf 
Configuration validates

real	0m0.113s
user	0m0.065s
sys	0m0.023s

<SAPDatabase AUTOMATIC_RECOVER="1" DBJ2EE_ONLY="1" DBTYPE="ORA" DB_JARS="java" DIR_BOOTSTRAP="/opt/j2ee" DIR_EXECUTABLE="/sap" DIR_SECSTORE="/opt/sec" JAVA_HOME="/opt/java" NETSERVICENAME="oracle" SID="sap" STRICT_MONITORING="1"/>

Comment 4 Jan Pokorný [poki] 2015-06-17 11:17:52 UTC
This is really suprising from this first sight.
Not so much when the messy schema definition is taken into account
(multiply repeated permutation of the same parameters for fence devices
in a single bucket of alternative parameters being a most obvious
example).

By any chance, could you modify that script to invoke xmllint with
--stream option added if it helps in any way, please?

Comment 5 Radek Steiger 2015-06-17 11:53:52 UTC
No real improvement with --stream:

Without --stream:

[root@host-091 tmp]# time ccs_config_validate -f /tmp/cluster.conf 
Configuration validates

real	0m29.010s
user	0m28.797s
sys	0m0.073s



With --stream:

[root@host-091 tmp]# time ccs_config_validate -f /tmp/cluster.conf 
Configuration validates

real	0m28.765s
user	0m28.582s
sys	0m0.071s

Comment 6 Jan Pokorný [poki] 2015-06-17 14:16:00 UTC
Hmm, jing tool that I introduced in RHEL 7 as an optional component
(side-effect of the goal of having trang tool available in buildroots,
[bug 908010]) doesn't suffer from this unability to scale reasonably:

$ time jing cluster-6.7.rng cluster-big.conf
> 
> real	0m0.427s
> user	0m0.635s
> sys	0m0.036s

Note that cluster-big.conf directly matches to the example from
[comment 1] that took xmllint/libxml2 over 2.5 hours
(i.e., the boost factor here is more 1e8!).

Comment 7 Jan Pokorný [poki] 2015-06-17 14:52:59 UTC
Per the profiling numbers (callgrind), there seems to be an issue
with state space being increased by factor of 4 per a parameter added,
hence the difference in complexity between 2 and 19 parameters
(as an initial example in [comment 1]) is expected to be

    4^(19-2) = 17179869184

(rough approximation of how many times longer it will take to validate
a document with a single FA defining 19 parameters than 2).

Exponential complexity O(4^N) of this sub-validation seems to be
a blocker for using agents supporting more than certain amount
of parameters and hence for general use.  As a workaround, one
can put "CONFIG_VALIDATION=NONE" line in /etc/sysconfig/cman.

 * * *

fencedevice with 13 parameters (incl. name)

  790,073,031  < xmlRelaxNGValidateDefinition'2 (54118x)
  596,695,744  < xmlRelaxNGValidateState'2 (82372x)
1,386,009,941  *  xmlRelaxNGAddStates
      741,345  >   xmlRelaxNGFreeValidState (25468x)


fencedevice with 14 parameters (incl. name)

3,015,031,787  < xmlRelaxNGValidateDefinition'2 (95058x)
2,263,635,221  < xmlRelaxNGValidateState'2 (143812x)
5,277,365,570  *  xmlRelaxNGAddStates
    1,276,591  >   xmlRelaxNGFreeValidState


fencedevice with 15 parameters (incl. name)

11,815,907,357  < xmlRelaxNGValidateDefinition'2 (176958x)
 8,849,057,938  < xmlRelaxNGValidateState'2 (266692x)
20,662,572,459  *  xmlRelaxNGAddStates
     2,345,819  >   xmlRelaxNGFreeValidState (80764x)

Comment 8 Christine Caulfield 2015-08-17 12:47:33 UTC
Closing this as it's too big a change to make in RHEL-6 now. There is a workaround to speed up startup as shown in the previous comment.


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