Affichage des articles dont le libellé est freeze. Afficher tous les articles
Affichage des articles dont le libellé est freeze. Afficher tous les articles

29 nov. 2012

Virtualbox and Centos: Frozen network, Detected Tx Unit Hang

Since few days I had a really annoying issue with one of my virtual machine:

I run a python script using urllib2 to collect some data from various online APIs. Everything seems to run smoothly when sudenly the script starts to hang and becomes unresponsive (CTRL+C does not have any effect). I open a new shell to see what's going on and I notice that any application that triggers a network activity starts to hang (yum, pip...). I open my TTY console and I notice that some error messages are popping : "eth0: Detected Tx Unit Hang", "eth0 Reset Adapter" and something about kernel hang timeout... A lot of signs that something really bad is happening on this machine. The only way to recover from it consists in performing a hardware reset of the Guest machine, but the problem arises again shortly after.


Screenshot of the situation

The issue had nothing to do with my script or my VM setup, but was in the configuration of the VirtualBox instance. I have a Intel i7-2600 CPU with 4 cores on my Host, so I though it was a good idea to assign multiple cores to my VM to improve performances and to have something closer to my production server. Turns out that by doing this I caused the problem: assigning more than 1 cpu to my VM results in the network interface to hang and freeze the kernel after a certain amount of data is transmited. I'm using the last version of Virtualbox to date (4.2.4) with Centos (6.3). Hopefully this will be fix in the next release.

TL;DR: If your VM is hanging and shows some network errors, check how many CPU you assigned to it, and if this is more than one, reduce it.

I posted this fix in English because I ran into this annoying situation and I wanted it to be available to more than my usual French audience, considering I didn't find that much info about it except this old entry in Virtualbox bugtracker.