Expanding some switch ports makes Network Explorer hang

Bug #1414934 reported by Morten Brekkevold
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Network Administration Visualized
Fix Released
Medium
Morten Brekkevold

Bug Description

When exploring a VLAN using the Network Explorer (NAV 4.1-4.2.2), expanding a switch port will sometimes cause a failing AJAX request.

The backend will return a 500 Internal Server error, while the frontend makes no report of this. Expanding a node causes a spinner icon to display while data is being loaded - the only feedback the user has is that the spinner icon now displays indefinitely.

On the backend, however, this traceback is e-mailed to the admins on every attempt:

Traceback (most recent call last):

  File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 109, in get_response
    response = callback(request, *callback_args, **callback_kwargs)

  File "/usr/lib/python2.7/dist-packages/django/views/generic/base.py", line 48, in view
    return self.dispatch(request, *args, **kwargs)

  File "/usr/lib/python2.7/dist-packages/django/views/generic/base.py", line 69, in dispatch
    return handler(request, *args, **kwargs)

  File "/usr/lib/python2.7/dist-packages/django/views/generic/detail.py", line 99, in get
    context = self.get_context_data(object=self.object)

  File "/usr/lib/python2.7/dist-packages/nav/web/networkexplorer/mixins.py", line 279, in get_context_data
    c.update(_get_connected_sysname(interface))

  File "/usr/lib/python2.7/dist-packages/nav/web/networkexplorer/mixins.py", line 341, in _get_connected_sysname
    'short': unicode(interface.to_netbox)

  File "/usr/lib/python2.7/dist-packages/nav/models/manage.py", line 97, in __unicode__
    return self.get_short_sysname()

  File "/usr/lib/python2.7/dist-packages/nav/models/manage.py", line 262, in get_short_sysname
    and self.sysname.endswith(settings.DOMAIN_SUFFIX)):

AttributeError: 'NoneType' object has no attribute 'endswith'

description: updated
Changed in nav:
status: Confirmed → In Progress
Revision history for this message
Morten Brekkevold (mbrekkevold) wrote :

A Django ORM select_related() call in the Network Explorer seems to trigger a bug in Django 1.4. The call in question will join the Netbox table three times in a single query, and in cases where there is no actual relation (i.e. for NULL values), Django instead returns empty model objects with all their attributes set to None.

The simplest solution is to remove the select_related() call, possible at the cost of some slower requests (but a slow, correct response is preferable to a fast, failing one).

fix here: https://nav.uninett.no/hg/stable/rev/9ddf8cfa46a9

Changed in nav:
milestone: none → 4.2.3
Changed in nav:
status: In Progress → Fix Committed
Changed in nav:
status: Fix Committed → Fix Released
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.