Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows console launcher (eclipsec.exe) not reading vmargs from eclipse.ini when there is no console window #117

Closed
jonathan-meier opened this issue Sep 18, 2022 · 3 comments · Fixed by #118
Labels

Comments

@jonathan-meier
Copy link
Contributor

jonathan-meier commented Sep 18, 2022

When the console launcher eclipsec.exe on Windows is started without a console window, the vmargs specified in eclipse.ini are ignored. This can easily be tested e.g. by adding debugging arguments -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000 to the eclipse.ini of an Eclipse IDE installation.

Starting the Eclipse IDE running eclipsec.exe on the command line works as expected: The JVM waits for a debugger to attach with the message Listening for transport dt_socket at address: 8000.

Starting the Eclipse IDE using Runtime.getRuntime().exec("eclipsec.exe") (easiest to do with jshell) does not work as expected: The JVM does not wait for a debugger to attach and just runs the Eclipse IDE. Apparently, the vmargs specified in eclipse.ini are ignored. In fact, using procmon from SysInternals shows that in this case eclipsec.exe only attempts to read eclipsec.ini but not eclipse.ini.

Whether eclipse.ini is consulted in addition to eclipsec.ini to read the vmargs is determined by the function isConsoleLauncher which checks whether there is a console window or not:

static int isConsoleLauncher() {
HWND (WINAPI *GetConsoleWindow)();
void * handle = loadLibrary(_T_ECLIPSE("Kernel32.dll"));
if (handle != NULL) {
if ( (GetConsoleWindow = findSymbol(handle, _T_ECLIPSE("GetConsoleWindow"))) != NULL) {
return GetConsoleWindow() != NULL;
}
}
return 0;
}

It turns out that there are ways to start the console launcher without a console window. One such case is via Runtime.getRuntime().exec("eclipsec.exe") which apparently uses the CREATE_NO_WINDOW flag when creating the process (see https://learn.microsoft.com/en-us/windows/win32/procthread/process-creation-flags).

The issue came up when running an Ant script that executes an eclipse application using its console launcher in an exec task. Ant uses Runtime.getRuntime().exec("<command_line>") internally. The workaround in this case is to explicitly specify the eclipse.ini file on the command line: eclipsec.exe --launcher.ini eclipse.ini.

jonathan-meier added a commit to jonathan-meier/equinox that referenced this issue Sep 18, 2022
…here is no console window (eclipse-equinox#117)

Processes on Windows can be created without a window using the CREATE_NO_WINDOW flag. When the
console launcher eclipsec.exe is started as such a process, the isConsoleLauncher function wrongly
returns 0 because there is no console window and hence, only eclipsec.ini is consulted for vmargs
but not eclipse.ini (see also functions getConfigArgs and getIniFile).

The fix is to properly propagate the launcher mode from main to the launcher DLL and removing the
incomplete isConsoleLauncher function entirely.
jonathan-meier added a commit to jonathan-meier/equinox that referenced this issue Sep 18, 2022
…here is no console window (eclipse-equinox#117)

Processes on Windows can be created without a window using the CREATE_NO_WINDOW flag. When the
console launcher eclipsec.exe is started as such a process, the isConsoleLauncher function wrongly
returns 0 because there is no console window and hence, only eclipsec.ini is consulted for vmargs
but not eclipse.ini (see also functions getConfigArgs and getIniFile).

The fix is to properly propagate the launcher mode from main to the launcher DLL and removing the
incomplete isConsoleLauncher function entirely.
vogella pushed a commit to jonathan-meier/equinox that referenced this issue Dec 8, 2022
…here is no console window (eclipse-equinox#117)

Processes on Windows can be created without a window using the CREATE_NO_WINDOW flag. When the
console launcher eclipsec.exe is started as such a process, the isConsoleLauncher function wrongly
returns 0 because there is no console window and hence, only eclipsec.ini is consulted for vmargs
but not eclipse.ini (see also functions getConfigArgs and getIniFile).

The fix is to properly propagate the launcher mode from main to the launcher DLL and removing the
incomplete isConsoleLauncher function entirely.
@github-actions
Copy link

This issue has been inactive for 180 days and is therefore labeled as stale.
If this issue became irrelevant in the meantime please close it as completed. If it is still relevant and you think it should be fixed some possibilities are listed below.
Please read https://github.com/eclipse-equinox/.github/blob/main/CONTRIBUTING.md#contributing-to-eclipse-equinox for ways to influence development.

@github-actions github-actions bot added the stale label Mar 18, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 26, 2023
Torbjorn-Svensson pushed a commit to Torbjorn-Svensson/eclipse-equinox_equinox that referenced this issue Apr 13, 2023
…here is no console window (eclipse-equinox#117)

Processes on Windows can be created without a window using the CREATE_NO_WINDOW flag. When the
console launcher eclipsec.exe is started as such a process, the isConsoleLauncher function wrongly
returns 0 because there is no console window and hence, only eclipsec.ini is consulted for vmargs
but not eclipse.ini (see also functions getConfigArgs and getIniFile).

The fix is to properly propagate the launcher mode from main to the launcher DLL and removing the
incomplete isConsoleLauncher function entirely.
vogella pushed a commit that referenced this issue Apr 15, 2023
…here is no console window (#117)

Processes on Windows can be created without a window using the CREATE_NO_WINDOW flag. When the
console launcher eclipsec.exe is started as such a process, the isConsoleLauncher function wrongly
returns 0 because there is no console window and hence, only eclipsec.ini is consulted for vmargs
but not eclipse.ini (see also functions getConfigArgs and getIniFile).

The fix is to properly propagate the launcher mode from main to the launcher DLL and removing the
incomplete isConsoleLauncher function entirely.
@umairsair
Copy link
Contributor

is this fix part of latest eclipse releases?

IIUC, the binaries are picked from following location and I don't see a new commit after this fix.. am I missing something here?

https://github.com/eclipse-equinox/equinox.binaries/tree/master/org.eclipse.equinox.executable/bin/win32/win32/x86_64

@jonahgraham
Copy link
Contributor

is this fix part of latest eclipse releases?

No - doesn't look like it.

In the past it looks like someone has manually run https://ci.eclipse.org/releng/job/Build-eclipse-launcher/

I have raised eclipse-platform/eclipse.platform.releng.aggregator#1407

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants