-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
unlink() calls fail in BaseFileHelper.php on Windows hosted Nanobox environment #17222
Comments
Looks like the same story as #16603. Can you give some context what you're doing with this helper? |
I'm not directly doing anything with it. It's what Craft CMS is using. Generally the file operations that fail are removing temp files generated from various operations, because they are being tried with Ultimately, I think it all falls down to how Nanobox is mounting the app path: I cannot get the netfs option to work, so I have to fallback to native. If the mountpoint was netfs, things would probably work a lot better, but as of now I have never got Nanobox to mount properly with it. Despite looking at all available resources and configurations that say this "works". I guess this is kind of an edge case given the mixture of a Linux VM running on a Windows FS. |
Then what Craft is doing with it? Can you share stack trace of this error? |
Sure, here's an example exception thrown:
A file is written to the temp download folder, but unlink fails causing an exception. |
Thanks. I understand why the error can be thrown, but I believe the discussion referenced here: #16604 (comment) about the whole Currently in the BaseFileHelper.php, the condition is being done on PHP's directory separator value by the looks of it. Given this is a Unix-like VM ultimately reading/writing to a Windows FS, this condition will never be true, because based on that condition, it isn't Windows, so https://github.com/yiisoft/yii2/blob/master/framework/helpers/BaseFileHelper.php#L404-L408 However, given I am telling the file mutex that this is Windows system with an env var, surely, the same logic should be used across all the areas. @brandonkelly discussed this in is proposal, given I suspect, if I could get the netfs mount type working, most of these issues would not happen but I have yet to find a way to get it work, so I am stuck with the default VirtualBox mounting, which is slower, but at least works, but then introduces filesystem related issues. Can't win! |
I have managed to get a project running under the Nanobox netfs mount type which pretty much resolves all the issues highlighted. It is ultimately a underlying FS problem in the way the app directory is mounted and performs various actions, it would seem file locking and other areas are pretty sensitive when using the VirtualBox driver. However, I would still suggest there is an argument to make the |
Probably but since that's quite rare use case, I don't think we'll get to implementing it anytime soon. |
Fair enough. At least it's documented if someone else comes across this! |
What steps will reproduce the problem?
On my Nanobox environment which is running in VirtualBox but ultimately is hosted on a Windows host,
unlink()
related calls are failing within: https://github.com/yiisoft/yii2/blob/master/framework/helpers/BaseFileHelper.php#L406-L408. This is happening within Craft CMS 3 in several file situations, reported here:I am using the
WINDOWS_FS
environment variable because the file share Nanobox points to is a Windows FS and is required otherwise I get various file mutex issues with file locking.If I remove the
unlink()
call in 406-408, everything works. If I also change the line to:This also allows it to work, but it seems it's more of a hack. I don't know if the problem is due to the fact Yii is essentially running within a Unix-like system but the file share Nanobox points to is a Windows filesystem, so it's a bit of a mix match.
What is the expected result?
File delete operation should be successful and removed without any error.
What do you get instead?
PHP exception with
unlink()
. Text file is busy/permission denied depending on file operation performed.Additional info
The text was updated successfully, but these errors were encountered: