Bug 819043
Summary: | Avoid calling Thread.getContextClassloader() to improve performance | ||
---|---|---|---|
Product: | [JBoss] JBoss Enterprise BRMS Platform 5 | Reporter: | Edson Tirelli <etirelli> |
Component: | BRE (Expert, Fusion) | Assignee: | Nobody <nobody> |
Status: | VERIFIED --- | QA Contact: | |
Severity: | urgent | Docs Contact: | |
Priority: | unspecified | ||
Version: | BRMS 5.3.0.GA | ||
Target Milestone: | ER7 | ||
Target Release: | BRMS 5.3.0.GA | ||
Hardware: | All | ||
OS: | All | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: |
When a JBoss BRMS instance is deployed into Gigaspaces container with the Java Security Manager enabled, accessing the context classloader is an extremely heavy operation (over 400 times slower) and caused thread contention among different threads running different sessions. This issue was resolved by removing the thread context class loader references from MVEL consequence execution.
|
Story Points: | --- |
Clone Of: | Environment: | ||
Last Closed: | Type: | Bug | |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Edson Tirelli
2012-05-04 16:30:15 UTC
Sorry, poor choice of words from my part. We are not really breaking any security protocols here. It is just that everytime a java application calls the method Thread.currentThread().getContextClassloader(), it will hit the security manager if one is present. See the method implementation on JDK: public ClassLoader getContextClassLoader() { if (contextClassLoader == null) return null; SecurityManager sm = System.getSecurityManager(); if (sm != null) { ClassLoader ccl = ClassLoader.getCallerClassLoader(); if (ccl != null && ccl != contextClassLoader && !contextClassLoader.isAncestor(ccl)) { sm.checkPermission(SecurityConstants.GET_CLASSLOADER_PERMISSION); } } return contextClassLoader; } What we are doing is, instead of calling that method all the time, we pass the classloader reference around avoid hitting the security manager all the time. Code changes pushed into the 5.3.x branch: <GitHub81> [drools] etirelli pushed 1 new commit to 5.3.x: https://github.com/droolsjbpm/drools/commit/cfe72930aa72b8027259f3c47ca656b2c9703087 <GitHub81> [drools/5.3.x] JBRULES-3489: Removing Thread Context Class Loader references from MVEL Consequence execution - Edson Tirelli Still requires the update to the new MVEL jar. Mario just pushed the update of the pom.xml to the new mvel version dependency jar into 5.3.x branch: <GitHub159> [droolsjbpm-build-bootstrap] mariofusco pushed 1 new commit to 5.3.x: https://github.com/droolsjbpm/droolsjbpm-build-bootstrap/commit/1250d2deb0d81380fc686c2f5265a493de85e7bc <GitHub159> [droolsjbpm-build-bootstrap/5.3.x] [JBRULES-3489] upgrade mvel version - mariofusco FYI, as discussed by e-mail, the following build can be used to test the changes we made for this ticket on top of ER6: http://hudson.qa.jboss.com/hudson/job/drools-5.3.x/438/artifact/drools-distribution/target/ Requires only the drools-core jar and the MVEL jar to be replaced on your ER6 binaries: drools-core-5.3.2-SNAPSHOT.jar mvel2-2.1.0.drools16.jar The fixed for this issue should be included in ER7. Please do verification on it. The fix is in and didn't break anything in ER7. Technical note added. If any revisions are required, please edit the "Technical Notes" field accordingly. All revisions will be proofread by the Engineering Content Services team. New Contents: When a JBoss BRMS instance is deployed into Gigaspaces container with the Java Security Manager enabled, accessing the context classloader is an extremely heavy operation (over 400 times slower) and caused thread contention among different threads running different sessions. This issue was resolved by removing the thread context class loader references from MVEL consequence execution. |