Anonymous | Login
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
TypeCategorySeverityReproducibilityDate SubmittedLast Update
design defect[Openbravo ERP] A. Platformminorhave not tried2017-10-19 13:112017-11-20 12:43
ReporteralostaleView Statuspublic 
Assigned Toalostale 
PrioritynormalResolutionfixedFixed in Version3.0PR18Q1
StatusclosedFix in branchFixed in SCM revisionea74193b74fa
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned Tocaristu
Web browser
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo

0037115: HQL constant parsing causes contention

DescriptionWith high concurrency contention at JVM level occurs when Hibernate is creating AST tree for queries at

        at org.hibernate.util.ReflectHelper.classForName(
        at org.hibernate.util.ReflectHelper.getConstantValue(

This is caused because HQL allows to include Java constant values, to determine whether a token is or not a constant it performs a classForName whenever it includes a dot, which finally reaches a synchronized block causing this contention. More info here [1].

This is a Hibernate issue HHH-4959 that's fixed starting from 5.2.6 and HHH-11377 (5.2.7).

[1] [^]

Steps To ReproduceExecute attached test case profiling monitor locks
  -Check there is huge contention at:

   java.lang.Thread.State: BLOCKED
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(
- waiting to lock <334e3ea4> (a java.lang.Object) owned by "ajp-nio-8009-exec-46" t@125
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(
        at org.hibernate.util.ReflectHelper.classForName(
        at org.hibernate.util.ReflectHelper.getConstantValue(
        at org.hibernate.hql.ast.QueryTranslatorImpl$JavaConstantConverter.handleDotStructure(
at org.hibernate.hql.ast.QueryTranslatorImpl$JavaConstantConverter.visit(
at org.hibernate.hql.ast.util.NodeTraverser.visitDepthFirst(
        at org.hibernate.hql.ast.util.NodeTraverser.traverseDepthFirst(
        at org.hibernate.hql.ast.QueryTranslatorImpl.parse(
        at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(
        - locked <56ccf607> (a org.hibernate.hql.ast.QueryTranslatorImpl)
        at org.hibernate.hql.ast.QueryTranslatorImpl.compile(
        at org.hibernate.engine.query.HQLQueryPlan.<init>(
        at org.hibernate.engine.query.HQLQueryPlan.<init>(
        at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(
        at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(
        at org.hibernate.impl.AbstractSessionImpl.createQuery(
        at org.hibernate.impl.SessionImpl.createQuery(
Proposed SolutionBackport issues HHH-4959[1][2] and its related HHH-11377[3][4].

Consider bakporting only changes to so that this is enforced and cannot be configured so the complexity of the backport is significantly reduced.

Note this would limit usage of Java constants in HQL to only those that conform "valid" Java constant convention (basically package name in lower case, Java class starting by a capital letter and constant field name all upper case: [a-z\\d]+\\.([A-Z]{1}[a-z\\d]+)+\\$?([A-Z]{1}[a-z\\d]+)*\\.[A-Z_\\$]+

[1] [^]
[2] [^]
[3] [^]
[4] [^]
Attached Files? file icon [^] (2,305 bytes) 2017-10-27 15:15
png file icon Selection_226.png [^] (69,563 bytes) 2017-10-27 15:15

png file icon Selection_227.png [^] (23,962 bytes) 2017-10-27 15:16

- Relationships Relation Graph ] Dependency Graph ]
related to feature request 0037064 closedcaristu upgrade hibernate 

-  Notes
hgbot (developer)
2017-11-13 13:09

Repository: erp/devel/pi
Changeset: ea74193b74fa03750c0d26bcb2da2a1103079969
Author: Asier Lostalé <asier.lostale <at>>
Date: Thu Nov 09 10:41:46 2017 +0100
URL: [^]

fixed 37115, fixed 35271: hibernate performance improvements

  * 37115: HQL constant parsing causes contention
     Backports Hibernate issues HHH-4959 and HHH-11377, preventing in most of
     the cases to verify whether a HQL token is a constant which invokes an
     expensive classForName.

  * 35271: OBCriteria overhead
     OBCriteria caused overhead because everytime a critieria was executed, entity
     implementors (java class) was checked. As for a given entity its implementors
     are constant, they can be safelly cached. Note this cache is fixed in size as,
     at most, it will contain an entry per entity. See HHH-11495.

M lib/runtime/hibernate3-patched.jar
caristu (developer)
2017-11-20 12:43


- Issue History
Date Modified Username Field Change
2017-10-19 13:11 alostale New Issue
2017-10-19 13:11 alostale Assigned To => platform
2017-10-19 13:11 alostale Modules => Core
2017-10-19 13:11 alostale Triggers an Emergency Pack => No
2017-10-19 13:12 alostale Description Updated View Revisions
2017-10-19 13:12 alostale Steps to Reproduce Updated View Revisions
2017-10-19 13:12 alostale Relationship added related to 0037064
2017-10-19 13:12 alostale Status new => acknowledged
2017-10-19 14:07 alostale Description Updated View Revisions
2017-10-19 14:09 alostale Description Updated View Revisions
2017-10-19 14:12 alostale Description Updated View Revisions
2017-10-19 14:13 alostale Description Updated View Revisions
2017-10-27 13:18 alostale Tag Attached: Performance
2017-10-27 15:14 alostale Steps to Reproduce Updated View Revisions
2017-10-27 15:15 alostale File Added:
2017-10-27 15:15 alostale File Added: Selection_226.png
2017-10-27 15:16 alostale File Added: Selection_227.png
2017-11-13 13:09 hgbot Checkin
2017-11-13 13:09 hgbot Note Added: 0100480
2017-11-13 13:09 hgbot Status acknowledged => resolved
2017-11-13 13:09 hgbot Resolution open => fixed
2017-11-13 13:09 hgbot Fixed in SCM revision => [^]
2017-11-13 13:10 alostale Assigned To platform => alostale
2017-11-13 13:11 alostale Review Assigned To => caristu
2017-11-20 12:43 caristu Note Added: 0100619
2017-11-20 12:43 caristu Status resolved => closed
2017-11-20 12:43 caristu Fixed in Version => 3.0PR18Q1

Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker