Notifications

67 views

Description

The "OSMapping" Script Include unnecessarily instantiates a GlideRecord object for each call to the DiscoveryHostUtils script include, and passes the GlideRecord object.

Instantiating the GlideRecord is expensive when all you need to do is pass the two values. 

Steps to Reproduce

Run Service Mapping re-Discovery and look out for some Critical jobs that are using Scheduler Worker threads for a long time. Names of threads will be like "System Trigger2019-10-17 08:44:31 0:29:58", although that in inself is not diagnostic.

Example Stack Trace of long-running Discovery job, that's running a sensor of a Pattern. Look for the highlighted lines below:

main,glide.scheduler.worker.3,4,System Trigger2018-11-27 15:10:54 (630018 ms) 
com.glide.script.glide_elements.GlideElementExtensions.get(GlideElementExtensions.java:191)
com.glide.script.glide_elements.GlideElementExtensions.getObjectName(GlideElementExtensions.java:51)
com.glide.script.GlideElement.newGlideElement(GlideElement.java:165)
com.glide.script.GlideElement.newGlideElement(GlideElement.java:134)
com.glide.script.GlideRecord.loadRow0(GlideRecord.java:3534)
com.glide.script.GlideRecord.loadRow(GlideRecord.java:3382)
com.glide.script.GlideRecord.initIfNecessary(GlideRecord.java:978)
com.glide.script.GlideRecord.jsFunction_setValue(GlideRecord.java:7109)
sun.reflect.GeneratedMethodAccessor74.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
org.mozilla.javascript.MemberBox.invoke(MemberBox.java:138)
org.mozilla.javascript.FunctionObject.doInvoke(FunctionObject.java:670)
org.mozilla.javascript.FunctionObject.call(FunctionObject.java:614)
org.mozilla.javascript.ScriptRuntime.doCall(ScriptRuntime.java:2582)
org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:42)
org.mozilla.javascript.gen.sys_script_include_169c2b667f0222005598baf8befa918f_script_1829._c_anonymous_2(sys_script_include.169c2b667f0222005598baf8befa918f.script:18) ==> OSMapping Script Include
org.mozilla.javascript.gen.sys_script_include_169c2b667f0222005598baf8befa918f_script_1829.call(sys_script_include.169c2b667f0222005598baf8befa918f.script)
org.mozilla.javascript.ScriptRuntime.doCall2(ScriptRuntime.java:2650)
org.mozilla.javascript.ScriptRuntime.doCall(ScriptRuntime.java:2590)
org.mozilla.javascript.ScriptableObject.callMethod(ScriptableObject.java:2655)
org.mozilla.javascript.ScriptableObject.callMethod(ScriptableObject.java:2627)
com.glide.script.RhinoObject.callFunction(RhinoObject.java:169)
com.snc.sw.ptl.BasePatternLibraryDAO.buildOsOldToNewValuesMap(BasePatternLibraryDAO.java:135)
com.snc.sw.ui.flex.PatternLibraryAppServiceImpl.getPatternsByFilter(PatternLibraryAppServiceImpl.java:1118)
com.snc.sw.ui.flex.PatternLibraryAppServiceImpl.isIncludedPattern(PatternLibraryAppServiceImpl.java:1397)
com.snc.sw.ui.flex.PatternLibraryAppServiceImpl.jsFunction_isIncludedPattern(PatternLibraryAppServiceImpl.java:1372)
sun.reflect.GeneratedMethodAccessor551.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
org.mozilla.javascript.MemberBox.invoke(MemberBox.java:138)
org.mozilla.javascript.FunctionObject.doInvoke(FunctionObject.java:670)
org.mozilla.javascript.FunctionObject.call(FunctionObject.java:614)
org.mozilla.javascript.ScriptRuntime.doCall(ScriptRuntime.java:2582)
org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32)
org.mozilla.javascript.gen.sys_script_include_f82bdda4c35322003e76741e81d3ae91_script_652._c_anonymous_7(sys_script_include.f82bdda4c35322003e76741e81d3ae91.script:132) ==> CloudApplicationDiscovery
org.mozilla.javascript.gen.sys_script_include_f82bdda4c35322003e76741e81d3ae91_script_652.call(sys_script_include.f82bdda4c35322003e76741e81d3ae91.script)
org.mozilla.javascript.ScriptRuntime.doCall2(ScriptRuntime.java:2650)
org.mozilla.javascript.ScriptRuntime.doCall(ScriptRuntime.java:2590)
org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:52)
org.mozilla.javascript.gen.sys_script_include_f82bdda4c35322003e76741e81d3ae91_script_652._c_anonymous_4(sys_script_include.f82bdda4c35322003e76741e81d3ae91.script:73)
org.mozilla.javascript.gen.sys_script_include_f82bdda4c35322003e76741e81d3ae91_script_652.call(sys_script_include.f82bdda4c35322003e76741e81d3ae91.script)
org.mozilla.javascript.ScriptRuntime.doCall2(ScriptRuntime.java:2650)
org.mozilla.javascript.ScriptRuntime.doCall(ScriptRuntime.java:2590)
org.mozilla.javascript.ScriptableObject.callMethod(ScriptableObject.java:2655)
org.mozilla.javascript.ScriptableObject.callMethod(ScriptableObject.java:2627)
com.glide.script.RhinoObject.callFunction(RhinoObject.java:169)
com.snc.sw.rediscovery.CloudApplicationDiscovery.discover(CloudApplicationDiscovery.java:90)
com.snc.sw.rediscovery.CloudApplicationDiscovery.discover(CloudApplicationDiscovery.java:136)
com.snc.cloud.discovery.CloudDiscoveryService.lambda$discover$59(CloudDiscoveryService.java:55)
com.snc.cloud.discovery.CloudDiscoveryService$$Lambda$116/9838943.test(Unknown Source)
com.snc.cloud.discovery.CloudDiscoveryService.foreachCloudProvider(CloudDiscoveryService.java:38)
com.snc.cloud.discovery.CloudDiscoveryService.discover(CloudDiscoveryService.java:55)
com.snc.core_automation.ICloudDiscoveryProvider.discover(ICloudDiscoveryProvider.java:41)
com.snc.cloud.discovery.service.DiscoveryServiceImpl.discover(DiscoveryServiceImpl.java:117)
com.snc.cloud.discovery.DiscoveryServiceScript.jsFunction_discover(DiscoveryServiceScript.java:70)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
org.mozilla.javascript.MemberBox.invoke(MemberBox.java:138)
org.mozilla.javascript.FunctionObject.doInvoke(FunctionObject.java:670)
org.mozilla.javascript.FunctionObject.call(FunctionObject.java:614)
org.mozilla.javascript.ScriptRuntime.doCall(ScriptRuntime.java:2582)
org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:52)
org.mozilla.javascript.gen.sys_script_include_941dd5d5eba32200979aa5115206fe61_script_649._c_anonymous_2(sys_script_include.941dd5d5eba32200979aa5115206fe61.script:39) ==> CloudResourceDiscoveryLaunch
org.mozilla.javascript.gen.sys_script_include_941dd5d5eba32200979aa5115206fe61_script_649.call(sys_script_include.941dd5d5eba32200979aa5115206fe61.script)
org.mozilla.javascript.ScriptRuntime.doCall2(ScriptRuntime.java:2650)
org.mozilla.javascript.ScriptRuntime.doCall(ScriptRuntime.java:2590)
org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRuntime.java:85)
org.mozilla.javascript.gen.sys_script_include_092266f60ab30150007b0466d082578c_script_646._c_anonymous_7(sys_script_include.092266f60ab30150007b0466d082578c.script:117)
org.mozilla.javascript.gen.sys_script_include_092266f60ab30150007b0466d082578c_script_646.call(sys_script_include.092266f60ab30150007b0466d082578c.script)
org.mozilla.javascript.ScriptRuntime.doCall2(ScriptRuntime.java:2650)
org.mozilla.javascript.ScriptRuntime.doCall(ScriptRuntime.java:2590)
org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRuntime.java:85)
org.mozilla.javascript.gen.sys_script_include_092266f60ab30150007b0466d082578c_script_646._c_anonymous_2(sys_script_include.092266f60ab30150007b0466d082578c.script:36)
org.mozilla.javascript.gen.sys_script_include_092266f60ab30150007b0466d082578c_script_646.call(sys_script_include.092266f60ab30150007b0466d082578c.script)
org.mozilla.javascript.ScriptRuntime.doCall2(ScriptRuntime.java:2650)
org.mozilla.javascript.ScriptRuntime.doCall(ScriptRuntime.java:2590)
org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:42)
org.mozilla.javascript.gen.sys_script_include_a6cdaf5bc0a802550004f460b6c04967_script_642._c_anonymous_3(sys_script_include.a6cdaf5bc0a802550004f460b6c04967.script:20)
org.mozilla.javascript.gen.sys_script_include_a6cdaf5bc0a802550004f460b6c04967_script_642.call(sys_script_include.a6cdaf5bc0a802550004f460b6c04967.script)
org.mozilla.javascript.ScriptRuntime.doCall2(ScriptRuntime.java:2650)
org.mozilla.javascript.ScriptRuntime.doCall(ScriptRuntime.java:2590)
org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRuntime.java:85)
org.mozilla.javascript.gen._refname__640._c_script_0(:1)
org.mozilla.javascript.gen._refname__640.call()
org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:563)
org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3428)
org.mozilla.javascript.gen._refname__640.call()
org.mozilla.javascript.gen._refname__640.exec()
com.glide.script.ScriptEvaluator.execute(ScriptEvaluator.java:279)
com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:118)
com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:82)
com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:73)
com.glide.script.Evaluator.evaluateString(Evaluator.java:91)
com.snc.automation.ScriptJob.execute(ScriptJob.java:43)
com.glide.schedule.JobExecutor.executeJob(JobExecutor.java:103)
com.glide.schedule.JobExecutor.execute(JobExecutor.java:89)
com.glide.schedule.GlideScheduleWorker.executeJob(GlideScheduleWorker.java:244)
com.glide.schedule.GlideScheduleWorker.lambda$process$33(GlideScheduleWorker.java:169)
com.glide.schedule.GlideScheduleWorker$$Lambda$48/8374678.run(Unknown Source)
com.glide.worker.TransactionalWorkerThread.executeInTransaction(TransactionalWorkerThread.java:35)
com.glide.schedule.GlideScheduleWorker.process(GlideScheduleWorker.java:169)
com.glide.schedule.GlideScheduleWorker.run(GlideScheduleWorker.java:76)

Workaround

This problem has been fixed in New York and later. If you are able to upgrade, review the Fixed In or Intended Fix Version fields to determine whether any versions have a planned or permanent fix.

The workaround is only a partial fix for users on Madrid version, but should deliver a significant performance benefit and relief from this problem.

Workaround is to add new method to the "DiscoveryHostUtils" script includes and to comment out the old "OSMapping" script include piece of code where it was calling glide record object of cmdb_ci_computer and replaced it by passing the "osClass" and "os variable" directly.

This KB article has the 2 modified Script includes attached as an Update set (links below the text of this KB):

  • sys_script_include_b32d2640f32321002e6bae4716612b32.xml
  • sys_script_include_169c2b667f0222005598baf8befa918f.xml

This Customisation will cause the fix in the New York upgrade to skip the fix. You must revert the customisations in both of these Script Includes as soon as you have upgraded to New York or later.


Related Problem: PRB1318281

Seen In

SR - IRM - Audit Management - New York 2019 Q3
SR - IRM - GRC Profiles - Madrid 2019 Q2
SR - IRM - Policy and Compliance - Madrid 2019 Q2
SR - IRM - Risk Management - New York 2019 Q3
SR - ITOM - CMDB CI Class Models - 201907
SR - ITOM - Discovery and Service Mapping - v1.0.35
SR - ITOM - Fundamentals Istanbul Jakarta Kingston r1 - v5.99.6
SR - Security - Integration Framework - Madrid 2019 Q2
SR - Security - Support Common - Madrid 2019 Q2
SR - Security - Support Orchestration - Madrid 2019 Q2
SR - SIR - Security Incident Response - Madrid 2019 Q2
SR - SIR - Security Incident Response PA Content - New York 2019 Q3
SR - SIR - Store SecOps Setup Assistant - Madrid 2019 Q2
SR - SIR - Store Threat Core - Madrid 2019 Q2
SR - SIR - Store Trusted Security Circles Client - New York 2019 Q3
SR - VR - Qualys - New York 2019 Q3
SR - VR - Rapid7 - London 2019 Q2 v.6.2.1
SR - VR - Vulnerability Response - New York 2019 Q3
SR - VR - Vulnerability Response PA Content - Madrid 2019 Q2

Fixed In

New York

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2019-11-04 00:59:12
Published:2019-10-17
sys_remote_update_set_85489665dba8c01052b4ba1039961941.xml