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

Could not recursively list files error #7695

Closed
PabloBuchu opened this issue Aug 30, 2023 · 5 comments · Fixed by #8201
Closed

Could not recursively list files error #7695

PabloBuchu opened this issue Aug 30, 2023 · 5 comments · Fixed by #8201
Assignees
Labels

Comments

@PabloBuchu
Copy link
Contributor

Wild stacktrace appeared while I was opening a local project in Enso. Creating an issue after short talk with @hubertp

[info] [2023-08-30T10:29:55.804Z] [org.enso.languageserver.protocol.binary.BinaryConnectionController] Data session initialized for client: 4141bb96-3988-465c-9002-2980f715ae5b [127.0.0.1:56246].
Aug 30, 2023 12:29:55 PM com.sun.jna.Native$1 uncaughtException
WARNING: JNA: Callback io.methvin.watchservice.MacOSXListeningWatchService$MacOSXListeningCallback@293f3a29 threw the following exception
java.lang.IllegalStateException: Could not recursively list files for /Users/pawelbuchowski/enso/projects/Orders_1/.enso/.vcs/
	at io.methvin.watchservice.MacOSXListeningWatchService$MacOSXListeningCallback.invoke(MacOSXListeningWatchService.java:231)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at com.sun.jna.CallbackReference$DefaultCallbackProxy.invokeCallback(CallbackReference.java:520)
	at com.sun.jna.CallbackReference$DefaultCallbackProxy.callback(CallbackReference.java:551)
	at com.sun.jna.Native.invokeVoid(Native Method)
	at com.sun.jna.Function.invoke(Function.java:415)
	at com.sun.jna.Function.invoke(Function.java:361)
	at com.sun.jna.Library$Handler.invoke(Library.java:265)
	at jdk.proxy2/jdk.proxy2.$Proxy35.CFRunLoopRun(Unknown Source)
	at io.methvin.watchservice.MacOSXListeningWatchService$CFRunLoopThread.run(MacOSXListeningWatchService.java:174)
Caused by: java.nio.file.NoSuchFileException: /Users/pawelbuchowski/enso/projects/Orders_1/.enso/.vcs/HEAD.lock
	at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
	at java.base/sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes(UnixFileAttributeViews.java:55)
	at java.base/sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvider.java:148)
	at java.base/java.nio.file.Files.readAttributes(Files.java:1851)
	at java.base/java.nio.file.FileTreeWalker.getAttributes(FileTreeWalker.java:220)
	at java.base/java.nio.file.FileTreeWalker.visit(FileTreeWalker.java:277)
	at java.base/java.nio.file.FileTreeWalker.next(FileTreeWalker.java:374)
	at java.base/java.nio.file.Files.walkFileTree(Files.java:2845)
	at java.base/java.nio.file.Files.walkFileTree(Files.java:2882)
	at io.methvin.watcher.PathUtils.recursiveVisitFiles(PathUtils.java:86)
	at io.methvin.watcher.PathUtils.recursiveListFiles(PathUtils.java:75)
	at io.methvin.watchservice.MacOSXListeningWatchService$MacOSXListeningCallback.invoke(MacOSXListeningWatchService.java:229)
	... 12 more

[info] [2023-08-30T10:29:56.369Z] [org.enso.languageserver.text.CollaborativeBuffer] Buffer opened for [path:Path(25269a4f-a175-479e-a851-8ddb74c5dfbc,Vector(src, Main.enso)), client:4141bb96-3988-465c-9002-2980f715ae5b].
@hubertp
Copy link
Collaborator

hubertp commented Aug 30, 2023

As far as I can see watcher library does not allow selective filtering of specific files. It's either recursive or not for the given root path. We would probably have to roll out our own implementation. @4e6 any thoughts?

@4e6
Copy link
Contributor

4e6 commented Sep 1, 2023

We can try to update the library first https://mvnrepository.com/artifact/io.methvin/directory-watcher

@jdunkerley jdunkerley moved this from ❓New to 📤 Backlog in Issues Board Sep 5, 2023
@jdunkerley jdunkerley moved this from 📤 Backlog to ❓New in Issues Board Sep 5, 2023
@jdunkerley jdunkerley assigned hubertp and unassigned 4e6 Oct 31, 2023
@jdunkerley jdunkerley moved this from ❓New to 📤 Backlog in Issues Board Oct 31, 2023
@hubertp hubertp moved this from 📤 Backlog to 🔧 Implementation in Issues Board Oct 31, 2023
hubertp added a commit that referenced this issue Nov 1, 2023
The change upgrades `directory-watcher` library, hoping that it will fix
the problem reported in #7695 (there has been a number of bug fixes in
MacOS listener since then).

Once upgraded, tests in `WatcherAdapterSpec` because the logic that
attempted to ensure the proper initialization order in the test using
semaphore was wrong. Now starting the watcher using `watchAsync` which
only returns the future when the watcher successfully registers for
paths. Ideally authors of the library would make the registration bit
public
(https://github.com/gmethvin/directory-watcher/blob/3218d68a845ebd803ebd98af3be4692d1b63e12c/core/src/main/java/io/methvin/watcher/DirectoryWatcher.java#L229C7-L229C20)
but it is the best we can do so far.

Had to adapt to the new API in PathWatcher as well, ensuring the right
order of initialization.
@enso-bot
Copy link

enso-bot bot commented Nov 1, 2023

Hubert Plociniczak reports a new STANDUP for yesterday (2023-10-31):

Progress: Address remaining comments for custom log levels PR #8162. Investigating possible solutions to #7695, limited by the rather closed API of the directory-watcher library. It should be finished by 2023-11-01.

Next Day: Next day I will be working on the #7695 task. Prepare a potential workaround for the bug.

@mergify mergify bot closed this as completed in #8201 Nov 2, 2023
mergify bot pushed a commit that referenced this issue Nov 2, 2023
The change upgrades `directory-watcher` library, hoping that it will fix the problem reported in #7695 (there has been a number of bug fixes in MacOS listener since then).

Once upgraded, tests in `WatcherAdapterSpec` because the logic that attempted to ensure the proper initialization order in the test using semaphore was wrong. Now starting the watcher using `watchAsync` which only returns the future when the watcher successfully registers for paths. Ideally authors of the library would make the registration bit public
(https://github.com/gmethvin/directory-watcher/blob/3218d68a845ebd803ebd98af3be4692d1b63e12c/core/src/main/java/io/methvin/watcher/DirectoryWatcher.java#L229C7-L229C20) but it is the best we can do so far.

Had to adapt to the new API in PathWatcher as well, ensuring the right order of initialization.

Should fix #7695.
@github-project-automation github-project-automation bot moved this from 🔧 Implementation to 🟢 Accepted in Issues Board Nov 2, 2023
@enso-bot
Copy link

enso-bot bot commented Nov 2, 2023

Hubert Plociniczak reports a new STANDUP for yesterday (2023-11-01):

Progress: Prepared a PR with the upgrade and some workarounds for potential race-condition. Helped with #7935. Discussing some serialization improvements, Trying to reproduce #8174 on a recent bookclub but nothing so far. It should be finished by 2023-11-01.

Next Day: Next day I will be working on the #8174 task. Continue with the investigation.

@hubertp
Copy link
Collaborator

hubertp commented Nov 3, 2023

@PabloBuchu 🤞 this should fix it but if not, please reopen if you see this again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants