GeoTools
  1. GeoTools
  2. GEOT-4535

Deadlock in AbstractMapPane and MapContent

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 8.4
    • Fix Version/s: None
    • Component/s: swing
    • Labels:
      None
    • Environment:
      Windows 7, Java 7 latest

      Description

      AbstractMapPane's getScreenToWorldTransform() method locks the following
      two locks:

      AbstractMapPane.paramsLock

      and then

      mapContent.monitor (mapContent.getViewport())

      Mapcontent's addLayers() method locks:

      mapContent.monitor

      then fires an event change when AbstractMapPane.layerAdded() is called, which locks AbstractMapPane.paramsLock

      With good timing, it causes deadlock.

      See stack trace here:

      Thread: MapLayerMsgHandler 6, Group=main, Prio=6, State=WAITING

      sun.misc.Unsafe.park(Native Method)
      java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)
      java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:834)
      java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:867)
      java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1197)
      java.util.concurrent.locks.ReentrantReadWriteLock$WriteLock.lock(ReentrantReadWriteLock.java:945)
      org.geotools.swing.AbstractMapPane.layerAdded(AbstractMapPane.java:786) AbstractMapPane.paramsLock
      com.siemens.pse.common.geo.modules.map.AVLSMapPane.layerAdded(AVLSMapPane.java:1105)
      org.geotools.map.MapContent.fireLayerAdded(MapContent.java:467) MapContent.monitor.readLock()
      org.geotools.map.MapContent$LayerList.addAllAbsent(MapContent.java:1042)
      org.geotools.map.MapContent.addLayers(MapContent.java:388) MapContent.monitor.writeLock()
      com.siemens.pse.common.geo.core.map.DefaultMap.addLayerWrapper(DefaultMap.java:153)
      com.siemens.pse.common.geo.modules.map.MapDisplayHandler.handleAddLayers(MapDisplayHandler.java:191)
      com.siemens.pse.common.geo.modules.map.MapDisplayHandler.handleLayerMessage(MapDisplayHandler.java:473)
      com.siemens.pse.common.geo.modules.map.MapDisplayHandler.access$3(MapDisplayHandler.java:409)
      com.siemens.pse.common.geo.modules.map.MapDisplayHandler$MapLayerMsgHandler.process(MapDisplayHandler.java:379)
      com.siemens.pse.common.geo.modules.map.MapDisplayHandler$MapLayerMsgHandler.process(MapDisplayHandler.java:1)
      com.siemens.pse.common.threading.SmartQueue.run(SmartQueue.java:287)

      Thread: AWT-EventQueue-0, Group=main, Prio=6, State=WAITING

      sun.misc.Unsafe.park(Native Method)
      java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)
      java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:834)
      java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireShared(AbstractQueuedSynchronizer.java:964)
      java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireShared(AbstractQueuedSynchronizer.java:1282)
      java.util.concurrent.locks.ReentrantReadWriteLock$ReadLock.lock(ReentrantReadWriteLock.java:731)
      org.geotools.map.MapContent.getViewport(MapContent.java:662) MapContent.monitor.readLock()
      com.siemens.pse.common.geo.modules.map.AVLSMapPane.getScreenToWorldTransform(AVLSMapPane.java:1054) AbstractMapPane.paramsLock.readLock()
      org.geotools.swing.event.DefaultMapMouseEventDispatcher.convertEvent(DefaultMapMouseEventDispatcher.java:222)
      org.geotools.swing.event.DefaultMapMouseEventDispatcher.mouseMoved(DefaultMapMouseEventDispatcher.java:192)
      java.awt.AWTEventMulticaster.mouseMoved(AWTEventMulticaster.java:330)

        Activity

        Hide
        Zsolt Sandor added a comment -
        This bug seem much like https://jira.codehaus.org/browse/GEOT-4345 just with different locks. Can someone please take a look at
        it and provide a solution or fix?
        Show
        Zsolt Sandor added a comment - This bug seem much like https://jira.codehaus.org/browse/GEOT-4345 just with different locks. Can someone please take a look at it and provide a solution or fix?

          People

          • Assignee:
            Unassigned
            Reporter:
            Zsolt Sandor
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: