Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-5074

SwingBuilder never shuts down the default executor service

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.8.2, 1.8.3, 1.9-beta-4
    • 2.1.0-rc-1
    • Groovy Console

    Description

      If you use the swingbuilder.doOutside() method, the execution is delegated to an executor service which is set globally (static variable). The problem is that when application exits, the executor service is never shutdown, so the VM won't exit.

      Steps to reproduce :

      1. Open Groovy Console
      2. any code like "println 'hello'" will do
      3. Open AST Browser (which internally calls doOutside)
      4. Exit the console with the menu. The application won't return
      5. kill -3 <pid of the groovy console> to obtain a thread dump

      The thread dump shows threads waiting from the executor service :

      "pool-1-thread-2" prio=10 tid=0x0000000040cbe800 nid=0x1204 waiting on condition [0x00007f1a06478000]
         java.lang.Thread.State: WAITING (parking)
      	at sun.misc.Unsafe.park(Native Method)
      	- parking to wait for  <0x0000000784fe14b0> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
      	at java.util.concurrent.locks.LockSupport.park(LockSupport.java:156)
      	at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1987)
      	at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:399)
      	at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:947)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
      	at java.lang.Thread.run(Thread.java:662)
      
      "pool-1-thread-1" prio=10 tid=0x0000000041c6b800 nid=0x1203 waiting on condition [0x00007f1a06579000]
         java.lang.Thread.State: WAITING (parking)
      	at sun.misc.Unsafe.park(Native Method)
      	- parking to wait for  <0x0000000784fe14b0> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
      	at java.util.concurrent.locks.LockSupport.park(LockSupport.java:156)
      	at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1987)
      	at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:399)
      	at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:947)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
      	at java.lang.Thread.run(Thread.java:662)
      
      

      Attachments

        Activity

          People

            aalmiray Andres Almiray
            melix Cédric Champeau
            Votes:
            3 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: