This issue has been created
There are 3 updates.
 
 
XWiki Commons / cid:jira-generated-image-avatar-fc06555d-f544-4915-a542-8f654164656f XCOMMONS-3908 Open

Concurrent property conversions block each other on a lock shared by the whole JVM

 
View issue   ·   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-0f1edc98-ae19-4f91-9ac7-90aaa91fb1e6 Michael Hamann created this issue on 18/Nov/26 12:38
 
Summary: Concurrent conversions to a primitive type or String block each other on a lock shared by the whole JVM
Issue Type: cid:jira-generated-image-avatar-fc06555d-f544-4915-a542-8f654164656f Bug
Affects Versions: 17.10.0
Assignee: Unassigned
Components: Properties
Created: 18/Nov/26 12:38
Labels: performance
Priority: cid:jira-generated-image-static-major-625b0aea-97a8-49f0-aa92-069962a307b1 Major
Reporter: Michael Hamann
Description:

Every conversion that falls back to ConvertUtilsConverter (the default Converter of the ConverterManager) takes a lock shared by the whole JVM. Under load, request threads queue on it and pages get slow even though neither the CPU nor the database is saturated.

Impact

On xwiki.org, Glowroot's aggregated profile of /xwiki/bin/view/Main/WebHome during a load spike (2026-11-18, 09:55–10:20 UTC, 69,955 samples) has 48% of the samples BLOCKED in org.apache.commons.beanutils.ContextClassLoaderLocal.get, reached from ConvertUtilsConverter.convert. The main callers were:

  • DefaultLoggerConfiguration.isDeprecatedLogEnabled (about 22,000 samples), which converts the logging.deprecated.enabled configuration property to a boolean each time a Velocity context is set up, e.g. for every icon rendered and every wiki UI extension's parameters;
  • DefaultBeanManager.populate (about 9,000 samples), i.e. macro parameters;
  • HibernateConfiguration.isMigrationEnabled (about 1,200 samples), called on every Hibernate transaction.

Cause

ConvertUtilsConverter calls the static ConvertUtils.convert, which gets its instance from BeanUtilsBean.getInstance(). BeanUtils keeps one instance per context class loader in a ContextClassLoaderLocal, whose get() method is synchronized on a single static object, so every conversion in the JVM goes through the same monitor.

Because the instance depends on the context class loader, the strict converters that ConvertUtilsConverter#initialize() registers (throwing an exception instead of returning a default value) are only used under the context class loader that was active when the component was initialized. Request threads use their own context class loader (see ThreadClassloaderExecutionContextInitializer), so in practice an invalid value converted to a primitive type or its wrapper becomes false or 0, which is XCOMMONS-3847.

Fix

Make ConvertUtilsConverter use its own ConvertUtilsBean instance. To keep the behavior that request threads have today, and to keep the fix safe to backport, this instance uses the default (lenient) BeanUtils converters. Making invalid values fail is left to XCOMMONS-3847.

 
 

3 updates

 
cid:jira-generated-image-avatar-0f1edc98-ae19-4f91-9ac7-90aaa91fb1e6 Changes by Michael Hamann on 18/Nov/26 12:39
 
Summary: Concurrent property conversions to a primitive type or String block each other on a lock shared by the whole JVM
Fix Version: 18.10.0-rc-1
Assignee: Michael Hamann