[Node] Stop deleting NODEFS mount directories on unmount #2713
+244
−49
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation for the change, related issues
Fixes a Playground CLI crash that happened when rotating a PHP instance while using a local mount for
/wordpress
.Implementation details
Imagine you're mounting a local directory, e.g.
/home/adam/my-site
at/wordpress
in Playground's VFS. By default,/wordpress
does not exist socreateNodeFsMountHandler()
will create it. When it's time to unmount,createNodeFsMountHandler()
remembers it created/wordpress
just for mounting and will attempt to clean it up. However, since/wordpress
is also a CWD, the filesystem will refuse to delete it by throwing error 10EBUSY
.This PR changes the unmount handler default behavior. It no longer cleans up the mounted directories, unless the
cleanupNodesOnUmount
is explicitly set to true. This means that mounting something at/wordpress/wp-content/plugins/my-plugin
will leave an empty directory in there after the unmount. This should not affectgit status
as git does not version empty directories.If we really wanted to keep cleaning up the mount-related directories, we'd need to follow the following runtime rotation procedure:
/
unmount
So, effectively, move the failure if the path structure is off after the rotation, not during the rotation.
Testing Instructions (or ideally a Blueprint)
CI unit tests.
For manual testing, do this:
Then:
non_existent_function()
. This will nudge the PHP class to rotate the runtime and callunmount()
for all the mounts,Finally, visit the local site. You should see an error screen. Refresh it three times, confirm you still see the same WordPress error screen.