[ 
https://issues.apache.org/jira/browse/CALCITE-1594?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Julian Hyde updated CALCITE-1594:
---------------------------------
    Summary: ConventionTraitDef.getConversionData() is not thread-safe  (was: 
Test suite hangs, with many threads in ConventionTraitDef.getConversionData and 
waiting to lock a WeakHashMap)

> ConventionTraitDef.getConversionData() is not thread-safe
> ---------------------------------------------------------
>
>                 Key: CALCITE-1594
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1594
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Julian Hyde
>            Assignee: Julian Hyde
>             Fix For: 1.12.0
>
>
> Test suite hangs with several threads in {{WeakHashMap.get}}, all called from 
> {{ConventionTraitDef.getConversionData}} and using the same table.
> It is not a deadlock; all but one threads are waiting for a lock, but the 
> thread that has the lock and is runnable.
> Abbreviated stack trace:
> {noformat}
> Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.72-b15 mixed mode):
> ...
> "pool-1-thread-7" #20 daemon prio=5 os_prio=0 tid=0x00007f3cf4003000 
> nid=0x1f12 runnable [0x00007f3d3f8f4000]
>    java.lang.Thread.State: RUNNABLE
>       at java.util.WeakHashMap.expungeStaleEntries(WeakHashMap.java:341)
>       - locked <0x00000000a08d14a8> (a java.lang.ref.ReferenceQueue)
>       at java.util.WeakHashMap.getTable(WeakHashMap.java:350)
>       at java.util.WeakHashMap.get(WeakHashMap.java:397)
>       at 
> org.apache.calcite.plan.ConventionTraitDef.getConversionData(ConventionTraitDef.java:203)
>       at 
> org.apache.calcite.plan.ConventionTraitDef.convert(ConventionTraitDef.java:129)
>       at 
> org.apache.calcite.plan.ConventionTraitDef.convert(ConventionTraitDef.java:46)
>       at 
> org.apache.calcite.plan.volcano.VolcanoPlanner.changeTraitsUsingConverters(VolcanoPlanner.java:1197)
> ...
> "pool-1-thread-8" #19 daemon prio=5 os_prio=0 tid=0x00007f3cec001000 
> nid=0x1f11 waiting for monitor entry [0x00007f3d3f9f5000]
>    java.lang.Thread.State: BLOCKED (on object monitor)
>       at java.util.WeakHashMap.expungeStaleEntries(WeakHashMap.java:319)
>       - waiting to lock <0x00000000a08d14a8> (a java.lang.ref.ReferenceQueue)
>       at java.util.WeakHashMap.getTable(WeakHashMap.java:350)
>       at java.util.WeakHashMap.get(WeakHashMap.java:397)
>       at 
> org.apache.calcite.plan.ConventionTraitDef.getConversionData(ConventionTraitDef.java:203)
>       at 
> org.apache.calcite.plan.ConventionTraitDef.convert(ConventionTraitDef.java:129)
>       at 
> org.apache.calcite.plan.ConventionTraitDef.convert(ConventionTraitDef.java:46)
>       at 
> org.apache.calcite.plan.volcano.VolcanoPlanner.changeTraitsUsingConverters(VolcanoPlanner.java:1197)
> ...
> "pool-1-thread-6" #17 daemon prio=5 os_prio=0 tid=0x00007f3ce8001000 
> nid=0x1f0f waiting for monitor entry [0x00007f3d3fbf8000]
>    java.lang.Thread.State: BLOCKED (on object monitor)
>       at java.util.WeakHashMap.expungeStaleEntries(WeakHashMap.java:319)
>       - waiting to lock <0x00000000a08d14a8> (a java.lang.ref.ReferenceQueue)
>       at java.util.WeakHashMap.getTable(WeakHashMap.java:350)
>       at java.util.WeakHashMap.get(WeakHashMap.java:397)
>       at 
> org.apache.calcite.plan.ConventionTraitDef.getConversionData(ConventionTraitDef.java:203)
> ...
> {noformat}
> Hypothesis: we should be synchronizing access to 
> {{ConventionTraitDef.plannerConversionMap}}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to