JDK-7153867 : Endless loop in sun.util.locale.LocaleObjectCache.get(BaseLocale)
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util:i18n
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_7
  • CPU: x86
  • Submitted: 2012-03-14
  • Updated: 2012-03-30
  • Resolved: 2012-03-15
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.7.0_03"
Java(TM) SE Runtime Environment (build 1.7.0_03-b05)
Java HotSpot(TM) Client VM (build 22.1-b02, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]

A DESCRIPTION OF THE PROBLEM :
I work on a Windows 7 machine with Locale.getDefault(Category.DISPLAY) returning "en_US" and Locale.getDefault(Category.FORMAT) returning "de_CH". Every few days, I run into an endless loop in sun.util.locale.LocaleObjectCache.get(BaseLocale) in lines 69, 70, 71, 72, 76.

Unfortunately, I neither have the source of LocaleObjectCache nor is the JDK compiled with useful debug flags, so it's hard to see what really happens. But from what I could see in the bytecode of LocaleObjectCache#get(K), map.putIfAbsent(..) is called and always returns a non-null LocaleObjectCache$CacheEntry, but calling get() on that entry returns null.

This bug makes JavaSE 7 unusable for production work.

I found bug 7022407, but the explanation about SoftReferences that are cleared by the GC doesn't seem to apply here. I connected YourKit and forced a few garbage collections, but that didn't help.

If the fix delivered for that bug could still help, then please backport it to JavaSE 7.

REGRESSION.  Last worked in version 6u29


ERROR MESSAGES/STACK TRACES THAT OCCUR :
"main" prio=6 tid=0x00e0b000 nid=0x23a0 runnable [0x00f8e000]
   java.lang.Thread.State: RUNNABLE
        at java.util.concurrent.locks.AbstractQueuedSynchronizer.release(AbstractQueuedSynchronizer.java:1260)
        at java.util.concurrent.locks.ReentrantLock.unlock(ReentrantLock.java:460)
        at java.util.concurrent.ConcurrentHashMap$Segment.put(ConcurrentHashMap.java:404)
        at java.util.concurrent.ConcurrentHashMap.putIfAbsent(ConcurrentHashMap.java:1084)
        at sun.util.locale.LocaleObjectCache.get(LocaleObjectCache.java:71)
        at java.util.ResourceBundle$Control.getCandidateLocales(ResourceBundle.java:2303)
        at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1291)
        at java.util.ResourceBundle.getBundle(ResourceBundle.java:796)
        at org.eclipse.jdt.internal.compiler.batch.Main$ResourceBundleFactory.getBundle(Main.java:1274)
        - locked <0x4d168778> (a java.lang.Class for org.eclipse.jdt.internal.compiler.batch.Main$ResourceBundleFactory)
        at org.eclipse.jdt.internal.compiler.batch.Main.relocalize(Main.java:4247)
        at org.eclipse.jdt.internal.compiler.batch.Main.relocalize(Main.java:4241)
        at org.eclipse.jdt.internal.compiler.batch.Main.<init>(Main.java:1471)
        at org.eclipse.jdt.core.dom.ASTParser.getClasspath(ASTParser.java:233)
        at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:1184)
        at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:807)
        at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider$1.run(ASTProvider.java:544)
        at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
        at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.createAST(ASTProvider.java:537)
        at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.getAST(ASTProvider.java:480)
        at org.eclipse.jdt.ui.SharedASTProvider.getAST(SharedASTProvider.java:128)
        at org.eclipse.jdt.internal.corext.refactoring.nls.NLSHintHelper.getResourceBundleName(NLSHintHelper.java:203)
        at org.eclipse.jdt.internal.corext.refactoring.nls.NLSHintHelper.getAccessorClassReference(NLSHintHelper.java:180)
        at org.eclipse.jdt.internal.corext.refactoring.nls.NLSHintHelper.getAccessorClassReference(NLSHintHelper.java:97)
        at org.eclipse.jdt.internal.ui.javaeditor.NLSKeyHyperlinkDetector.detectHyperlinks(NLSKeyHyperlinkDetector.java:76)
        at org.eclipse.ui.texteditor.HyperlinkDetectorRegistry$HyperlinkDetectorDelegate.detectHyperlinks(HyperlinkDetectorRegistry.java:80)
        at org.eclipse.jface.text.hyperlink.HyperlinkManager.findHyperlinks(HyperlinkManager.java:286)
        - locked <0x294e5308> (a [Lorg.eclipse.jface.text.hyperlink.IHyperlinkDetector;)
        at org.eclipse.jface.text.hyperlink.HyperlinkManager.findHyperlinks(HyperlinkManager.java:258)
        at org.eclipse.jface.text.hyperlink.HyperlinkManager.mouseMove(HyperlinkManager.java:462)
        at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:212)
        at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
        at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
        at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701)
        at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665)
        at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499)
        at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679)
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
        at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)
        at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
        at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
        at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
        at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
        at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
        at org.eclipse.equinox.launcher.Main.main(Main.java:1414)

REPRODUCIBILITY :
This bug can be reproduced often.

CUSTOMER SUBMITTED WORKAROUND :
Don't know any, except for going back to JavaSE 6.