Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 550291

Summary: jgit hangs in FS.FileStoreAttributeCache
Product: [Technology] JGit Reporter: Xavier Raynaud <xraynaud>
Component: JGitAssignee: Project Inbox <jgit.core-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: twolf
Version: 5.4   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Xavier Raynaud CLA 2019-08-21 04:44:08 EDT
I'm using Eclipse 2019-06, with jgit 5.4.0.201906121030-r

I'm on Linux (centos7), and my HOME dir is on NFS (I think it's important).

To reproduce the issue, just click on "Window->Preferences->Team->Git->Configuration"

While debugging the issue, I discover that the thread "main" loop forever in the following code:
(in org.eclipse.jgit.util.FS.java:231)


		private FileStoreAttributeCache(Path dir)
				throws IOException, InterruptedException {
			Path probe = dir.resolve(".probe-" + UUID.randomUUID()); //$NON-NLS-1$
			Files.createFile(probe);
			try {
				FileTime startTime = Files.getLastModifiedTime(probe);
				FileTime actTime = startTime;
				long sleepTime = 512;
				while (actTime.compareTo(startTime) <= 0) {
					TimeUnit.NANOSECONDS.sleep(sleepTime);
					FileUtils.touch(probe);
					actTime = Files.getLastModifiedTime(probe);
					// limit sleep time to max. 100ms
					if (sleepTime < 100_000_000L) {
						sleepTime = sleepTime * 2;
					}
				}
				fsTimestampResolution = Duration.between(startTime.toInstant(),
						actTime.toInstant());
			} catch (AccessDeniedException e) {
				LOG.error(e.getLocalizedMessage(), e);
			} finally {
				Files.delete(probe);
			}
		}


The comparison in the while loop returns always zero, leading to infinite loop.
See also https://lwn.net/Articles/564120/ about NFS and timestamps

See also https://bugs.eclipse.org/bugs/show_bug.cgi?id=548188



It's probably similar to
Comment 1 Xavier Raynaud CLA 2019-08-21 04:54:05 EDT
Note: If I manually run the command "touch $HOME/.probe-ff00c745-160d-4891-bb19-37e744e645fd" in a terminal, then eclipse successfully leaves the wile loop, and the preference page is correctly displayed.
Comment 2 Thomas Wolf CLA 2019-08-21 05:01:39 EDT
Please update to EGit nightly from http://download.eclipse.org/egit/updates-nightly .

*** This bug has been marked as a duplicate of bug 548598 ***