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
When writing to files, it is possible that data is not immediately flushed to permanent storage. This allows subsequent read operations to see stale data. [Node 21] adds a 'flush' option to the fs.writeFile family of functions which forces the data to be flushed at the end of a successful write operation.
Lyra does use writeFile in a couple of places and it might be important that subsequent read operations do not see stale data.
When Lyra creates a pull request, it first uses writeFile to update files in a local clone, then it instructs git to add changes to the pull request. If git sees stale data we might miss updates and possibly lose data.
We are not sure if this bug actually affects Lyra. The documentation does not really mention this risk, it only refers to manual pages in which the risk seems to be more about kernel crashes.
nodejs/node#50009
https://nodejs.org/en/blog/release/v21.0.0
Lyra does use
writeFile
in a couple of places and it might be important that subsequent read operations do not see stale data.When Lyra creates a pull request, it first uses writeFile to update files in a local clone, then it instructs git to add changes to the pull request. If git sees stale data we might miss updates and possibly lose data.
We are not sure if this bug actually affects Lyra. The documentation does not really mention this risk, it only refers to manual pages in which the risk seems to be more about kernel crashes.
https://nodejs.org/docs/latest/api/fs.html#fspromiseswritefilefile-data-options
https://nodejs.org/docs/latest/api/fs.html#filehandlesync
https://man7.org/linux/man-pages/man2/fsync.2.html
Still, it seems safer to trust Node when they say that subsequent read operations can see stale data.
Note that flush was later back ported to Node 20: https://nodejs.org/en/blog/release/v20.10.0#new-flush-option-in-file-system-functions
The text was updated successfully, but these errors were encountered: