ipdevinfo crash on missing availability stats

Bug #298034 reported by Vidar Faltinsen
4
Affects Status Importance Assigned to Milestone
Network Administration Visualized
Fix Released
Medium
Stein Magnus Jodal

Bug Description

ipdevinfo crashes when I try to view an Alcatel switch. Dump is:

TemplateSyntaxError at /ipdevinfo/teknobyen-5etg-sw2.uninett.no/

Caught an exception while rendering: Reverse for 'nav.rrdviewer-rrd-by-ds-tf' with arguments '('', u'day')' and keyword arguments '{}' not found.

Original Traceback (most recent call last):
  File "/var/lib/python-support/python2.4/django/template/debug.py", line 71, in render_node
    result = node.render(context)
  File "/var/lib/python-support/python2.4/django/template/defaulttags.py", line 378, in render
    args=args, kwargs=kwargs)
  File "/var/lib/python-support/python2.4/django/core/urlresolvers.py", line 251, in reverse
    return iri_to_uri(u'%s%s' % (prefix, get_resolver(urlconf).reverse(viewname,
  File "/var/lib/python-support/python2.4/django/core/urlresolvers.py", line 240, in reverse
    raise NoReverseMatch("Reverse for '%s' with arguments '%s' and keyword "
NoReverseMatch: Reverse for 'nav.rrdviewer-rrd-by-ds-tf' with arguments '('', u'day')' and keyword arguments '{}' not found.

Request Method: GET
Request URL: https://nav.uninett.no/ipdevinfo/teknobyen-5etg-sw2.uninett.no/
Exception Type: TemplateSyntaxError
Exception Value:

Caught an exception while rendering: Reverse for 'nav.rrdviewer-rrd-by-ds-tf' with arguments '('', u'day')' and keyword arguments '{}' not found.

Original Traceback (most recent call last):
  File "/var/lib/python-support/python2.4/django/template/debug.py", line 71, in render_node
    result = node.render(context)
  File "/var/lib/python-support/python2.4/django/template/defaulttags.py", line 378, in render
    args=args, kwargs=kwargs)
  File "/var/lib/python-support/python2.4/django/core/urlresolvers.py", line 251, in reverse
    return iri_to_uri(u'%s%s' % (prefix, get_resolver(urlconf).reverse(viewname,
  File "/var/lib/python-support/python2.4/django/core/urlresolvers.py", line 240, in reverse
    raise NoReverseMatch("Reverse for '%s' with arguments '%s' and keyword "
NoReverseMatch: Reverse for 'nav.rrdviewer-rrd-by-ds-tf' with arguments '('', u'day')' and keyword arguments '{}' not found.

Exception Location: /var/lib/python-support/python2.4/django/template/debug.py in render_node, line 81
Python Executable: /usr/bin/python
Python Version: 2.4.4
Python Path: ['/', '/usr/lib/python24.zip', '/usr/lib/python2.4', '/usr/lib/python2.4/plat-linux2', '/usr/lib/python2.4/lib-tk', '/usr/lib/python2.4/lib-dynload', '/usr/local/lib/python2.4/site-packages', '/usr/lib/python2.4/site-packages', '/var/lib/python-support/python2.4', '/usr/share/nav/htdocs/.', '/usr/share/nav/htdocs/toolbox', '/usr/share/nav/htdocs/.', '/usr/share/nav/htdocs/ipdevinfo', '/usr/share/nav/htdocs/.', '/usr/share/nav/htdocs/ipdevinfo', '/usr/share/nav/htdocs/machinetracker', '/usr/share/nav/htdocs/ipdevinfo']
Server time: Fri, 14 Nov 2008 13:13:46 +0100
Template error

In template /usr/lib/nav/templates/ipdevinfo/ipdev-details.html, error at line 150
Caught an exception while rendering: Reverse for 'nav.rrdviewer-rrd-by-ds-tf' with arguments '('', u'day')' and keyword arguments '{}' not found.

Tags: ipdevinfo
Changed in nav:
assignee: nobody → jodal
importance: Undecided → Medium
milestone: none → v3.5.0
Revision history for this message
Rodrigo Habib Gregori (rodgregori) wrote :
Download full text (5.7 KiB)

I have the same problem when trying to use ipdevinfo

Here goes my full output (with debug enabled):

Environment:

Request Method: GET
Request URL: http://nav.pmj.gov/ipdevinfo/pmj-swi541.pmj.gov/
Django Version: 1.0-final-SVN-unknown
Python Version: 2.5.2
Installed Applications:
[]
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.middleware.common.CommonMiddleware')

Template error:
In template /usr/local/nav/lib/templates/ipdevinfo/ipdev-details.html, error at line 150
   Caught an exception while rendering: Reverse for 'nav.rrdviewer-rrd-by-ds-tf' with arguments '('', u'day')' and keyword arguments '{}' not found.
   140 : for {{ netbox.up_since|timesince }}

   141 : {% endifequal %}

   142 : </td>

   143 : </tr>

   144 :

   145 : {% with netbox.get_availability as stats %}

   146 : <tr>

   147 : <th>Availability</th>

   148 : <td>

   149 : {% with stats.availability as a %}

   150 : <a href=" {% url rrdviewer-rrd-by-ds-tf a.data_source.id,"day" %} ">

   151 : {% if a.day %}

   152 : {{ a.day|floatformat:2 }}%

   153 : {% else %}

   154 : (N/A)

   155 : {% endif %}

   156 : last day</a>,

   157 : <a href="{% url rrdviewer-rrd-by-ds-tf a.data_source.id,"week" %}">

   158 : {% if a.week %}

   159 : {{ a.week|floatformat:2 }}%

   160 : {% else %}

Traceback:
File "/var/lib/python-support/python2.5/django/core/handlers/base.py" in get_response
  86. response = callback(request, *callback_args, **callback_kwargs)
File "/usr/local/nav/lib/python/nav/web/ipdevinfo/views.py" in ipdev_details
  298. processors=[search_form_processor]))
File "/usr/local/nav/lib/python/nav/django/shortcuts.py" in render_to_response
  67. rendered = render_to_string(template_name, context, context_instance)
File "/var/lib/python-support/python2.5/django/template/loader.py" in render_to_string
  107. return t.render(context_instance)
File "/var/lib/python-support/python2.5/django/template/__init__.py" in render
  176. return self.nodelist.render(context)
File "/var/lib/python-support/python2.5/django/template/__init__.py" in render
  768. bits.append(self.render_node(node, context))
File "/var/lib/python-support/python2.5/django/template/debug.py" in render_node
  71. result = node.render(context)
File "/var/lib/python-support/python2.5/django/template/loader_tags.py" in render
  97. return compiled_parent.render(context)
File "/var/lib/python-support/python2.5/django/template/__init__.py" in render
  176. return self.nodelist.render(context)
File "/var/lib/python-support/python2.5/django/template/__init__.py" in render
  768. bits.append(self.render_node(node, context))
File "/var/lib/python-support/python2.5/django/template/debug.py" ...

Read more...

Revision history for this message
Stein Magnus Jodal (jodal) wrote :

Seems like you got rows in rrd_datasource where rrd_datasourceid is null. Could you try running the following query to confirm this?

select count(*) from rrd_datasource where rrd_datasourceid is null;

Revision history for this message
Stein Magnus Jodal (jodal) wrote :

You may also try applying the attached patch.

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

rrd_datasourceid is a primary key defined as NOT NULL; it is impossible for this to contain nulls (as can be confirmed on the original bug reporter's installation).

Revision history for this message
Rodrigo Habib Gregori (rodgregori) wrote :

Hi,

   The result count for the sql query was 0.
I'm going to try the patch.

Thanks,
Rodrigo

Revision history for this message
Rodrigo Habib Gregori (rodgregori) wrote :

Applied the patch (actually changed the lines manually 'cause my nav path is different from the one in the diff file)
but it kept throwing the same error as before.

as for me, I don't even have Alcatel devices and the ipdevinfo has worked some time ago, (before having snmp enabled)

Revision history for this message
Stein Magnus Jodal (jodal) wrote :

By a strike of luck I got the same error myself on the development installation (on a non-Alcatel device).

A fix has been committed and is available at: http://metanav.uninett.no/hg/default/rev/4b90dfb0ebe4

Changed in nav:
status: In Progress → Fix Committed
Revision history for this message
Rodrigo Habib Gregori (rodgregori) wrote :

It worked here!

Thanks, and I'm gonna check other modules, as I've seen similar problem somewhere else!

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.