Comment 0 for bug 1083506

Revision history for this message
Lars Kulseng (lars-natyyjk) wrote :

If an invalid IPv4 address is entered into the main search field at the top of the page, a generic error page saying "Something went wrong" is displayed.

In fact, this happens if anything thats not understandable by NAV is searched for.

E.g. after a successful search for 123.123.123.123, when searching for "123.345.123.123" the following traceback is produced (sent via e-mail):

Traceback (most recent call last):

  File "/usr/lib/pymodules/python2.6/django/core/handlers/base.py", line 100, in get_response
    response = callback(request, *callback_args, **callback_kwargs)

  File "/usr/lib/pymodules/python2.6/nav/web/ipdevinfo/views.py", line 306, in ipdev_details
    processors=[search_form_processor]))

  File "/usr/lib/pymodules/python2.6/django/template/context.py", line 149, in __init__
    self.update(processor(request))

  File "/usr/lib/pymodules/python2.6/nav/django/context_processors.py", line 50, in account_processor
    account = get_account(request)

  File "/usr/lib/pymodules/python2.6/nav/django/utils.py", line 47, in get_account
    login=request._req.session['user']['login'])

  File "/usr/lib/pymodules/python2.6/django/db/models/manager.py", line 132, in get
    return self.get_query_set().get(*args, **kwargs)

  File "/usr/lib/pymodules/python2.6/django/db/models/query.py", line 336, in get
    num = len(clone)

  File "/usr/lib/pymodules/python2.6/django/db/models/query.py", line 81, in __len__
    self._result_cache = list(self.iterator())

  File "/usr/lib/pymodules/python2.6/django/db/models/query.py", line 269, in iterator
    for row in compiler.results_iter():

  File "/usr/lib/pymodules/python2.6/django/db/models/sql/compiler.py", line 672, in results_iter
    for rows in self.execute_sql(MULTI):

  File "/usr/lib/pymodules/python2.6/django/db/models/sql/compiler.py", line 727, in execute_sql
    cursor.execute(sql, params)

  File "/usr/lib/pymodules/python2.6/django/db/backends/postgresql_psycopg2/base.py", line 44, in execute
    return self.cursor.execute(query, args)

DatabaseError: current transaction is aborted, commands ignored until end of transaction block

<ModPythonRequest
path:/ipdevinfo/123.345.123.123/,
GET:<QueryDict: {}>,
POST:<QueryDict: {}>,
COOKIES:{'nav_sessid': '163431256412ad08c18e730a2d77977f'},
META:{'AUTH_TYPE': None,
 'CONTENT_LENGTH': 0,
 'CONTENT_TYPE': None,
 'GATEWAY_INTERFACE': 'CGI/1.1',
 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
 'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
 'HTTP_ACCEPT_ENCODING': 'gzip,deflate,sdch',
 'HTTP_ACCEPT_LANGUAGE': 'nb-NO,nb;q=0.8,no;q=0.6,nn;q=0.4,en-US;q=0.2,en;q=0.2',
 'HTTP_AUTHORIZATION': 'Basic bGFyczo=',
 'HTTP_CONNECTION': 'keep-alive',
 'HTTP_COOKIE': 'nav_sessid=163431256412ad08c18e730a2d77977f',
 'HTTP_HOST': 'mynav.example.com',
 'HTTP_REFERER': 'http://158.38.112.72/ipdevinfo/ip=123.123.123.123/',
 'HTTP_USER_AGENT': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11',
 'PATH_INFO': u'/ipdevinfo/123.345.123.123/',
 'PATH_TRANSLATED': None,
 'QUERY_STRING': None,
 'REMOTE_ADDR': '129.241.104.246',
 'REMOTE_HOST': None,
 'REMOTE_IDENT': None,
 'REMOTE_USER': None,
 'REQUEST_METHOD': 'GET',
 'SCRIPT_NAME': '',
 'SERVER_NAME': '127.0.0.1',
 'SERVER_PORT': 80,
 'SERVER_PROTOCOL': 'HTTP/1.1',
 'SERVER_SOFTWARE': 'mod_python'}>

Error is also produced when random characters are searched for, with similar traceback.