Closed jlmanohar closed 9 months ago
Update: This happens on a network drive , i tried to do the same thing on C drive and it works fine. Does autorefresh use filesystem's ionotify ?
Does autorefresh use filesystem's ionotify ?
It may be something related with uri I guess. I guess some part of the code only works when the scheme is file
.
I will try to check if this happens on another machine with different network drive, but it might be something related to how network drive gets treated for auto reloads (probably by the host OS). This issue doesn't happen for projects on physical drive.
@jdneo , Do you have any suggestions or guide me in any direction that could help find me the issue, or get logs that can help others ?
What net driver are you using? I can have a try if I have an account.
I first observed this issue on my corporate issued VDI where i have to use an SMB shre for all my projects, which makes it hard to try out different things or get some info that only admin has access to. I switched to linux on a personal system and observed the same issue (Both on NFS and SMB shares)
Here is what i did.
sudo mount -t cifs //(IP of nas)/test ~/testsmb -o uid=(user id),gid=(users group id)
NFS Share sudo mount (ip of nas):/mnt/pool0/test ~/testnfs
then made it writable for everyone (just to rule out issues) sudo chmod 777 ~/testnfs
Expected: New class should be visible in the package where it got created Actual:
Kernel and other info:
uname -a
Linux janaswamy-80ls 6.2.0-10022-tuxedo #28 SMP PREEMPT_DYNAMIC Wed Aug 23 20:17:32 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
modinfo ath9k
filename: /lib/modules/6.2.0-10022-tuxedo/kernel/drivers/net/wireless/ath/ath9k/ath9k.ko
license: Dual BSD/GPL
description: Support for Atheros 802.11n wireless LAN cards.
author: Atheros Communications
srcversion: 85F6EFF6CCB836863128978
Will try to get further info from a physical windows device if required.
Any update on this ?
I want to add this note and will update the actual title as well, but this issue is only for network locations (Both NFS and SMB).
Note: files do reflect in the explorer view and project view when creating new files or editing externally. But when creating with the Extension's create class option, it shows only in explorer but not in java project.
I just found this in VSCode Output tab when i select "Window", this shows file watcher error not sure if that is something related
2023-10-24 19:23:05.111 [error] MainThreadFileSystem#$watch(): failed to stat a resource for file watching (extension: vscjava.vscode-java-test, path: file:///home/jlmanohar/Documents/SmdShareRecieve/demo/src/test/resources, recursive: true, session: 0.32353731377421235): EntryNotFound (FileSystemError): Error: ENOENT: no such file or directory, stat '/home/jlmanohar/Documents/SmdShareRecieve/demo/src/test/resources'
2023-10-24 19:23:05.112 [error] MainThreadFileSystem#$watch(): failed to stat a resource for file watching (extension: vscjava.vscode-java-test, path: file:///home/jlmanohar/Documents/SmdShareRecieve/demo/target/generated-test-sources/test-annotations, recursive: true, session: 0.919249591511081): EntryNotFound (FileSystemError): Error: ENOENT: no such file or directory, stat '/home/jlmanohar/Documents/SmdShareRecieve/demo/target/generated-test-sources/test-annotations'
Sorry I haven't found a time to look deeper into this issue.
I just found this in VSCode Output tab when i select "Window", this shows file watcher error not sure if that is something related
This should be some errors caused by other extensions I guess. Should not related with this issue.
I did a bit of research and it looks like this is an upstream issue from FileWatcher from vscode. Will report this in vscode repo as well
In summary, when a new file is created, it creates a "create event" on my regular filesystem, but generates a "change event" on network mounts.
Thank you for the investigation! Nice job!
Thanks @jdneo , have reported the bug in vscode, will look at it more when i have some more time available. Here is the report in case someone needs to refer it. https://github.com/microsoft/vscode/issues/201103
I am going to close as not planned, i did a few tests ( I am not good with ts or js so my code is not good) but this is what i found.
Any one facing similar issue can try and enable this setting and see if it helps. This worked for me sometimes usually on linux, but doesnt help me in windows
touch <filename>
gives an update event from parcel watcherThis issue doesn't seem to be related to anything vscode does, and maybe how files actually get created or how nfs/smb handles it, this part I don't know. I am not able to trace out where exactly is the issue ,is it with CIFS/SMB client implementations, actual SMB/NFS server or some other place.
For anyone in the future who wants to debug this issue, this is the snippet that i have, It creates a file watcher on the mentioned path, creates a file with node fs at 1 sec, creates a file with touch on the second second, then waits for 28 sec and then unsubscribes and terminates
const watcher = require('@parcel/watcher');
const path = require('path');
const fs = require('fs');
var exec = require('child_process').exec;
var p = "/<directory path>";
var subscription;
setTimeout(async() => {
console.log("Watching events on "+p);
subscription = await watcher.subscribe(p, (err, events) => {
console.log(events);
})
}, 1);
setTimeout(()=>{
fs.writeFileSync(p+"/t.txt","");
}
,1000)
setTimeout(()=> {
exec("touch "+p+"/t1.txt")
},2000);
setTimeout(async() =>{
await subscription.unsubscribe();
},30000)
these are the dependencies and you can do npm install
and then node <filename.js>
to run it.
"dependencies": {
"@parcel/watcher": "2.1.0",
"path": "^0.12.7"
}
VSCode version 1.8.21 Project Manager for java v0.23.1
Issue: When creating a new package or class, the java project view doesnt show new classes/packages until it is refreshed manually.
Steps to reproduce:
Expected: When new class/package is created, java project manager should auto refresh the view to show new package and classes as well.
Settings: Autorefresh is enabled with a delay of 2000ms