Skip to content

[BUG] ipdevpoll jobs crash with "A string literal cannot contain NUL (0x00) characters" messages for some devices #2176

@csv7

Description

@csv7

Describe the bug
It looks a lot like bug 2047: #2047

Except this is happening to us when the topo job is running and determining lldp neighbors.

To Reproduce
meh

Expected behavior
No exception

Screenshots

2020-08-06 17:32:03,384 [ERROR jobs.jobhandler] [topo switch.name] Plugin nav.ipdevpoll.plugins.lldp.LLDP('switch.name') reported an unhandled failure
Traceback (most recent call last):
  File "/opt/venvs/nav/lib/python3.7/site-packages/twisted/internet/defer.py", line 500, in errback
    self._startRunCallbacks(fail)
  File "/opt/venvs/nav/lib/python3.7/site-packages/twisted/internet/defer.py", line 567, in _startRunCallbacks
    self._runCallbacks()
  File "/opt/venvs/nav/lib/python3.7/site-packages/twisted/internet/defer.py", line 653, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/opt/venvs/nav/lib/python3.7/site-packages/twisted/internet/defer.py", line 1442, in gotResult
    _inlineCallbacks(r, g, deferred)
--- <exception caught here> ---
  File "/opt/venvs/nav/lib/python3.7/site-packages/twisted/internet/defer.py", line 1384, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/opt/venvs/nav/lib/python3.7/site-packages/twisted/python/failure.py", line 408, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/opt/venvs/nav/lib/python3.7/site-packages/nav/ipdevpoll/plugins/lldp.py", line 71, in handle
    yield run_in_thread(self._process_remote)
  File "/opt/venvs/nav/lib/python3.7/site-packages/twisted/python/threadpool.py", line 250, in inContext
    result = inContext.theWork()
  File "/opt/venvs/nav/lib/python3.7/site-packages/twisted/python/threadpool.py", line 266, in <lambda>
    inContext.theWork = lambda: context.call(ctx, func, *args, **kw)
  File "/opt/venvs/nav/lib/python3.7/site-packages/twisted/python/context.py", line 122, in callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
  File "/opt/venvs/nav/lib/python3.7/site-packages/twisted/python/context.py", line 85, in callWithContext
    return func(*args,**kw)
  File "/opt/venvs/nav/lib/python3.7/site-packages/nav/ipdevpoll/db.py", line 100, in _reset
    return func(*args, **kwargs)
  File "/opt/venvs/nav/lib/python3.7/site-packages/nav/ipdevpoll/plugins/lldp.py", line 116, in _process_remote
    neighbors = [LLDPNeighbor(lldp) for lldp in self.remote]
  File "/opt/venvs/nav/lib/python3.7/site-packages/nav/ipdevpoll/plugins/lldp.py", line 116, in <listcomp>
    neighbors = [LLDPNeighbor(lldp) for lldp in self.remote]
  File "/opt/venvs/nav/lib/python3.7/site-packages/nav/ipdevpoll/neighbor.py", line 117, in __init__
    self.identify()
  File "/opt/venvs/nav/lib/python3.7/site-packages/nav/ipdevpoll/neighbor.py", line 120, in identify
    self.netbox = self._identify_netbox()
  File "/opt/venvs/nav/lib/python3.7/site-packages/nav/ipdevpoll/plugins/lldp.py", line 188, in _identify_netbox
    netbox = lookup(str(chassid))
  File "/opt/venvs/nav/lib/python3.7/site-packages/nav/ipdevpoll/plugins/lldp.py", line 199, in _netbox_from_local
    info_set__value=str(chassid),
  File "/opt/venvs/nav/lib/python3.7/site-packages/nav/ipdevpoll/neighbor.py", line 192, in _netbox_query
    netbox = manage.Netbox.objects.values('id', 'sysname').get(query)
  File "/opt/venvs/nav/lib/python3.7/site-packages/django/db/models/query.py", line 374, in get
    num = len(clone)
  File "/opt/venvs/nav/lib/python3.7/site-packages/django/db/models/query.py", line 232, in __len__
    self._fetch_all()
  File "/opt/venvs/nav/lib/python3.7/site-packages/django/db/models/query.py", line 1121, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "/opt/venvs/nav/lib/python3.7/site-packages/django/db/models/query.py", line 106, in __iter__
    for row in compiler.results_iter(chunked_fetch=self.chunked_fetch):
  File "/opt/venvs/nav/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 841, in results_iter
    results = self.execute_sql(MULTI, chunked_fetch=chunked_fetch)
  File "/opt/venvs/nav/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 899, in execute_sql
    raise original_exception
  File "/opt/venvs/nav/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 889, in execute_sql
    cursor.execute(sql, params)
  File "/opt/venvs/nav/lib/python3.7/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
builtins.ValueError: A string literal cannot contain NUL (0x00) characters.

2020-08-06 17:32:03,384 [ERROR jobs.jobhandler] [topo switch.name] Job 'topo' for switch.name aborted: Job aborted due to plugin failure (cause=ValueError('A string literal cannot contain NUL (0x00) characters.'))

Environment (please complete the following information):

  • Debian 10.5
  • 5.05
  • apt

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions