Virtualbox 4.1.8 XP host Ubuntu 10.04.3 serial port/shutdown

Discussions related to using VirtualBox on Windows hosts.

Virtualbox 4.1.8 XP host Ubuntu 10.04.3 serial port/shutdown

Postby aproject » 10. Feb 2012, 17:32

Host: Windows XP, 2GB RAM, Virtualbox 4.1.8 with extensions 4.1.8 installed
Guest: Ubuntu 10.04.3, 1GB RAM with guest additions installed
Problem summary: Guest won't shut down normally when serial COM port is actively receiving data

A microprocessor-based device is attached to the host COM1 port via RS-232.

My application (a C-language program) is running on the guest OS which has the virtualized serial port (via Port 1, Enabled, Port number COM1, Port mode Host Device, Port/File Path: COM1:) open at the time I want to shut the system down. The application program is started via /etc/init.d/rc.local and is run in NOHUP (that is, nohup sh (some script)). My program does not have any provision to monitor for signals (to shutdown gracefully via external signal). There is no adverse consequence to my application environment for an uncontrolled shutdown.

The application program sends a poll message about once a minute, after an initial delay of about a minute.
The external microprocessor-based device sends a response multiple times per second, regardless of whether a poll is received or not. This means once my program starts and opens the serial port, it will immediately be receiving data from the external device, regardless of when my program sends a poll.

When the external device is disconnected (so that the polls are being sent, but no responses are being received), the Ubuntu 10.04.3 guest can be shutdown (via the shutdown button on the Ubuntu menu bar) repeatably without difficulty.

When the external device is connected (so that responses are being received), the Ubuntu 10.04.3 guest USUALLY (but not absolutely always) will not shutdown using the same (shutdown button) procedure. When it fails to shutdown, I try to close the Guest window with the windows close button, but that does not respond (I don't see a Virtualbox dialog box offering ACPI shutdown, power-off, etc.) I can only force the window to close with the Windows taskmanager, and it only closes after a short (maybe 30 second) delay. I get another dialog box offering to send a problem report to microsoft (I dismiss that dialog.)

As I wish to provide my application and virtual machine to a colleague for field demo, this shutdown issue is of consequence.

Two log files (each with a single session) are attached, one reflecting the failed shutdown process (serial device attached/sending), the other reflecting a normal shutdown process (serial device unattached).

VBox-failed-serialport-receiving.log
With serial port device attached and sending data to the host (and on to the guest) at time of guest shutdown, attempt failed
(56.83 KiB) Downloaded 8 times

VBox-succeeded-serialport-idle.log
With serial port device unattached, shutdown attempt succeeded normally
(79.57 KiB) Downloaded 1 time


Thank you for any advice or pointer to which forum area would be more appropriate
aproject
 
Posts: 14
Joined: 10. Feb 2012, 17:03

Re: Virtualbox 4.1.8 XP host Ubuntu 10.04.3 serial port/shut

Postby mpack » 10. Feb 2012, 18:05

Are you sure this is a VirtualBox problem? Are you sure it isn't an Ubuntu problem?
mpack
Site Moderator
 
Posts: 13143
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows XP
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Virtualbox 4.1.8 XP host Ubuntu 10.04.3 serial port/shut

Postby aproject » 14. Feb 2012, 15:43

The virtual machine will reboot properly on request 100% of the time; I don't know to what extent Ubuntu reboot is equivalent or not to shutdown/startup. A real ubuntu machine running the same environment shuts down without difficulty.

For an unattended environment (in which this will eventually go), the inability of Virtualbox to positively shut down as demonstrated here (regardless of potential misbehavior of the guest system) is a serious concern/deficiency.
aproject
 
Posts: 14
Joined: 10. Feb 2012, 17:03

Re: Virtualbox 4.1.8 XP host Ubuntu 10.04.3 serial port/shut

Postby mpack » 14. Feb 2012, 18:03

I would imagine that the problem must be that you are running at a relatively high data rate, and the overhead of virtual-interrupting on every character sent and received (16450 mode) is creating a high CPU burdern.

There's an option I've seen in the VBox UART simulation source code which checks for a UART option "Enable16550A=true" being set. If set then the 16550A UART would be simulated instead, which means buffered I/O. I would try manually adding this option to the xml file (VBoxManage has no documented command to set it), but in truth I don't know if that option will be parsed and passed to the guest. Worth a try though. If it works then you ought to see a significant drop in CPU hoggage before vs after. And of course I'd be interested to know if it does anything.
mpack
Site Moderator
 
Posts: 13143
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows XP
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Virtualbox 4.1.8 XP host Ubuntu 10.04.3 serial port/shut

Postby aproject » 17. Feb 2012, 00:23

Thank you for the assistance!

I am happy to do this experiment tomorrow, but could you advise where (near what existing text?) to put the additional item in the virtualbox XML file?

FYI I am using 38400 bps and receiving about 750 characters/second (and sending almost nothing.)

I am using a "real" COM port (on a laptop); I have not tried with USB serial port instead.
aproject
 
Posts: 14
Joined: 10. Feb 2012, 17:03

Re: Virtualbox 4.1.8 XP host Ubuntu 10.04.3 serial port/shut

Postby mpack » 17. Feb 2012, 13:28

It would be the VM settings file (vmname.vbox), not VirtualBox.xml.

The .vbox file will have a section like this :-

<UART>
<Port slot="0" enabled="true" IOBase="0x3f8" IRQ="4" path="COM1:" hostMode="HostDevice"/>
<Port slot="1" enabled="false" IOBase="0x2f8" IRQ="3" hostMode="Disconnected"/>
</UART>

The experiment would change it to look like this :-

<UART>
<Port slot="0" enabled="true" IOBase="0x3f8" IRQ="4" Enable16550A="true" path="COM1:" hostMode="HostDevice"/>
<Port slot="1" enabled="false" IOBase="0x2f8" IRQ="3" hostMode="Disconnected"/>
</UART>
mpack
Site Moderator
 
Posts: 13143
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows XP
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Virtualbox 4.1.8 XP host Ubuntu 10.04.3 serial port/shut

Postby aproject » 20. Feb 2012, 22:39

I tested per your suggestion (adding reference to the alternate UART), but got the same result (majority of the test attempts leave the guest window visible and incompletely closed.) If I hide (minimize, etc.) the guest window and re-expose it, it does not refresh itself (window content is solid white) and the window titlebar remains [Running]. I cannot close the window by clicking on the X in upper right corner (remember Windows XP host) - fI wait for several minutes and try to close it, I get "not responding" dialog box from Windows. When mouse is in the failed window, the hourglass mouse pointer is shown.

So, I remain with an unsolved problem - how can I FORCE Virtualbox to close it's guest in some timely, sure-fire manner?

Thank you,

Dave
aproject
 
Posts: 14
Joined: 10. Feb 2012, 17:03

Re: Virtualbox 4.1.8 XP host Ubuntu 10.04.3 serial port/shut

Postby aproject » 21. Feb 2012, 00:12

One more thing - I tested with a USB serial adapter (Prolific Technology Vendor 05AD Product 0FBA Revision 0300) and made a half dozen shutdowns with no difficulty. My normal failure rate (with the physical COM port on the computer) was 3 out of 4 would fail to shut down. The machine is a Dell laptop (the Windows XP device manager says "on Intel(R) QM57 Express Chipset LPC Interface Controller - 3B07"), so it only has the one serial port to try.

Any thought on how to proceed next (other than to leave COM port unsupported in my application, which would be unfortunate)?

Tks
aproject
 
Posts: 14
Joined: 10. Feb 2012, 17:03

Re: Virtualbox 4.1.8 XP host Ubuntu 10.04.3 serial port/shut

Postby Perryg » 21. Feb 2012, 00:26

I suspect the real issue is the guest actually using the com port. However I don't have an answer for you. You might try asking the DEVs what you could do but other than that I don't know who could tell you for sure. I looked at the code but since this is so low level I don't easily see how you could work around it. I know they hang out at irc://irc.freenode.org/vbox most of the time.
Perryg
Site Moderator
 
Posts: 25915
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX - Other

Re: Virtualbox 4.1.8 XP host Ubuntu 10.04.3 serial port/shut

Postby mpack » 21. Feb 2012, 12:53

aproject wrote:I tested with a USB serial adapter (Prolific Technology Vendor 05AD Product 0FBA Revision 0300) and made a half dozen shutdowns with no difficulty

That's no surprise. In that case the VM is talking to a virtual USB port and hence does not have the latencies involved in talking to a virtual NS16450 UART. Bear in mind that in the virtual UART case an interrupt is occurring on every single byte received, and maybe transmitted bytes too. Each interrupt will involve an expensive context switch and the execution of quite a lot of code. The overhead will be high.

USB data OTOH will be sent in packets, at a fraction of the CPU cost, even if the data rate is higher.

A 16550A sends data in small packets too, hence my wish to enable the feature. However it seems from your experiment that the Enable16550A switch does nothing: a pity, because the source code certainly caters for the 16550A.
mpack
Site Moderator
 
Posts: 13143
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows XP
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Virtualbox 4.1.8 XP host Ubuntu 10.04.3 serial port/shut

Postby aproject » 22. Feb 2012, 17:03

The machines don't appear overly taxed when using the "real" UART (with or without the modified chip identifier) at 750 char/sec, and data is not lost as seen by the application, etc.

I remain stuck with the original problem: the unexpected/undesirable behavior (I can't necessarily say virtualbox defect, but that's my impression) that Virtualbox host on XP can't guarantee shutdown the client in an orderly/timely manner. If Virtualbox can't shutdown the guest consistently, it makes unattended and/or untechnical user operation problematic (= I can't really deliver my software/application when it poses to end users a problem starting/stopping the virtualbox environment.)

Can I ask for this thread (which has been helpful and is really appreciated) to re-focus on the problem of reliable shutdown?

Thanks again,
aproject
 
Posts: 14
Joined: 10. Feb 2012, 17:03

Re: Virtualbox 4.1.8 XP host Ubuntu 10.04.3 serial port/shut

Postby mpack » 22. Feb 2012, 18:08

Is there a reason you don't want to use the USB solution?
mpack
Site Moderator
 
Posts: 13143
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows XP
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Virtualbox 4.1.8 XP host Ubuntu 10.04.3 serial port/shut

Postby aproject » 22. Feb 2012, 20:42

That (not supporting serial port, only USB) would be a work-around, but I would still like to drive towards making the native serial port function robust, and it is not at this point.

How/where do I submit a bug report?
aproject
 
Posts: 14
Joined: 10. Feb 2012, 17:03

Re: Virtualbox 4.1.8 XP host Ubuntu 10.04.3 serial port/shut

Postby mpack » 22. Feb 2012, 20:46

Bug reports go on the Bugtracker page. Ignore any notices you see about needing a separate account. Since OSSO you don't need a separate account, but it is a separate login and you'll be asked for a nickname. The latter doesn't need to match the forum, but that would be the obvious thing to do of course.
mpack
Site Moderator
 
Posts: 13143
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows XP
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Virtualbox 4.1.8 XP host Ubuntu 10.04.3 serial port/shut

Postby aproject » 27. Feb 2012, 19:35

aproject
 
Posts: 14
Joined: 10. Feb 2012, 17:03


Return to VirtualBox on Windows Hosts

Who is online

Users browsing this forum: Google [Bot] and 28 guests