Script Editor in IJ1 Macro hangs (almost) forever -> https://sites.imagej.net/ issue?

Hello,

Currently, at my work location (don’t know how global this is), if you do File>New>Text Window and select Language>IJ1 Macro, FIJI stalls for about a minute, and then crashes with this error:

java.net.SocketException: Connection reset
	at java.net.SocketInputStream.read(SocketInputStream.java:210)
	at java.net.SocketInputStream.read(SocketInputStream.java:141)
	at sun.security.ssl.InputRecord.readFully(InputRecord.java:465)
	at sun.security.ssl.InputRecord.read(InputRecord.java:503)
	at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:983)
	at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1385)
	at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1413)
	at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1397)
	at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:559)
	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1564)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:263)
	at java.net.URL.openStream(URL.java:1045)
	at net.imagej.legacy.plugin.MacroAutoCompletionProvider.parseFunctionsHtmlDoc(MacroAutoCompletionProvider.java:90)
	at net.imagej.legacy.plugin.MacroAutoCompletionProvider.<init>(MacroAutoCompletionProvider.java:67)
	at net.imagej.legacy.plugin.MacroAutoCompletionProvider.getInstance(MacroAutoCompletionProvider.java:79)
	at net.imagej.legacy.plugin.MacroLanguageSupportPlugin.getMacroAutoCompletionProvider(MacroLanguageSupportPlugin.java:97)
	at net.imagej.legacy.plugin.MacroLanguageSupportPlugin.getCompletionProvider(MacroLanguageSupportPlugin.java:91)
	at net.imagej.legacy.plugin.MacroLanguageSupportPlugin.install(MacroLanguageSupportPlugin.java:77)
	at org.scijava.ui.swing.script.EditorPane.setLanguage(EditorPane.java:518)
	at org.scijava.ui.swing.script.EditorPane.setLanguage(EditorPane.java:445)
	at org.scijava.ui.swing.script.EditorPane.setLanguageByFileName(EditorPane.java:433)
	at org.scijava.ui.swing.script.TextEditor.createNewDocument(TextEditor.java:1199)
	at net.imagej.legacy.plugin.DefaultLegacyEditor.create(DefaultLegacyEditor.java:98)
	at net.imagej.legacy.DefaultLegacyHooks.createInEditor(DefaultLegacyHooks.java:314)
	at ij.plugin.NewPlugin.createMacro(NewPlugin.java:93)
	at ij.plugin.NewPlugin.run(NewPlugin.java:71)
	at ij.IJ.runPlugIn(IJ.java:199)
	at ij.Executer.runCommand(Executer.java:137)
	at ij.Executer.run(Executer.java:66)
	at java.lang.Thread.run(Thread.java:748)
Exception in thread "AWT-EventQueue-0" java.util.ConcurrentModificationException
	at java.util.ArrayList.sort(ArrayList.java:1464)
	at java.util.Collections.sort(Collections.java:141)
	at org.fife.ui.autocomplete.AbstractCompletionProvider.addCompletion(AbstractCompletionProvider.java:68)
	at net.imagej.legacy.plugin.MacroAutoCompletionProvider.addModuleCompletions(MacroAutoCompletionProvider.java:246)
	at net.imagej.legacy.plugin.MacroLanguageSupportPlugin.getMacroAutoCompletionProvider(MacroLanguageSupportPlugin.java:98)
	at net.imagej.legacy.plugin.MacroLanguageSupportPlugin.getCompletionProvider(MacroLanguageSupportPlugin.java:91)
	at net.imagej.legacy.plugin.MacroLanguageSupportPlugin.install(MacroLanguageSupportPlugin.java:77)
	at org.scijava.ui.swing.script.EditorPane.setLanguage(EditorPane.java:518)
	at org.scijava.ui.swing.script.TextEditor.setLanguage(TextEditor.java:1795)
	at org.scijava.ui.swing.script.TextEditor.lambda$new$3(TextEditor.java:425)
	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
	at javax.swing.JToggleButton$ToggleButtonModel.setPressed(JToggleButton.java:308)
	at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
	at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:842)
	at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:886)
	at java.awt.Component.processMouseEvent(Component.java:6539)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
	at java.awt.Component.processEvent(Component.java:6304)
	at java.awt.Container.processEvent(Container.java:2239)
	at java.awt.Component.dispatchEventImpl(Component.java:4889)
	at java.awt.Container.dispatchEventImpl(Container.java:2297)
	at java.awt.Component.dispatchEvent(Component.java:4711)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4904)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4535)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4476)
	at java.awt.Container.dispatchEventImpl(Container.java:2283)
	at java.awt.Window.dispatchEventImpl(Window.java:2746)
	at java.awt.Component.dispatchEvent(Component.java:4711)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760)
	at java.awt.EventQueue.access$500(EventQueue.java:97)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.awt.EventQueue$3.run(EventQueue.java:703)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84)
	at java.awt.EventQueue$4.run(EventQueue.java:733)
	at java.awt.EventQueue$4.run(EventQueue.java:731)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:730)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

Do you get the same issue ?

Related : updating FIJI takes a lot of time.

I believe this could be due to a connection problem to the website https://sites.imagej.net/ which is down or at least not responsive. Maybe it’s also related to IJ1 Macro autocompletion, which I believe is trying to connect to this server (@haesleinhuepf) ?

Does that make sense ? Would it be possible to put a timeout of ~ 5 seconds and then giving up if the site does not respond ?

Nicolas

1 Like

Testing on my system… a macOS Mojave Version 10.14.4 running (Fiji Is Just) ImageJ 2.0.0-rc-69/1.52n; Java 1.8.0_202 [64-bit] and got an error when following your protocol:

Here is my exception:

(Fiji Is Just) ImageJ 2.0.0-rc-69/1.52n; Java 1.8.0_202 [64-bit]; Mac OS X 10.14.4; 86MB of 8432MB (1%)
 
java.util.ConcurrentModificationException
	at java.util.ArrayList.sort(ArrayList.java:1464)
	at java.util.Collections.sort(Collections.java:141)
	at org.fife.ui.autocomplete.AbstractCompletionProvider.addCompletion(AbstractCompletionProvider.java:68)
	at net.imagej.legacy.plugin.MacroAutoCompletionProvider.addModuleCompletions(MacroAutoCompletionProvider.java:246)
	at net.imagej.legacy.plugin.MacroLanguageSupportPlugin.getMacroAutoCompletionProvider(MacroLanguageSupportPlugin.java:98)
	at net.imagej.legacy.plugin.MacroLanguageSupportPlugin.getCompletionProvider(MacroLanguageSupportPlugin.java:91)
	at net.imagej.legacy.plugin.MacroLanguageSupportPlugin.install(MacroLanguageSupportPlugin.java:77)
	at org.scijava.ui.swing.script.EditorPane.setLanguage(EditorPane.java:518)
	at org.scijava.ui.swing.script.EditorPane.setLanguage(EditorPane.java:445)
	at org.scijava.ui.swing.script.EditorPane.setLanguageByFileName(EditorPane.java:433)
	at org.scijava.ui.swing.script.TextEditor.createNewDocument(TextEditor.java:1199)
	at net.imagej.legacy.plugin.DefaultLegacyEditor.create(DefaultLegacyEditor.java:98)
	at net.imagej.legacy.DefaultLegacyHooks.createInEditor(DefaultLegacyHooks.java:314)
	at ij.plugin.NewPlugin.createMacro(NewPlugin.java:93)
	at ij.plugin.NewPlugin.run(NewPlugin.java:71)
	at ij.IJ.runPlugIn(IJ.java:199)
	at ij.Executer.runCommand(Executer.java:137)
	at ij.Executer.run(Executer.java:66)
	at java.lang.Thread.run(Thread.java:748)

So only the exception is a match. My Fiji does not crash … and I can still edit/run code via the Script Editor.

1 Like

It has improved right now, and yes, after some time I can edit the macro and continue to work.

I believe the problem lies here:

Setting a timeout of a few second could avoid this problem maybe.

2 Likes

Hey @NicoKiaru,

thanks for reporting. I just gave a class where this was happening on 30 computers in parallel. So I think it’s a global issue. Maybe the imagej.net server has issues.

The bug was observed earlier and fixed (in February):

I wonder if @ctrueden could cut a release of imagej-legacy and push it to the update site in order to prevent this issue in the future?

Thanks everyone for the headsup!

Cheers,
Robert

2 Likes

Releasing imagej-legacy 0.35.2 now. Will upload soon.

4 Likes

FYI, a println slipped through the release:

2 Likes

Thanks for noticing. Removed in imagej/imagej-legacy@9594b784. How obnoxious is it in practice? Should I cut and upload another patch release?

1 Like

It’'s polluting a bit the console window when writing a script in IJ1 macro. Not a really big problem imo.

What’s the threshold for complain driven development ? :wink: So far the count is at 0.5, as I find it only a little bit unpleasant. So let’s keep it like that until someone else shows up in this thread ?

2 Likes

That was my “clooooose” :roll_eyes:

Thanks for the headsup @NicoKiaru and @ctrueden . I promise behaving better in the future :nerd_face:

1 Like