Community
Participate
Working Groups
During the last days, we changed our version control system from SVN to Git. So far, we oly used externe SVN client TortoiseSVN - now we use the build in Eclipse Git functions. During this SVN-2-Git migration we also adjusted our ANT build files. We now import a general "../include.xml" build file with properties and macros and it works quite well. So far for the "change history" ... ... now, if we start our ANT tasks (doubnle click in ANT view), we get occasionally org.eclipse.ant.core.AntSecurityException exceptions! If we double click just again, no exception occurs. If we wait a while and do somethigng else, the next ANT start pops the same exception again! Here is an example output of Eclipse's .log file: --------------------------------- !ENTRY org.eclipse.ui.workbench 4 2 2019-11-22 12:46:07.204 !MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.ui.workbench". !STACK 0 org.eclipse.ant.core.AntSecurityException at org.eclipse.ant.internal.core.AntSecurityManager.checkPermission(AntSecurityManager.java:72) at java.base/java.lang.System.setProperty(System.java:888) at org.eclipse.debug.internal.ui.views.launch.LaunchView.partActivated(LaunchView.java:1379) at org.eclipse.ui.internal.WorkbenchPage$4.run(WorkbenchPage.java:4906) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45) at org.eclipse.ui.internal.WorkbenchPage.firePartActivated(WorkbenchPage.java:4903) at org.eclipse.ui.internal.WorkbenchPage.access$3(WorkbenchPage.java:4879) at org.eclipse.ui.internal.WorkbenchPage$E4PartListener.partActivated(WorkbenchPage.java:214) at org.eclipse.e4.ui.internal.workbench.PartServiceImpl$3.run(PartServiceImpl.java:253) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45) at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.firePartActivated(PartServiceImpl.java:250) at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:774) at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:683) at org.eclipse.e4.ui.internal.workbench.swt.AbstractPartRenderer.activate(AbstractPartRenderer.java:97) at org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer.lambda$2(StackRenderer.java:1046) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4173) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1081) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1066) at org.eclipse.swt.widgets.Shell.setActiveControl(Shell.java:1510) at org.eclipse.swt.widgets.Shell.WM_MOUSEACTIVATE(Shell.java:2323) at org.eclipse.swt.widgets.Control.windowProc(Control.java:4805) at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:348) at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1501) at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2138) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4820) at org.eclipse.swt.internal.win32.OS.DefWindowProc(Native Method) at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:91) at org.eclipse.swt.widgets.Control.windowProc(Control.java:4858) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4820) at org.eclipse.swt.internal.win32.OS.DefWindowProc(Native Method) at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:91) at org.eclipse.swt.widgets.Control.windowProc(Control.java:4858) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4820) at org.eclipse.swt.internal.win32.OS.DefWindowProc(Native Method) at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:91) at org.eclipse.swt.widgets.Control.windowProc(Control.java:4858) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4820) at org.eclipse.swt.internal.win32.OS.DefWindowProc(Native Method) at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:91) at org.eclipse.swt.widgets.Control.windowProc(Control.java:4858) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4820) at org.eclipse.swt.internal.win32.OS.DefWindowProc(Native Method) at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:91) at org.eclipse.swt.widgets.Control.windowProc(Control.java:4858) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4820) at org.eclipse.swt.internal.win32.OS.DefWindowProc(Native Method) at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:91) at org.eclipse.swt.widgets.Control.windowProc(Control.java:4858) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4820) at org.eclipse.swt.internal.win32.OS.DefWindowProc(Native Method) at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:91) at org.eclipse.swt.widgets.Control.windowProc(Control.java:4858) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4820) at org.eclipse.swt.internal.win32.OS.DefWindowProc(Native Method) at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:91) at org.eclipse.swt.widgets.Control.windowProc(Control.java:4858) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4820) at org.eclipse.swt.internal.win32.OS.DefWindowProc(Native Method) at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:91) at org.eclipse.swt.widgets.Control.windowProc(Control.java:4858) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4820) at org.eclipse.swt.internal.win32.OS.DefWindowProc(Native Method) at org.eclipse.swt.widgets.Tree.callWindowProc(Tree.java:1462) at org.eclipse.swt.widgets.Tree.windowProc(Tree.java:5888) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4820) at org.eclipse.swt.internal.win32.OS.CallWindowProc(Native Method) at org.eclipse.swt.widgets.Tree.callWindowProc(Tree.java:1554) at org.eclipse.swt.widgets.Control.windowProc(Control.java:4858) at org.eclipse.swt.widgets.Tree.windowProc(Tree.java:5987) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4820) at org.eclipse.swt.internal.win32.OS.PeekMessage(Native Method) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3580) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1160) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1049) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155) at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:633) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:557) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:150) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:660) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:597) at org.eclipse.equinox.launcher.Main.run(Main.java:1468) ------------------------------- What's wrong here?
Can you attach a sample project to reproduce? Can you try some simple thing which involves git repo. Execution is not throwing the error. Error is thrown while rendering the Ant Editor.
Sorry, simple example doesn't reproduce. But can't you see what's the problem by looking at the stack trace? It also has line numbers. I guess a more readable error message would help.
New Gerrit change created: https://git.eclipse.org/r/153366
(In reply to Eclipse Genie from comment #3) > New Gerrit change created: https://git.eclipse.org/r/153366 This should help in avoiding setting the property if already set. Incase of error will provide the part detail.
Discussed on https://git.eclipse.org/r/153366: It would be better to store the state in the plugin activator and avoid setting a system property. This could be disallowed by the security manager, and is not neccesary for the use case. I'll provide a patch for that when finding time.
I took another look, and my proposed way won't be possible. This is because the possible clients are not known and if they somehow rely on that system property they won't know of any change. The system property is set also in LaunchView.setDebugToolbarInView(boolean) and there the comment says Update system property used by contributed actions. I don't see a reference of any action using this property. But if there is some, it would be outside of the platform. It might be possible that this property is actually not used at all and might be a candidate for removal. (side note: the constant name DEBUG_VIEW_TOOBAR_VISIBLE has a typo) From this I would say we should leave the setting of the property as it is and just catch the potential SecurityException. This can be silently ignored. Populating the error log onn each access won't be helpful. The only effect is that for unknown contributors when they disallow system properties at the same time the UI would not react on the change. I think the combination is unlikely enough to ignore the exception.
Gerrit change https://git.eclipse.org/r/153366 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.debug.git/commit/?id=5b82ccf0240a9efd7c6092354267b571f4abc056
@M H Can you verify if it works for you now?
Just installed Eclipse 4.14.0 (2019-12) and the bug still occurs: !ENTRY org.eclipse.ui.workbench 4 2 2020-01-10 13:28:12.763 !MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.ui.workbench". !STACK 0 org.eclipse.ant.core.AntSecurityException at org.eclipse.ant.internal.core.AntSecurityManager.checkPermission(AntSecurityManager.java:72) at java.base/java.lang.System.setProperty(System.java:888) at org.eclipse.debug.internal.ui.views.launch.LaunchView.partActivated(LaunchView.java:1379) at org.eclipse.ui.internal.WorkbenchPage$4.run(WorkbenchPage.java:4915) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45) at org.eclipse.ui.internal.WorkbenchPage.firePartActivated(WorkbenchPage.java:4912) at org.eclipse.ui.internal.WorkbenchPage.access$3(WorkbenchPage.java:4888) at org.eclipse.ui.internal.WorkbenchPage$E4PartListener.partActivated(WorkbenchPage.java:216) at org.eclipse.e4.ui.internal.workbench.PartServiceImpl$3.run(PartServiceImpl.java:253) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45) at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.firePartActivated(PartServiceImpl.java:250) at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:774) at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:683) at org.eclipse.e4.ui.internal.workbench.swt.AbstractPartRenderer.activate(AbstractPartRenderer.java:97) at org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer.lambda$0(ContributedPartRenderer.java:63) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
(In reply to M H from comment #9) > Just installed Eclipse 4.14.0 (2019-12) and the bug still occurs: > Thank you! We will work on this further.
@Karsten, will you be working on this in 4.16?
Please re assign the target when it is planned to fix.
Also there: Caused by: org.eclipse.ant.core.AntSecurityException at org.eclipse.ant.internal.core.AntSecurityManager.checkPermission(AntSecurityManager.java:72) at java.base/java.lang.System.setProperty(System.java:925) at org.eclipse.ui.internal.Workbench.restart(Workbench.java:2489) at org.eclipse.ui.internal.handlers.RestartWorkbenchHandler.execute(RestartWorkbenchHandler.java:30) at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:283) at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:97) at jdk.internal.reflect.GeneratedMethodAccessor86.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:564) at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:58) So annoying issue in Eclipse for so many years....
Ignoring this SecurityException is the wrong approach. Seems to me this is a race condition in the Ant bundles. There are two places where they do the following: original = System.getSecurityManager() // (1) getManager try { // (2) setManager System.setSecurityManager(new AntSecurityManager(Thread.currentThread())) // Some Ant executing code here } finally { System.setSecurityManager(original) // (3) resetManager } Once in InternalAntRunner.run(List<String>), and once in AntModel.parseDocument(IDocument). The latter executes on the UI thread, so the thread for which the AntSecurityManager forbids System.exit() and System.setProperty() is the UI thread. I don't know on which thread the InternalAntRunner executes; I would expect that to be some background thread. Now consider two threads: UI thread Build thread (1) getManager (2) setManager (1) getManager -> yields AntSecurityManager(UIthread) (2) setManager (3) resetManager (3) resetManager From now on, the security manager will be the AntSecurityManager. Subsequently, any attempt to call System.setProperty() on the UI thread will cause that AntSecurityException. To fix this bug, this race between org.eclipse.ant.core and org.eclipse.ant.ui must be prevented.
See also bug 143416 (in particular bug 143416 comment 48, where that race condition was identified already back in 2013). That bug was closed by the Genie in July 2020 as WONTFIX due to lack of activity. There's also an old, abandoned Gerrit change attempting to fix this: https://git.eclipse.org/r/c/platform/eclipse.platform/+/39989