Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#3630 Macro hangs up on starting thread

severe bug
closed-invalid
nobody
macros (55)
5
2012-01-21
2011-12-12
Ken Turner
No

Something has gone wrong with beanshell macros that make use of threads. I have a number of macros that filter a selection and replace it with the modified output from the macro.

The following used to work fine. In jEdit 4.4.2 this macro hangs up. Specifically it doesn't enter the "run" method. I reverted to jEdit 4.4.1 and then jEdit 4.3.2, but the macro hangs up with these too. I went right back to jEdit 4.3Pre15 and it works fine there.

What has changed in the meantime? How can I get this working again.

----------------------------------------------------------------------------

// Format for LaTeX and return the selected LOTOS text, using the external
// "fmtl" filter and "lotos" style file.

String shell = "bash"; // set shell (path) name
String cmd = "/usr/local/bin/fmtl"; // set format filter path
String cmdName = shell + " " + cmd; // set external command name

String selected = textArea.getSelectedText(); // get selected text
String formatted = ""; // initialise formatted text
String endLine = "\n"; // end-of-line characters
String line; // line buffer

boolean endsNewline; // selected ends with newline?

Runtime runtime = Runtime.getRuntime(); // get runtime
Process process = runtime.exec(cmdName); // set external command

BufferedWriter out; // output to external process

Runnable inputRunnable; // input stream runnable
Thread inputThread; // input stream thread

if (selected == null) // no text selected?
textArea.getToolkit().beep(); // beep
else { // text selected
endsNewline = selected.endsWith(endLine);
inputRunnable = new Runnable() { // create input stream runnable
BufferedReader in; // input to external process
run() { // input stream run
in = // open input reader
new BufferedReader(new InputStreamReader(process.getInputStream()));
while((line = in.readLine()) != null) { // read formatted lines
if (!formatted.equals("")) // formatted text already?
formatted += endLine; // append newline
formatted += line; // append formatted line
}
in.close(); // close input reader
if (endsNewline) // selected ends with newline?
formatted += endLine; // append newline
textArea.setSelectedText(formatted); // replace selected text
};
};
inputThread = new Thread(inputRunnable); // create input stream thread
inputThread.start(); // start input thread
out = // open output writer
new BufferedWriter(new OutputStreamWriter(process.getOutputStream()));
out.write(selected); // send selected to process
out.close(); // close output writer
inputThread.join(); // wait for all input
}

Discussion

  • Ken Turner
    Ken Turner
    2011-12-12

    Sorry - it doesn't look like this is anything to do with jEdit. jEdit 4.4.2 on one PC hangs up running this macro, while jEdit 4.3Pre15 on another PC runs this macro OK. Both are using Windows XP, javaw from JDK 1.6.0_07, and bash/sh from CygWin 1.7.9-1. I now suspect that there's a subtle difference between the two PCs that's causing this problem, though I can't currently see what it is.

     
  • Ken Turner
    Ken Turner
    2011-12-12

    I installed jEdit 4.3Pre15 on the same PC as was running jEdit 4.4.2. On that PC, the macro works for jEdit 4.3Pre15 but hangs up for jEdit 4.4.2. So it does seem there is a difference between jEdit versions. Any ideas? Thanks!

     
  • Ken Turner
    Ken Turner
    2011-12-13

    I eventually tracked the macro hang-up to joining the thread that is started. The join fails to happen and the macro hangs up. In recent versions of jEdit (4.3+), the join doesn't finish. My temporary fix is:

    inputThread.join(1000); // wait for input (up to 1 sec)

    which gives up after 1 second. But there is something fundamental to do with threads that has changed. Is jEdit now limiting the number of concurrent threads?

    I also tried changing things so that variables used by the run method are either local to this or are final (as would be required by "straight" Java). But it's still the thread join that's the problem. There's nothing useful in the activity log by the way.

     
  • Dale Anson
    Dale Anson
    2011-12-13

    Have you tried doing a thread dump just to see if it has anything useful?

    I would guess what might be the problem is you're trying to run your thread outside of the EDT.

     
  • Ken Turner
    Ken Turner
    2011-12-13

    Thanks for the suggestion. However, I can't guess what a "thread dump" or "EDT" refer to. Can you clarify or suggest a procedure? Would this explain the change in recent jEdit versions?

     
  • Alan Ezust
    Alan Ezust
    2011-12-13

    Added this to the FAQ just now:

    <para> To obtain a thread dump, you must run jEdit with
    + <literal>java -jar jedit.jar</literal> from a command line
    + shell <emphasis role="bold">in the foreground</emphasis>,
    + wait for the hang or lockup, and type Ctrl+\
    + (or Ctrl+Break on Windows) into the shell window.
    + You should see a thread dump printed immediately that will
    + help diagnose the problem.
    + </para>

     
  • Dale Anson
    Dale Anson
    2011-12-13

    Another way to get a thread dump is to run jEdit as you normally would, then run visualvm. You can right click on the jEdit process from within visualvm and choose thread dump.

    http://visualvm.java.net/

    Here is a link to an older article about the Event Dispatch Thread. It is a little dated in that the SwingWorker examples are based on the old SwingWorker classes (pre Java 6). Java 6 and later now have the SwingWorker classes built in and the API is somewhat different than in the article.

    http://java.sun.com/products/jfc/tsc/articles/threads/threads1.html

     
  • Ken Turner
    Ken Turner
    2011-12-14

    Thank you for the explanations of how to get a thread dump. I followed the procedure of running the JAR, running the macro (which hung up jEdit), and then using Ctrl-Break. The results are below.

    Does this help to identify the problem? All I'm seeing here myself is that beanshell has started a thread and is waiting on it. The question for me is still what changed around jEdit 4.3.

    ----------------------------------------------------------------------------

    C:\PROGRA~1\jEdit>java -jar jedit.jar
    2011-12-14 18:42:09
    Full thread dump Java HotSpot(TM) Client VM (20.4-b02 mixed mode, sharing):

    "Thread-9" prio=6 tid=0x02caf400 nid=0x173c in Object.wait() [0x04acf000]
    java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    at java.lang.Object.wait(Object.java:485)
    at java.awt.EventQueue.invokeAndWait(Unknown Source)
    - locked <0x22a5b228> (a java.awt.EventQueue$1AWTInvocationLock)
    at org.gjt.sp.jedit.EditBus.send(EditBus.java:213)
    at
    org.gjt.sp.jedit.textarea.JEditTextArea.replaceSelection(JEditTextAre
    a.java:235)
    at
    org.gjt.sp.jedit.textarea.TextArea.setSelectedText(TextArea.java:1958
    )
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.gjt.sp.jedit.bsh.Reflect.invokeMethod(Reflect.java:134)
    at org.gjt.sp.jedit.bsh.Reflect.invokeObjectMethod(Reflect.java:80)
    at org.gjt.sp.jedit.bsh.Name.invokeMethod(Name.java:855)
    at
    org.gjt.sp.jedit.bsh.BSHMethodInvocation.eval(BSHMethodInvocation.jav
    a:75)
    at
    org.gjt.sp.jedit.bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.j
    ava:102)
    at
    org.gjt.sp.jedit.bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.j
    ava:47)
    at org.gjt.sp.jedit.bsh.BSHBlock.evalBlock(BSHBlock.java:130)
    at org.gjt.sp.jedit.bsh.BSHBlock.eval(BSHBlock.java:80)
    at org.gjt.sp.jedit.bsh.BshMethod.invokeImpl(BshMethod.java:362)
    at org.gjt.sp.jedit.bsh.BshMethod.invoke(BshMethod.java:258)
    at org.gjt.sp.jedit.bsh.BshMethod.invoke(BshMethod.java:186)
    at org.gjt.sp.jedit.bsh.This.invokeMethod(This.java:251)
    at org.gjt.sp.jedit.bsh.This.invokeMethod(This.java:172)
    at org.gjt.sp.jedit.bsh.XThis$Handler.invokeImpl(XThis.java:194)
    at org.gjt.sp.jedit.bsh.XThis$Handler.invoke(XThis.java:131)
    at $Proxy5.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

    "jEdit Worker #3" prio=6 tid=0x043ac800 nid=0x1088 waiting on condition
    [0x04a6f
    000]
    java.lang.Thread.State: WAITING (parking)
    at sun.misc.Unsafe.park(Native Method)
    - parking to wait for <0x287de840> (a
    java.util.concurrent.SynchronousQ
    ueue$TransferStack)
    at java.util.concurrent.locks.LockSupport.park(Unknown Source)
    at
    java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(Unkn
    own Source)
    at
    java.util.concurrent.SynchronousQueue$TransferStack.transfer(Unknown
    Source)
    at java.util.concurrent.SynchronousQueue.take(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.getTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown
    Source)
    at java.lang.Thread.run(Unknown Source)

    "jEdit Worker #2" prio=6 tid=0x030bf400 nid=0x1340 waiting on condition
    [0x0379f
    000]
    java.lang.Thread.State: WAITING (parking)
    at sun.misc.Unsafe.park(Native Method)
    - parking to wait for <0x287de840> (a
    java.util.concurrent.SynchronousQ
    ueue$TransferStack)
    at java.util.concurrent.locks.LockSupport.park(Unknown Source)
    at
    java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(Unkn
    own Source)
    at
    java.util.concurrent.SynchronousQueue$TransferStack.transfer(Unknown
    Source)
    at java.util.concurrent.SynchronousQueue.take(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.getTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown
    Source)
    at java.lang.Thread.run(Unknown Source)

    "jEdit Worker #1" prio=6 tid=0x03108c00 nid=0xc54 waiting on condition
    [0x0498f0
    00]
    java.lang.Thread.State: WAITING (parking)
    at sun.misc.Unsafe.park(Native Method)
    - parking to wait for <0x287de840> (a
    java.util.concurrent.SynchronousQ
    ueue$TransferStack)
    at java.util.concurrent.locks.LockSupport.park(Unknown Source)
    at
    java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(Unkn
    own Source)
    at
    java.util.concurrent.SynchronousQueue$TransferStack.transfer(Unknown
    Source)
    at java.util.concurrent.SynchronousQueue.take(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.getTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown
    Source)
    at java.lang.Thread.run(Unknown Source)

    "Swing-Shell" daemon prio=6 tid=0x0415d800 nid=0x994 waiting on condition
    [0x048
    ff000]
    java.lang.Thread.State: WAITING (parking)
    at sun.misc.Unsafe.park(Native Method)
    - parking to wait for <0x288ec200> (a
    java.util.concurrent.locks.Abstra
    ctQueuedSynchronizer$ConditionObject)
    at java.util.concurrent.locks.LockSupport.park(Unknown Source)
    at
    java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject
    .await(Unknown Source)
    at java.util.concurrent.LinkedBlockingQueue.take(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.getTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown
    Source)
    at sun.awt.shell.Win32ShellFolderManager2$ComInvoker$3.run(Unknown
    Sourc
    e)
    at java.lang.Thread.run(Unknown Source)

    "jEdit Worker #0" prio=6 tid=0x0415d400 nid=0x9c8 waiting on condition
    [0x03c6f0
    00]
    java.lang.Thread.State: WAITING (parking)
    at sun.misc.Unsafe.park(Native Method)
    - parking to wait for <0x287de840> (a
    java.util.concurrent.SynchronousQ
    ueue$TransferStack)
    at java.util.concurrent.locks.LockSupport.park(Unknown Source)
    at
    java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(Unkn
    own Source)
    at
    java.util.concurrent.SynchronousQueue$TransferStack.transfer(Unknown
    Source)
    at java.util.concurrent.SynchronousQueue.take(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.getTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown
    Source)
    at java.lang.Thread.run(Unknown Source)

    "jEdit server daemon [C:\Documents and Settings\kjt\.jedit\server]" daemon
    prio=
    6 tid=0x043b7000 nid=0x1544 runnable [0x03b5f000]
    java.lang.Thread.State: RUNNABLE
    at java.net.PlainSocketImpl.socketAccept(Native Method)
    at java.net.PlainSocketImpl.accept(Unknown Source)
    - locked <0x28098ec0> (a java.net.SocksSocketImpl)
    at java.net.ServerSocket.implAccept(Unknown Source)
    at java.net.ServerSocket.accept(Unknown Source)
    at org.gjt.sp.jedit.EditServer.run(EditServer.java:132)

    "jEdit I/O #4" prio=2 tid=0x04456800 nid=0x110c in Object.wait()
    [0x03b0f000]
    java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    at java.lang.Object.wait(Object.java:485)
    at org.gjt.sp.util.WorkThread.doRequests(WorkThread.java:201)
    - locked <0x280f4e18> (a java.lang.Object)
    at org.gjt.sp.util.WorkThread.run(WorkThread.java:157)

    "jEdit I/O #3" prio=2 tid=0x04455400 nid=0x1594 in Object.wait()
    [0x03abf000]
    java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    at java.lang.Object.wait(Object.java:485)
    at org.gjt.sp.util.WorkThread.doRequests(WorkThread.java:201)
    - locked <0x280f4e18> (a java.lang.Object)
    at org.gjt.sp.util.WorkThread.run(WorkThread.java:157)

    "jEdit I/O #2" prio=2 tid=0x04454800 nid=0xe00 in Object.wait()
    [0x03a6f000]
    java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    at java.lang.Object.wait(Object.java:485)
    at org.gjt.sp.util.WorkThread.doRequests(WorkThread.java:201)
    - locked <0x280f4e18> (a java.lang.Object)
    at org.gjt.sp.util.WorkThread.run(WorkThread.java:157)

    "jEdit I/O #1" prio=2 tid=0x04454000 nid=0x1204 in Object.wait()
    [0x03a1f000]
    java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    at java.lang.Object.wait(Object.java:485)
    at org.gjt.sp.util.WorkThread.doRequests(WorkThread.java:201)
    - locked <0x280f4e18> (a java.lang.Object)
    at org.gjt.sp.util.WorkThread.run(WorkThread.java:157)

    "DestroyJavaVM" prio=6 tid=0x003b7000 nid=0x144c waiting on condition
    [0x0000000
    0]
    java.lang.Thread.State: RUNNABLE

    "TimerQueue" daemon prio=6 tid=0x03eed400 nid=0x17bc in Object.wait()
    [0x0392f00
    0]
    java.lang.Thread.State: TIMED_WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    at javax.swing.TimerQueue.run(Unknown Source)
    - locked <0x2859be28> (a javax.swing.TimerQueue)
    at java.lang.Thread.run(Unknown Source)

    "D3D Screen Updater" daemon prio=8 tid=0x030d0000 nid=0x14ec in
    Object.wait() [0
    x0383f000]
    java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    - waiting on <0x27f62e60> (a java.lang.Object)
    at sun.java2d.d3d.D3DScreenUpdateManager.run(Unknown Source)
    - locked <0x27f62e60> (a java.lang.Object)
    at java.lang.Thread.run(Unknown Source)

    "AWT-EventQueue-0" prio=6 tid=0x030cac00 nid=0x17e8 in Object.wait()
    [0x037ed000
    ]
    java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    at java.lang.Thread.join(Unknown Source)
    - locked <0x22de0000> (a java.lang.Thread)
    at java.lang.Thread.join(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.gjt.sp.jedit.bsh.Reflect.invokeMethod(Reflect.java:134)
    at org.gjt.sp.jedit.bsh.Reflect.invokeObjectMethod(Reflect.java:80)
    at org.gjt.sp.jedit.bsh.Name.invokeMethod(Name.java:855)
    at
    org.gjt.sp.jedit.bsh.BSHMethodInvocation.eval(BSHMethodInvocation.jav
    a:75)
    at
    org.gjt.sp.jedit.bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.j
    ava:102)
    at
    org.gjt.sp.jedit.bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.j
    ava:47)
    at org.gjt.sp.jedit.bsh.BSHBlock.evalBlock(BSHBlock.java:130)
    at org.gjt.sp.jedit.bsh.BSHBlock.eval(BSHBlock.java:80)
    at org.gjt.sp.jedit.bsh.BSHBlock.eval(BSHBlock.java:46)
    at org.gjt.sp.jedit.bsh.BSHIfStatement.eval(BSHIfStatement.java:51)
    at org.gjt.sp.jedit.bsh.Interpreter.eval(Interpreter.java:644)
    at org.gjt.sp.jedit.BeanShell._runScript(BeanShell.java:331)
    at org.gjt.sp.jedit.BeanShell._runScript(BeanShell.java:279)
    at org.gjt.sp.jedit.BeanShell.runScript(BeanShell.java:205)
    at
    org.gjt.sp.jedit.Macros$BeanShellHandler.runMacro(Macros.java:1040)
    at org.gjt.sp.jedit.Macros$Macro.invoke(Macros.java:462)
    at org.gjt.sp.jedit.Macros.runScript(Macros.java:116)
    at org.gjt.sp.jedit.Macros.showRunScriptDialog(Macros.java:84)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.gjt.sp.jedit.bsh.Reflect.invokeMethod(Reflect.java:134)
    at org.gjt.sp.jedit.bsh.Reflect.invokeStaticMethod(Reflect.java:98)
    at org.gjt.sp.jedit.bsh.Name.invokeMethod(Name.java:871)
    at
    org.gjt.sp.jedit.bsh.BSHMethodInvocation.eval(BSHMethodInvocation.jav
    a:75)
    at
    org.gjt.sp.jedit.bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.j
    ava:102)
    at
    org.gjt.sp.jedit.bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.j
    ava:47)
    at org.gjt.sp.jedit.bsh.BSHBlock.evalBlock(BSHBlock.java:130)
    at org.gjt.sp.jedit.bsh.BSHBlock.eval(BSHBlock.java:80)
    at org.gjt.sp.jedit.bsh.BshMethod.invokeImpl(BshMethod.java:362)
    at org.gjt.sp.jedit.bsh.BshMethod.invoke(BshMethod.java:258)
    at org.gjt.sp.jedit.bsh.BshMethod.invoke(BshMethod.java:186)
    at
    org.gjt.sp.jedit.BeanShellFacade.runCachedBlock(BeanShellFacade.java:
    225)
    at org.gjt.sp.jedit.BeanShell.runCachedBlock(BeanShell.java:423)
    at org.gjt.sp.jedit.BeanShellAction.invoke(BeanShellAction.java:73)
    at
    org.gjt.sp.jedit.gui.InputHandler.invokeAction(InputHandler.java:352)

    at org.gjt.sp.jedit.jEdit$4.invokeAction(jEdit.java:3289)
    at org.gjt.sp.jedit.jEdit$4.invokeAction(jEdit.java:3271)
    at
    org.gjt.sp.jedit.EditAction$Wrapper.actionPerformed(EditAction.java:2
    22)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$Handler.actionPerformed(Unknown
    Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown
    Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.AbstractButton.doClick(Unknown Source)
    at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
    at
    javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown
    Source)
    at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at javax.swing.JComponent.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown
    Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.awt.EventQueue.access$000(Unknown Source)
    at java.awt.EventQueue$1.run(Unknown Source)
    at java.awt.EventQueue$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at
    java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown
    Source)
    at
    java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown
    Source)
    at java.awt.EventQueue$2.run(Unknown Source)
    at java.awt.EventQueue$2.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at
    java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown
    Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown
    Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown
    Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)

    "AWT-Shutdown" prio=6 tid=0x02fd1000 nid=0x1488 in Object.wait()
    [0x032af000]
    java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    at java.lang.Object.wait(Object.java:485)
    at sun.awt.AWTAutoShutdown.run(Unknown Source)
    - locked <0x27f63070> (a java.lang.Object)
    at java.lang.Thread.run(Unknown Source)

    "AWT-Windows" daemon prio=6 tid=0x02c99000 nid=0x7b0 runnable [0x032ff000]
    java.lang.Thread.State: RUNNABLE
    at sun.awt.windows.WToolkit.eventLoop(Native Method)
    at sun.awt.windows.WToolkit.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

    "Java2D Disposer" daemon prio=10 tid=0x02f82800 nid=0x16ac in Object.wait()
    [0x0
    325f000]
    java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    at java.lang.ref.ReferenceQueue.remove(Unknown Source)
    - locked <0x27f63178> (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(Unknown Source)
    at sun.java2d.Disposer.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

    "Low Memory Detector" daemon prio=6 tid=0x02c57c00 nid=0x1384 runnable
    [0x000000
    00]
    java.lang.Thread.State: RUNNABLE

    "C1 CompilerThread0" daemon prio=10 tid=0x02c52000 nid=0x154c waiting on
    conditi
    on [0x00000000]
    java.lang.Thread.State: RUNNABLE

    "Attach Listener" daemon prio=10 tid=0x02c50800 nid=0x660 runnable
    [0x00000000]
    java.lang.Thread.State: RUNNABLE

    "Signal Dispatcher" daemon prio=10 tid=0x02c4f000 nid=0xc44 waiting on
    condition
    [0x00000000]
    java.lang.Thread.State: RUNNABLE

    "Finalizer" daemon prio=8 tid=0x02c48400 nid=0x1710 in Object.wait()
    [0x02ddf000
    ]
    java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    at java.lang.ref.ReferenceQueue.remove(Unknown Source)
    - locked <0x27f633d0> (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(Unknown Source)
    at java.lang.ref.Finalizer$FinalizerThread.run(Unknown Source)

    "Reference Handler" daemon prio=10 tid=0x02c46c00 nid=0x8ac in
    Object.wait() [0x
    02d8f000]
    java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    at java.lang.Object.wait(Object.java:485)
    at java.lang.ref.Reference$ReferenceHandler.run(Unknown Source)
    - locked <0x27f63460> (a java.lang.ref.Reference$Lock)

    "VM Thread" prio=10 tid=0x02c0ac00 nid=0xe24 runnable

    "VM Periodic Task Thread" prio=10 tid=0x02c62c00 nid=0xd50 waiting on
    condition

    JNI global references: 2397

    Heap
    def new generation total 4928K, used 1087K [0x22990000, 0x22ee0000,
    0x27ee000
    0)
    eden space 4416K, 19% used [0x22990000, 0x22a627a8, 0x22de0000)
    from space 512K, 48% used [0x22de0000, 0x22e1d7d0, 0x22e60000)
    to space 512K, 0% used [0x22e60000, 0x22e60000, 0x22ee0000)
    tenured generation total 10944K, used 10647K [0x27ee0000, 0x28990000,
    0x32990
    000)
    the space 10944K, 97% used [0x27ee0000, 0x28945ed8, 0x28946000,
    0x28990000)
    compacting perm gen total 12288K, used 6541K [0x32990000, 0x33590000,
    0x369900
    00)
    the space 12288K, 53% used [0x32990000, 0x32ff35c0, 0x32ff3600,
    0x33590000)
    ro space 10240K, 51% used [0x36990000, 0x36ebd0b8, 0x36ebd200,
    0x37390000)
    rw space 12288K, 54% used [0x37390000, 0x37a29570, 0x37a29600,
    0x37f90000)

     
  • Ken Turner
    Ken Turner
    2011-12-16

    I spent a while investigating VisualVM, thread dumps, SwingWorker, etc. but got nowhere. I then discovered accidentally that if I moved the following line:

    textArea.setSelectedText(formatted);

    from inside the "run" method to after the thread join then everything worked fine. This is something to do with not being able to access Swing components from outside the Event Dispatch Thread (which was effectively one of the hints given).

    I still don't know how jEdit 4.3+ changed to cause this problem, but I'm back in business now. This bug report can be closed.

     
    • status: open --> closed-invalid