XHR connections aren't closed properly

Bug #1031750 reported by Björn Tillenius on 2012-08-01
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Mozilla Firefox
firefox (Ubuntu)

Bug Description

In Firefox 14, when I abort an XHR connection, it seems like the connection doesn't get closed properly at the system level, or at least not as quickly as before. Firebug shows the connection as aborted, but the actual network connection seems to still be open.

I'm attaching a sample web server that keeps the connection open (like a long poll request) and a sample HTML file that creates XHR connections and aborts them after a seconds. Using lsof (lsof -i | grep localhost | grep firefox | wc --line) I can see that the number of connections just keeps growing, until Firefox's connection limit is reached.

This causes a problem for automatic testing, which quickly navigates through different pages. Since each page opens up a new connection that doesn't get closed, we run into a situation where the tests starts failing, since it can't connect to the server anymore.

I started seeing this behavior in Firefox 14 (Ubuntu version 14.0.1+build1-0ubuntu0.12.04.1) and I see it 14.0.1 downloaded from mozilla.org as well. If I downgrade to Firefox 11 (Ubuntu version 11.0+build1-0ubuntu4) the number of open connections stay at 1 when running the attached test scripts.

To reproduce the problem, run "python long_poll.py" to start a web server. Then open abort_request.html in Firefox, which will open an XHR connection and abort it once every second. While abort_request.html is running look at the output of "lsof -i | grep localhost | grep firefox | wc --line". In Firefox 11 it stays around 1 and in Firefox 14 it goes up to 15, which is my configured connection limit (network.http.max-connections-per-server).

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: firefox 14.0.1+build1-0ubuntu0.12.04.1
ProcVersionSignature: Ubuntu 3.2.0-27.43-generic 3.2.21
Uname: Linux 3.2.0-27-generic x86_64
AddonCompatCheckDisabled: False
AlsaVersion: Advanced Linux Sound Architecture Driver Version 1.0.24.
 **** List of PLAYBACK Hardware Devices ****
 card 0: Intel [HDA Intel], device 0: CONEXANT Analog [CONEXANT Analog]
   Subdevices: 1/1
   Subdevice #0: subdevice #0
ApportVersion: 2.0.1-0ubuntu11
Architecture: amd64
 **** List of CAPTURE Hardware Devices ****
 card 0: Intel [HDA Intel], device 0: CONEXANT Analog [CONEXANT Analog]
   Subdevices: 1/1
   Subdevice #0: subdevice #0
 /dev/snd/controlC0: bjorn 3512 F.... pulseaudio
BuildID: 20120713224749
 Card hw:0 'Intel'/'HDA Intel at 0xf2620000 irq 48'
   Mixer name : 'Conexant CX20561 (Hermosa)'
   Components : 'HDA:14f15051,17aa20ff,00100000'
   Controls : 21
   Simple ctrls : 13
 Card hw:29 'ThinkPadEC'/'ThinkPad Console Audio Control at EC reg 0x30, fw 7XHT21WW-1.03'
   Mixer name : 'ThinkPad EC 7XHT21WW-1.03'
   Components : ''
   Controls : 1
   Simple ctrls : 1
 Simple mixer control 'Console',0
   Capabilities: pswitch pswitch-joined penum
   Playback channels: Mono
   Mono: Playback [on]
Channel: Unavailable
Date: Wed Aug 1 15:18:25 2012
ForcedLayersAccel: False
PrefSources: prefs.js
 PATH=(custom, user)
Profiles: Profile0 (Default) - LastVersion=11.0/20120410121533 (Out of date)
 rhythmbox-mozilla 2.96-0ubuntu4.1
 totem-mozilla 3.0.1-0ubuntu21
 sun-java6-bin 6.26-1oneiric1
RunningIncompatibleAddons: False
SourcePackage: firefox
UpgradeStatus: Upgraded to precise on 2011-12-16 (229 days ago)
 pcm.btheadset {
         type bluetooth
         device 00:0D:3C:6B:34:39
         profile "auto"

dmi.bios.date: 12/19/2008
dmi.bios.vendor: LENOVO
dmi.bios.version: 6DET38WW (2.02 )
dmi.board.name: 74695RG
dmi.board.vendor: LENOVO
dmi.board.version: Not Available
dmi.chassis.asset.tag: No Asset Information
dmi.chassis.type: 10
dmi.chassis.vendor: LENOVO
dmi.chassis.version: Not Available
dmi.modalias: dmi:bvnLENOVO:bvr6DET38WW(2.02):bd12/19/2008:svnLENOVO:pn74695RG:pvrThinkPadX200s:rvnLENOVO:rn74695RG:rvrNotAvailable:cvnLENOVO:ct10:cvrNotAvailable:
dmi.product.name: 74695RG
dmi.product.version: ThinkPad X200s
dmi.sys.vendor: LENOVO

Björn Tillenius (bjornt) wrote :
Björn Tillenius (bjornt) wrote :
Björn Tillenius (bjornt) wrote :

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:15.0) Gecko/20100101 Firefox/15.0
Build ID: 20120726160848

Steps to reproduce:

Load up our web application with FF14 on Ubuntu and reload the page a few times ~10 times.

Actual results:

Around the 10th reload, firefox will spin connecting to the web site.

Increasing max_connections_per_server dimishes this problem. After inspecting lsof/netstat, I can see that the connections are being held onto across page reloads, specifically, it appears as though the XHR is being held open across reloads until some built-in timeout is hit (I guess around 2 minutes).

This problem did not occur in FF13, and just trying the FF15 beta, the problem is not occurring there. Since users can install FF14, and it is the default on Ubuntu, it seems like something that should be fixed.

Expected results:

The web site should have loaded immediately, the connections should have been closed when the user hits reload on the page.

See the Launchpad bug for a test case that reproduces the issue on FF14

Changed in firefox:
importance: Unknown → Medium
status: Unknown → New
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in firefox (Ubuntu):
status: New → Confirmed
Changed in firefox:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.