View Issue Details

IDProjectCategoryView StatusLast Update
0003387OpenFOAMBugpublic2019-11-20 11:44
Reporterbillie Assigned Tohenry  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionno change required 
PlatformGNU/LinuxOSUbuntuOS Version18.04.3 LTS
Summary0003387: foamListTimes directory removal fails within shared folder of VirtualBox 6.0.14 (works with 5.2.32)
DescriptionAfter upgrading to VirtualBox 6 I noticed that foamListTimes can not remove directories any more within a VirtualBox shared folder. It removes the files within these directories but then fails to remove the directory itself. For a multi-region case it then stops after the first region. Normal directory and file creation as well as deletion using e.g. mkdir, touch, rm and rmdir works as expected in shared folders.

I tested with the current VirtualBox Version 6.0.14. It works fine with VirtualBox Version 5.2.32. The Guest Operation system running inside the virtual machine is Ubuntu 18.04.3 LTS.
Steps To ReproduceAn example output when running (foamListTimes -rm) looks like the following:

--> FOAM Warning :
    From function bool Foam::rmDir(const Foam::fileName&)
    in file POSIX.C at line 1119
    failed to remove directory "/home/openfoam/OpenFOAM/projects/debug_vbox6/sample_test/12/fluid_water"
--> FOAM Warning :
    From function bool Foam::rmDir(const Foam::fileName&)
    in file POSIX.C at line 1089
    failed to remove directory "fluid_water" while removing directory "/home/openfoam/OpenFOAM/projects/debug_vbox6/sample_test/12"
Additional InformationFor me this is clearly a regression in Virtualbox as it works fine with versions 5 but fails in versions 6 so I already opened a bug at the VirtualBox bug tracker (https://www.virtualbox.org/ticket/19061).
The response after opening the bug was that they are lacking a test case. It is however difficult for me to provide one as I probably have to share my VirtualBox image so they can reproduce the issue. However the image is 30 GB in size. Additionally I am not very happy with sharing this image.
They also argued that the error reporting of the relevant code is not enough to find the underlying issue and they are not familiar with OpenFOAM and its code base to find the definition of the rmDir function and why it fails.
This is why I am reaching out to you as experts regarding the OpenFOAM code base. Maybe you can help tracking down this issue and help fixing it in one way or another.

I think using the two versions of VirtualBox this can be reproduced easily with any OpenFOAM case. However if required I can provide the small test case I am using. Just tell me if you need any other information.
TagsNo tags attached.

Activities

wyldckat

2019-11-14 20:03

updater   ~0010904

A few questions:

1. Which operating system are you using on the real machine?

2. Is a file manager open in either the real machine or in the virtual machine?

3. What happens if you delete the folder via file manager on Ubuntu (virtual machine)? Namely if you are able to delete those folders manually before running foamListTimes?

wyldckat

2019-11-14 20:04

updater   ~0010905

Sorry, regarding question 2, the idea is that if the file manager is open on the case folder, in a way that it might be "looking at" the files that you want to delete.

billie

2019-11-14 21:48

reporter   ~0010907

1. Windows 10 Professional. I don't know the exact version code but can provide this tomorrow if needed.

2. I understand what you think. You mean that the files are locked in some way. I don't think this is the reason. I have reproduced this many times it fails with Vbox 6 and works with Vbox 5. I doubt that I always had the files locked. I can try however once more without leaving anything in use.

3. I think I mentioned this in the report. Normal file operations work as expected. But I only tried it from a terminal and I think I did not try to delete the result folders from the terminal or the file manager. If this would be a problem however OpenFOAM would have created this files with such permissions that I can not delete them which does not make sense. From the permissions everything looks okay. Still I can investigate in this regard.

billie

2019-11-15 07:05

reporter   ~0010909

Getting back with more information.

1. Actually the host operating system is Windows 10 Enterprise 1803 (17134.1069).

2. Tested again without anything open that might block removal still the problem remains.

3. I can delete the files from the file manager and the terminal without problems.

tniemi

2019-11-15 14:09

reporter   ~0010912

Hmm, my suspicion is that OpenFOAM deletes the files in the folder and then tries to delete the folder itself, but VirtualBox can't keep up and the folder still appears to contain files which prevent removing the folder. The logic in rmDir is to loop over all items, delete them (recursively if it is a subdirectory) and then delete the top directory.

OpenFOAM uses POSIX "remove" to delete the folder, in line 1023 of POSIX.C. The documentation for "remove" (https://linux.die.net/man/3/remove) says that it uses rmdir for directories, which requires the directory to be empty. It might be that there is still some leftovers in the directory preventing deletion.

If it is possible for you to edit and compile the OpenFOAM, you could try to add errno print to rm-function to see what is the reason for failing to remove the file. For example, the mkDir-function has an example of catching errno.

tniemi

2019-11-15 15:17

reporter   ~0010913

Actually, reading the bug reports of VirtualBox, "ReinerB" (https://www.virtualbox.org/ticket/18569#comment:21) has mentioned that "rm -r" doesn't work and this hasn't been fixed as far as I understand. So to me it seems that reliably deleting folders is potentially difficult.

tniemi

2019-11-15 18:19

reporter   ~0010914

I just noticed that ReinerB has made a bug report about the rm -r problem (https://www.virtualbox.org/ticket/19086) and it seems that VirtualBox team has been able to reproduce it. It is likely that if they can fix the problem, it will fix foamListTimes as well.

billie

2019-11-17 18:19

reporter   ~0010916

Thanks for letting me know. I also commented on https://www.virtualbox.org/ticket/18569 but they seemed not to care so I opened a new ticket. Maybe they do now with https://www.virtualbox.org/ticket/19086.

henry

2019-11-20 11:44

manager   ~0010922

It looks like this issue relates to bugs in VirtualBox 6.0.14 and cannot be resolved by changes to OpenFOAM.

Issue History

Date Modified Username Field Change
2019-11-14 17:39 billie New Issue
2019-11-14 20:03 wyldckat Note Added: 0010904
2019-11-14 20:04 wyldckat Note Added: 0010905
2019-11-14 21:48 billie Note Added: 0010907
2019-11-15 07:05 billie Note Added: 0010909
2019-11-15 14:09 tniemi Note Added: 0010912
2019-11-15 15:17 tniemi Note Added: 0010913
2019-11-15 18:19 tniemi Note Added: 0010914
2019-11-17 18:19 billie Note Added: 0010916
2019-11-20 11:44 henry Assigned To => henry
2019-11-20 11:44 henry Status new => closed
2019-11-20 11:44 henry Resolution open => no change required
2019-11-20 11:44 henry Note Added: 0010922