All webbrowser-app tests failing with new autopilot

Bug #1231492 reported by Łukasz Zemczak
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fix Released
Olivier Tilloy
webbrowser-app (Ubuntu)
Fix Released

Bug Description

When using the latest autopilot from the daily-build PPA (1.3.1+13.10.20130926-0ubuntu1), all webbrowser-app tests are failing on Ubuntu Touch (mako). The errors have such a form:

ERROR: webbrowser_app.tests.test_tabs.TestTabs.test_close_tab(with touch)
_StringException: Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/webbrowser_app/tests/", line 235, in setUp
    super(StartOpenRemotePageTestCaseBase, self).setUp()
  File "/usr/lib/python2.7/dist-packages/webbrowser_app/tests/", line 210, in setUp
    self.server = http_server.HTTPServerInAThread(HTTP_SERVER_PORT)
  File "/usr/lib/python2.7/dist-packages/webbrowser_app/tests/", line 79, in __init__
    self.server = BaseHTTPServer.HTTPServer(("", port), HTTPRequestHandler)
  File "/usr/lib/python2.7/", line 419, in __init__
  File "/usr/lib/python2.7/", line 108, in server_bind
  File "/usr/lib/python2.7/", line 430, in server_bind
  File "/usr/lib/python2.7/", line 224, in meth
    return getattr(self._sock,name)(*args)
error: [Errno 98] Address already in use

Related branches

Changed in webbrowser-app:
importance: Undecided → High
Revision history for this message
Didier Roche (didrocks) wrote :

Please before reproposing for landing autopilot, try testing all apps AP tests so that we can reschedule it on the landing plan.

Revision history for this message
Olivier Tilloy (osomon) wrote :

The webbrowser-app autopilot tests fire up a test HTTP server in a thread, and this error means that it fails to claim the port on which it wants to listen to incoming requests, which usually means that a previous test hasn’t been cleaned up correctly (and another old test process is still running, blocking this port).

Note that the browser test case does the required cleanup and shuts down the test server in its tearDown() method, so I don’t think the issue is there.

This issue pops up from time to time, I don’t know whether autopilot could be made more robust to ensure that there’s never a leftover test process running.

Revision history for this message
Corey Goldberg (coreygoldberg) wrote :

> Note that the browser test case does the required cleanup
> and shuts down the test server in its tearDown() method,
> so I don't think the issue is there.

it might not always get called.

in the autopilot tests of webbrowser-app, both 'BrowserTestCaseBase' and 'BrowserTestCaseBaseWithHTTPServer' use tearDown() funtions. It would be more robust to add these as cleanups rather than teardowns.

tearDown is only called if the setUp() succeeds, whereas a cleanup is called unconditionally. (cleanups were new in Python 2.7's unittest, and also exist in testtools.TestCase)


so if a setUp() fails somewhere after the server is started, the tearDown will not be called, leaving a hanging server process around.

for example, in 'BrowserTestCaseBaseWithHTTPServer' class, you could rename tearDown() to cleanup() (or whatever), and inside the setUp, add:


this would make it more robust and possibly alleviate this issue.

p.s. if this wasn't explained clearly, I can MP a fix to webbrowser-app changing from tearDowns to addCleanups.
the TestCase class I'm referring to reside in /tests/autopilot/webbrowser_app/tests/ of webbrowser-app.


Revision history for this message
Corey Goldberg (coreygoldberg) wrote :

I MP'ed a branch of webbrowser-app changing the tearDowns to Cleanups.

no longer affects: autopilot
Revision history for this message
Corey Goldberg (coreygoldberg) wrote :

another thought is to make the http server in look for a free port before trying to bind, ensuring it never conflicts with another zombie instance or running service.

Olivier Tilloy (osomon)
Changed in webbrowser-app:
assignee: nobody → Olivier Tilloy (osomon)
status: New → In Progress
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

Fix committed into lp:webbrowser-app at revision None, scheduled for release in webbrowser-app, milestone ubuntu-13.04-month-5

Changed in webbrowser-app:
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package webbrowser-app - 0.22+13.10.20131004.1-0ubuntu1

webbrowser-app (0.22+13.10.20131004.1-0ubuntu1) saucy; urgency=low

  [ Alexandre Abreu ]
  * Harden the set of accepted url patterns. (LP: #1226690)
  * When the browser is requested to create a new tab (from a new window
    request), open the new tab externally when in webapp mode. (LP:

  [ Robert Bruce Park ]
  * Enable hardening, and fix some lintian warnings.

  [ Olivier Tilloy ]
  * Use a different port for the test server when a zombie process
    doesn’t release the default one, and use cleanup functions instead
    of tearDown() for improved robustness. (LP: #1231492)
  * Live bookmarking functionality in the activity view. Known
    shortcoming: in the activity view, one should be allowed to bookmark
    a domain that contains only one page. This is currently not the
    case, it will be addressed separately.
  * Expose a single contextual menu for both images and hyperlinks. (LP:

  [ Ubuntu daily release ]
  * Automatic snapshot from revision 367
 -- Ubuntu daily release <email address hidden> Fri, 04 Oct 2013 07:22:38 +0000

Changed in webbrowser-app (Ubuntu):
status: New → Fix Released
Olivier Tilloy (osomon)
Changed in webbrowser-app:
status: Fix Committed → Won't Fix
status: Won't Fix → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers