Intermitent Selenium unit test timout error

Bug #1241027 reported by Thomas Goirand
26
This bug affects 6 people
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Invalid
Medium
Unassigned
Juno
Won't Fix
Undecided
Unassigned
Mitaka
Invalid
Medium
Unassigned

Bug Description

I have the following error *SOMETIMES* (eg: sometimes it does work, sometimes it doesn't):

This is surprising, because the python-selenium, which is non-free, isn't installed in my environment, and we were supposed to have a patch to not use it if it was detected it wasn't there.

Since there's a 2 seconds timeout, probably it happens when my server is busy. I would suggest to first try increasing this timeout to something like 5 seconds or something similar...

ERROR: test suite for <class
'openstack_dashboard.dashboards.admin.users.tests.SeleniumTests'>
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/nose/suite.py", line 227, in run
    self.tearDown()
  File "/usr/lib/python2.7/dist-packages/nose/suite.py", line 350, in
tearDown
    self.teardownContext(ancestor)
  File "/usr/lib/python2.7/dist-packages/nose/suite.py", line 366, in
teardownContext
    try_run(context, names)
  File "/usr/lib/python2.7/dist-packages/nose/util.py", line 469, in try_run
    return func()
  File
"/home/zigo/sources/openstack/havana/horizon/build-area/horizon-2013.2~rc3/horizon/test/helpers.py",
line 179, in tearDownClass
    super(SeleniumTestCase, cls).tearDownClass()
  File "/usr/lib/python2.7/dist-packages/django/test/testcases.py", line
1170, in tearDownClass
    cls.server_thread.join()
  File "/usr/lib/python2.7/dist-packages/django/test/testcases.py", line
1094, in join
    self.httpd.shutdown()
  File "/usr/lib/python2.7/dist-packages/django/test/testcases.py", line
984, in shutdown
    "Failed to shutdown the live test server in 2 seconds. The "
RuntimeError: Failed to shutdown the live test server in 2 seconds. The
server might be stuck or generating a slow response.

The same way, there's this one, which must be related (or shall I say, due to the previous error?):

ERROR: test suite for <class
'openstack_dashboard.test.tests.selenium.BrowserTests'>
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/nose/suite.py", line 208, in run
    self.setUp()
  File "/usr/lib/python2.7/dist-packages/nose/suite.py", line 291, in setUp
    self.setupContext(ancestor)
  File "/usr/lib/python2.7/dist-packages/nose/suite.py", line 314, in
setupContext
    try_run(context, names)
  File "/usr/lib/python2.7/dist-packages/nose/util.py", line 469, in try_run
    return func()
  File
"/home/zigo/sources/openstack/havana/horizon/build-area/horizon-2013.2~rc3/horizon/test/helpers.py",
line 173, in setUpClass
    super(SeleniumTestCase, cls).setUpClass()
  File "/usr/lib/python2.7/dist-packages/django/test/testcases.py", line
1160, in setUpClass
    raise cls.server_thread.error
WSGIServerException: [Errno 98] Address already in use

Matthias Runge (mrunge)
Changed in horizon:
status: New → Triaged
Changed in horizon:
status: Triaged → Confirmed
Changed in horizon:
assignee: nobody → Maria Nita (maria-nita-dn)
Changed in horizon:
assignee: Maria Nita (maria-nita-dn) → nobody
Revision history for this message
Matthias Runge (mrunge) wrote :

I just got that issue, even when running:
./run_tests.sh -N -P

which shouldn't execute selenium tests at all.

Running Horizon application tests
./usr/lib/python2.7/site-packages/compressor/cache.py:8: DeprecationWarning: django.utils.simplejson is deprecated; use json instead.
  from django.utils import simplejson
......................................................................................................SSSE
======================================================================
ERROR: test suite for <class 'horizon.test.tests.selenium.BrowserTests'>
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/nose/suite.py", line 227, in run
    self.tearDown()
  File "/usr/lib/python2.7/site-packages/nose/suite.py", line 350, in tearDown
    self.teardownContext(ancestor)
  File "/usr/lib/python2.7/site-packages/nose/suite.py", line 366, in teardownContext
    try_run(context, names)
  File "/usr/lib/python2.7/site-packages/nose/util.py", line 469, in try_run
    return func()
  File "/builddir/build/BUILD/horizon-2014.1.b3/horizon/test/helpers.py", line 176, in tearDownClass
    super(SeleniumTestCase, cls).tearDownClass()
  File "/usr/lib/python2.7/site-packages/django/test/testcases.py", line 1207, in tearDownClass
    cls._tearDownClassInternal()
  File "/usr/lib/python2.7/site-packages/django/test/testcases.py", line 1197, in _tearDownClassInternal
    cls.server_thread.join()
  File "/usr/lib/python2.7/site-packages/django/test/testcases.py", line 1118, in join
    self.httpd.shutdown()
  File "/usr/lib/python2.7/site-packages/django/test/testcases.py", line 1010, in shutdown
    "Failed to shutdown the live test server in 2 seconds. The "
RuntimeError: Failed to shutdown the live test server in 2 seconds. The server might be stuck or generating a slow response.
----------------------------------------------------------------------
Ran 106 tests in 27.316s
FAILED (SKIP=3, errors=1)

Changed in horizon:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.openstack.org/84683

Changed in horizon:
assignee: nobody → Matthias Runge (mrunge)
status: Confirmed → In Progress
Matthias Runge (mrunge)
tags: added: icehouse-backport-potential
Matthias Runge (mrunge)
Changed in horizon:
milestone: none → juno-1
Matthias Runge (mrunge)
Changed in horizon:
assignee: Matthias Runge (mrunge) → nobody
status: In Progress → Triaged
milestone: juno-1 → none
Revision history for this message
Richard Jones (r1chardj0n3s) wrote :

I can't reproduce this, and the Django LiveServerTestCase code has changed a bunch since this was reported. In the absence of updated bug report, I think this should be closed.

Changed in horizon:
status: Triaged → Incomplete
Revision history for this message
Lucas Simon Rodrigues Magalhaes (lucassrod) wrote :

I had the same problem on a personal project.

I think the problem is in the method tearDownClass
    super (SeleniumTestCase, cls) .tearDownClass ()

If you have several tests with selenium, sometimes exploding the error:

[Errno 98] Address already in use \ n -------------------- >> captured begin logging << ------------- ------- \ nselenium.webdriver.remote.remote_connection: DEBUG: DELETE http://127.0.0.1:33426/hub/session/cd8f384f-a7f3-4f89-95d5-c21a5e0f17e5 {"session
Id ":" cd8f384f-a7f3-4f89-95d5-c21a5e0f17e5 "} \ nselenium.webdriver.remote.remote_connection: DEBUG: Finished Request \ n -------------------- >> << end captured logging --------------------- '

As a solution I switched

# @classmethod
# def setUpClass(cls):
# super(IndexViewPage, cls).setUpClass()
# cls.selenium = WebDriver()

# @classmethod
# def tearDownClass(cls):
# cls.selenium.quit()
# super(IndexViewPage, cls).tearDownClass()

To:

def setUp(self):
        self.selenium = WebDriver()
        self.selenium.maximize_window()
        super(IndexViewPage, self).setUp()

    def tearDown(self):
        self.selenium.quit()
        super(IndexViewPage, self).tearDown()

you can change the verbiage in the nose also to better ascertain the error

NOSE_ARGS = [
     '--verbosity = 2'
     '-x',
     'd'
     '--with-specplugin'
     '--with-xtraceback'
     '--with-progressive'
]

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for OpenStack Dashboard (Horizon) because there has been no activity for 60 days.]

Changed in horizon:
status: Incomplete → Expired
Revision history for this message
Thomas Goirand (thomas-goirand) wrote :

I've reopened the issue, as there's no sign that it was fixed.

Changed in horizon:
status: Expired → Confirmed
Revision history for this message
Timur Sufiev (tsufiev-x) wrote :

Thomas, were you able to reproduce it after Richard's unsuccessful attempt? Btw, he has significantly rewritten selenium tests recently.

Revision history for this message
Thomas Goirand (thomas-goirand) wrote :

I haven't experienced this recently, so I believe it's still only in Juno, and it doesn't affect any recent version of Horizon (so that bug can be closed).

Cheers!

Revision history for this message
Timur Sufiev (tsufiev-x) wrote :

Ok, Juno is EOL already, so closing this one as Won't Fix.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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