VirtualBox

Ticket #12370 (new defect)

Opened 16 months ago

Last modified 15 months ago

File Mangled When Accessed in VB

Reported by: thosoc Owned by:
Priority: major Component: other
Version: VirtualBox 4.2.18 Keywords:
Cc: Guest type: other
Host type: Mac OS X

Description

I would like to report some strange thing where content of files appeared to be mangled and truncated in several places when they are accessed on a virtual OS. In my case, the virtual OS is CentOS running in a VirtualBox 4.2.18, which resides in a MAC MINI running Lion. I've noticed this behavior a few times but had not the time to track it down until now.

I am including a couple of screenshots for illustration. The file "Native-screenshot.png" shows a .cpp source file as it was accessed locally using vi in the native MACOS where the code block on lines 4742-4750 shows the #else-if block and is followed by the function ACE_OS::thr_key_used. On the other hand, the file CentOS-screenshot.png shows the same code block that is mangled and truncated starting from line 4742 where the chunk of codes starting from ACE_OS::thr_key_used() to vx_execae() was chopped off.

Thank you for the help.

Thosoc

Attachments

Archive.zip Download (226.0 KB) - added by thosoc 16 months ago.
Zip file containing two screenshots
Archive2.zip Download (384.6 KB) - added by thosoc 16 months ago.
screenshot3.png Download (31.1 KB) - added by thosoc 15 months ago.

Change History

Changed 16 months ago by thosoc

Zip file containing two screenshots

comment:1 Changed 16 months ago by michael

Is this reproducible? Are you accessing the file by ssh-ing to the host in both cases (host and guest)? If so, does changing the networking mode the guest is using make a difference? Does the undo function in "vi" on the guest make a difference? And please, attach a log file for the guest.

Changed 16 months ago by thosoc

comment:2 Changed 16 months ago by thosoc

Thanks Mike for your response. Below are responses to your inquiries.

Is this reproducible?

Yes, this behavior would manifest itself in random while I am editing a file or when I am compiling source files (.cpp and .java) regardless of whether I am using ssh or not. In the case of editing a file using "vi", sometimes the file was already corrupted upon initial open; and on other times, the file is corrupted while being scrolled up and down or being changed which is annoying. In the case of compiling a set of source files (using gmake, g++, and Java), the compiler would complain of errors in a single or multiple files, and upon inspecting, some of the files appeared to be alright while some others appeared to be corrupted. So, I think the real problem is the integrity of the file contents are questionable sometimes in VBox. I am including the VBox.log series and two screenshots that illustrated the problem with compiling the source file where I logged directly into the guest OS. In screenshot1, the g++ compiler complained about warning about "/*" on line 5165 and an error on line 5177 in file OS_NS_Thread.cpp; and, when I repeated the compiling process, the same file was compiled successfully. screenshot2 shows the questionable lines 5165 and 5177 with no problem.

I hope that would help to shed light on the problem.

Thank you for all your help.

Thosoc

comment:3 Changed 16 months ago by michael

Could you please be a bit more precise about what you are doing when you see file corruption? Are you accessing the same file on host and guest, and if so, how are you accessing it in both cases? Is the corruption always the same every time you access a particular file? Do you only see corruption from inside the guest? And do you see the same corruption if you open the file with "vi" and if you list it with "cat"?

comment:4 Changed 16 months ago by thosoc

Hi Michael,

Could you please be a bit more precise about what you are doing when you see file corruption?

The file corruption happens most often when I try to build a library (.lib or .jar) by compiling a set of source files on the guest OS with gmake and g++. When the compiler reports errors with a source file, I would first try to re-run gmake; and if it still fails, then most often I use "vi" to investigate the file.

Are you accessing the same file on host and guest, and if so, how are you accessing it in both cases?

First, some info about my workspace: my home directory resides on a file server that is accessible to me when I logged into the guest OS. The guest OS resides in a VirtualBox on my local host machine (a MAC MINI), and the set of files that I am working with resides in my home directory. I have to log into the guest OS via the VirtualBox directly for activities such as compiling and editing the files. I have to ssh into the file server from my local host machine in order to view the files from my local machine. If you wish, I can provide you with the set of source files that I am working with for testing. One last comment is that other people in my group have the same workspace arrangement on a Windows machines and see no problem.

Is the corruption always the same every time you access a particular file?

No, the file corruption appears in random on one or more files including binary file (like .o files). However, once a file is corrupted, it will remain so on the guest OS.

Do you only see corruption from inside the guest?

Yes, definitely. If a file is corrupted, it remains corrupted when accessing on the guest OS. However, the same file appears normal (not corrupted) when accessing on the file server.

And do you see the same corruption if you open the file with "vi" and if you list it with "cat"?

I have also tried "cat" as well as "more" and "netbeans" to open the suspected files, and the results are the same.

Thank you for all your help.

Regards,

Thosoc

comment:5 Changed 16 months ago by michael

I have some trouble conceiving how VirtualBox could be responsible for this, since it does not see the guest files directly, but rather the guest OS does. I could be wrong of course, but might this not be an issue with your CentOS guest rather than VirtualBox? Could you try installing a different guest (say an Ubuntu) for comparison to see if you still get the same issue? Might it even be corruption in your particular CentOS installation?

For my interest, are you mounting the file server directory in the guest or ssh-ing in from the guest?

Changed 15 months ago by thosoc

comment:6 Changed 15 months ago by thosoc

Hi Michael,

I have some trouble conceiving how VirtualBox could be responsible for this, since it does not see the guest files directly, but rather the guest OS does. I could be wrong of course, but might this not be an issue with your CentOS guest rather than VirtualBox?

I must beg to differ from your assessment. Shouldn't VirtualBox emulate (and translate) the underlying hardware and provide I/O transparency in a sandbox environment so that the guest OS could exist. I got a few hits when searching the tickets with "file corrupt". In one of those that was fixed for the Windows, and someone else has commented on that same ticket about experiencing file corruption on a MAC running Lion as well.

Could you try installing a different guest (say an Ubuntu) for comparison to see if you still get the same issue? Might it even be corruption in your particular CentOS installation?

Here are what I have done:

1) I don't have an Ubuntu at the moment, but I have tried to repeat the test in guest ReadHat on my host machine, and I am seeing the same problem. 2) I have installed the OS as the native OS (not in a VirtualBox) with the same configuration on a physical Intell-CPU PC, and I have repeated the test and see no problem.

For my interest, are you mounting the file server directory in the guest or ssh-ing in from the guest?

Yes, the file server directory, which is my home dir, is mounted locally in the guest OS as shown in the output of the "df" command. Please see the attached file.

Thank you for your help.

Regards,

Thosoc

comment:7 Changed 15 months ago by michael

There are indeed a number of tickets about file corruption inside virtual machines. The ones I am aware of are about file corruption when using VirtualBox's shared folder functionality, which includes a file-system driver installed in the guest. You are not using VirtualBox shared folders, but an equivalent functionality in the guest operating system you have installed, probably the guest system's SMB or NFS driver. VirtualBox is only involved in this insofar as it provides the CPU (and chip-set, memory and so on) emulation which lets the guest system run at all and the network card emulation which passes the network data from the guest to the file server. Does it seem likely to you that the corruption you are seeing could be caused by failure of physical hardware (most likely the network card) if this were a physical and not a virtual machine? It seems unlikely to me as the network card passes packages through without understanding their contents.

I would still appreciate it if you could see if this still occurs with a new virtual machine installation - ideally a different guest operating system, but even a fresh installation of the same system would be interesting.

comment:8 Changed 15 months ago by michael

You could also try out a recent VirtualBox build - there have indeed been a number of fixes in CPU emulation in case that really is the issue.

 http://www.virtualbox.org/download/testcase/VirtualBox-4.3.3-90819-OSX.dmg

comment:9 Changed 15 months ago by thosoc

Hi Michael,

In regarding to the network interfaces, I agree that it is unlikely because other network traffic was not affected. There are two NI's on the MINI MAC, wired, and wireless, and I still see problem when using either interface, so I don't think that is the problem. I did a binary dump of a corrupted file, and it seems that some low-level buffer (or catch) was not flushed since the corrupted data which are readable appeared to belong to some other files. Now, that this problem has stirred my curiosity, could you let me know where I should look in the source code?

I still see the problem with the VirtualBox release that you have recommended and with a fresh install of CentsOS or RedHat.

I am trying to get a copy of Ubuntu OS for testing.

Thank you for your help.

Regards,

Quynh

comment:10 Changed 15 months ago by michael

Probably the best way to start debugging this would be to find a simpler test case which can be reproduced without your file server. I can't really give you any clues about where to look in the code, as when shared folders (the VirtualBox variant) are not in use we do not touch guest file caches.

Note: See TracTickets for help on using tickets.

www.oracle.com
ContactPrivacy policyTerms of Use