archi-modelrepository-plugin icon indicating copy to clipboard operation
archi-modelrepository-plugin copied to clipboard

Freeze when adding repository

Open slopez31 opened this issue 7 years ago • 20 comments

Hi everybody, I have à little issue when i'm a trying to add a collaboration workspace (actually it's not on every computer 2/3). (with last beta version 3.2).

Archi freezes during "Fetching..." message image Killing "Windows Host" Subprocess unblock and download the map. After this and until now everything seems to be fine.

My git server is a gitlab on premise server.

Thanks and good work to all.

slopez31 avatar Mar 19 '18 10:03 slopez31

I won't be able to diagnose this without more information. Can you try and narrow things down?

Phillipus avatar Mar 19 '18 10:03 Phillipus

Hello Phillipus, I think i can reproduce the issue, what can i do to help you to debug ? Maybe there is a log file ?

slopez31 avatar Mar 20 '18 12:03 slopez31

Hi again, Maybe this will help you

image the bash command is called with : bash --login -c "which git" And if the linux sub-system is not deployed it wait for a key to be pressed.

slopez31 avatar Mar 21 '18 11:03 slopez31

Need to know:

  • Archi version
  • Model Repo version
  • Steps to reproduce - what exactly leads to the freeze?

Phillipus avatar Mar 21 '18 11:03 Phillipus

Archi version 4.2.0 Model Repo Gitlab : GitLab Enterprise Edition 10.5.4-ee Windows 10 enterprise Version 10.0.16299 Numéro 16299

The steps are simple, with fresh install I just used the green button "Import remote model to workspace" , and fill the form with server, user password. and finaly fhe "Progress" windows stop on fetching and archi is completely freezed.

slopez31 avatar Mar 21 '18 12:03 slopez31

Which version of the the Model Repo Plugin?

Phillipus avatar Mar 21 '18 12:03 Phillipus

image

slopez31 avatar Mar 21 '18 12:03 slopez31

Why is "Windows Host" Subprocess running under Archi? I dont's understand what all the Bash and other stuff has to do with this. Is this problem only on this machine with all this stuff? You have to narrow down the problem, because I can't diagnose it.

Phillipus avatar Mar 21 '18 12:03 Phillipus

I think the probem is after this

Maybe the subprocess is invoke in the jgit lib . Unfortunately, I'm not skilled enough to debug deeper or to propose a patch. I'm going to continue to kill manually the subprocess, it's a good way to avoid the issue.

Bye and thanx a lot for the plugin

slopez31 avatar Mar 21 '18 14:03 slopez31

OK, I found out that JGit sometimes invokes bash to find global git settings:

https://www.eclipse.org/forums/index.php/t/1031740/

Perhaps it is getting stuck here. Need to investigate why.

Phillipus avatar Mar 21 '18 16:03 Phillipus

Looking at that JGit code...

If JGit can't find a native git executable in system PATH it then looks for "bash" in the system PATH. If it finds "bash" it will try to invoke it with "bash --login -c which git" command in order to find git. This seems a dumb thing to do.

Workaround would be to install git somewhere and make sure it's on the PATH, or remove "Bash" from PATH.

~~But we need to figure out why invoking bash is freezing.~~ - I know

~~What bash have you got installed?~~ OK, I know now.

Phillipus avatar Mar 21 '18 16:03 Phillipus

I've filed a bug report for JGit:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=532723

Phillipus avatar Mar 21 '18 17:03 Phillipus

@slopez31 You could workaround this by:

  1. Open Control Panel, "Programs and Features", "Turn Windows features on or off"
  2. In the dialog untick "Windows Subsystem for Linux"
  3. Reboot.

Phillipus avatar Mar 21 '18 19:03 Phillipus

@Phillipus Thanks for the tip.

slopez31 avatar Mar 21 '18 20:03 slopez31

Or install git and ensure it's on the PATH.

The ideal solution is the JGit guys remove the dumb "search for bash" thing.

Phillipus avatar Mar 21 '18 20:03 Phillipus

Yes i think i'm going to install git. MIcrosoft command could sending an error code instead of waiting for a key !

slopez31 avatar Mar 22 '18 09:03 slopez31

The code in JGit to determine whether git is installed is simply to try and find the global git config file (if it exists). Searching for any "bash.exe" on the PATH is dangerous:

protected File discoverGitExe() {
	String path = SystemReader.getInstance().getenv("PATH"); //$NON-NLS-1$
	File gitExe = searchPath(path, "git.exe", "git.cmd"); //$NON-NLS-1$ //$NON-NLS-2$

	if (gitExe == null) {
		if (searchPath(path, "bash.exe") != null) { //$NON-NLS-1$
			// This isn't likely to work, but its worth trying:
			// If bash is in $PATH, git should also be in $PATH.
			String w;
			try {
				w = readPipe(userHome(),
					new String[]{"bash", "--login", "-c", "which git"}, // //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
					Charset.defaultCharset().name());
			} catch (CommandFailedException e) {
				LOG.warn(e.getMessage());
				return null;
			}
			if (!StringUtils.isEmptyOrNull(w)) {
				// The path may be in cygwin/msys notation so resolve it right away
				gitExe = resolve(null, w);
			}
		}
	}

	return gitExe;
}

They should remove the part where they even say "This isn't likely to work"!

Phillipus avatar Mar 22 '18 09:03 Phillipus

And I can't even inject my own FS_Win32 class to override this because of their hard-coded FS factory:

	public FS detect(Boolean cygwinUsed) {
		if (SystemReader.getInstance().isWindows()) {
			if (cygwinUsed == null)
				cygwinUsed = Boolean.valueOf(FS_Win32_Cygwin.isCygwin());
			if (cygwinUsed.booleanValue())
				return new FS_Win32_Cygwin();
			else
				return new FS_Win32();
		} else {
			return new FS_POSIX();
		}
	}

Phillipus avatar Mar 22 '18 09:03 Phillipus

Seems like this is a known issue for some time with JGit:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=515354

As is usual with Eclipse frameworks, it doesn't look like they'll fix it any time soon.

Phillipus avatar Mar 27 '18 13:03 Phillipus

Setting the property "-Djgit.gitprefix=<location of git.exe>" location in the Archi.ini file might be a workaround.

See https://bugs.eclipse.org/bugs/show_bug.cgi?id=515354#c24

Phillipus avatar May 20 '18 21:05 Phillipus