You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're in the process of releasing libuv@1.49.0. While running the libuv-in-node CI bot, many of the fs-watch tests in macOS have become very flaky. It looks like the root of the problem comes from how fsevents on macOS are handled (explanation here and here), though these issues have become more apparent after a change in libuv which fixed some other issues such as: #52055. That, until now, this problem wasn't appearing was probably by chance as there was no test that actually exercised that specific flow. Here's an example of code that demonstrates the issue in current Node.js main:
constfs=require('node:fs');constos=require('node:os');constpath=require('node:path');constdir=fs.mkdtempSync(path.join(os.tmpdir(),'foo-'));console.log('dir',dir);constfilePath=path.join(dir,'test');constcontent1=Date.now()+'test'.toLowerCase().repeat(1e4);fs.writeFileSync(filePath,content1);// In macOs the events from before calling fs.watch() may be leaked into// the 'change' event. Uncomment the timeout to avoid it.// setTimeout(() => {constwatcher=fs.watch(dir);watcher.on('change',(type,filename)=>{console.log(type,filename);});// }, 100);
This issue might probably be fixed once libuv/libuv#3866 is fixed, but that's not going to happen soon and definitely not for this release.
So, in order to land the incoming libuv@1.49.0 my question is:
Would it be acceptable to rewrite those fs.watch tests so they take into account the possible leaking of events generated before the call to fs.watch()?
We're in the process of releasing
libuv@1.49.0. While running the libuv-in-node CI bot, many of the fs-watch tests inmacOShave become very flaky. It looks like the root of the problem comes from how fsevents on macOS are handled (explanation here and here), though these issues have become more apparent after a change in libuv which fixed some other issues such as: #52055. That, until now, this problem wasn't appearing was probably by chance as there was no test that actually exercised that specific flow. Here's an example of code that demonstrates the issue in current Node.js main:This issue might probably be fixed once libuv/libuv#3866 is fixed, but that's not going to happen soon and definitely not for this release.
So, in order to land the incoming libuv@1.49.0 my question is:
fs.watchdoes not report delete of watched folder #52055 which would make the test suite pass though the underlying issue would still be there.I'm asking this before I want to be sure Option 1 would be acceptable before rewriting all those tests, which I'm happy to pursue.