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
{{ message }}
Repository navigation
Issue with fs-watch tests on macOS with incoming libuv@1.49.0 release #54450
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()?
changed the title [-]Issue with fs-watch events with incoming libuv@1.49.0 release[/-][+]Issue with fs-watch tests with incoming libuv@1.49.0 release[/+]on Aug 19, 2024
changed the title [-]Issue with fs-watch tests with incoming libuv@1.49.0 release[/-][+]Issue with fs-watch tests on macOS with incoming libuv@1.49.0 release[/+]on Aug 19, 2024
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()?
Activity
[-]Issue with fs-watch events with incoming libuv@1.49.0 release[/-][+]Issue with fs-watch tests with incoming libuv@1.49.0 release[/+][-]Issue with fs-watch tests with incoming libuv@1.49.0 release[/-][+]Issue with fs-watch tests on macOS with incoming libuv@1.49.0 release[/+]santigimeno commentedon Aug 19, 2024
/cc @MoLow
lpinca commentedon Aug 20, 2024
I think it is acceptable.
test: refactor fs-watch tests due to macOS issue
test: refactor fs-watch tests due to macOS issue
test: refactor fs-watch tests due to macOS issue
test: refactor fs-watch tests due to macOS issue
test: refactor fs-watch tests due to macOS issue
santigimeno commentedon Nov 15, 2024
This is done.