Friday, June 25, 2010

VirtualBox Eating Packets from Firefox?

I hit this bizzare behavior in Firefox while working on a Drupal module which uses jQuery to fetch JSON data from the server: A $.post() call to a URL on the Drupal server expected to return a JSON object would get an error 400 from the server. On the server's error log, I got this:

[Fri Jun 25 12:10:40 2010] [error] [client 10.0.2.2] request failed: error reading the headers, referer: https://server-host-name:2443/?q=alerts/wic/ug

In this case, the server is a virtual machine running Ubuntu 10.04 as a VirtualBox guest on my workstation running Windows XP Pro SP3 (well, an enterprise-built standard image, actually) as the host. Port 2443 on the host is forwarded to port 443 on the guest.

Reloading the same page in Firefox would bring back the expected results occasionally -- when the problem started to happen, it seemed that success rate was 1 out of 5 to 8. Half a day later, that dropped to 1 out of 20, which pretty much stopped my from working on the code.

So, I tried Chrome and Internet Explorer. None of them showed the same behavior.

Next, I fired up wireshark in Ubuntu. Packets captured from Chrome and IE session looked OK -- at least the HTTPS sessions were decrypted. However, Firefox sessions captured were not decrypted by wireshark.

Next, I deployed the same code to the production server. Hitting the same page in Firefox on the production server did not cause the same Firefox behavior.

In the end, shutting down and restarting the virtual machine seemed to have fixed the problem. But the whole episode left me scratching my head: It seemed VirtualBox was the most likely culprit. But why only Firefox?