Skip to content

AttributeError: 'NoneType' object has no attribute 'exception' #1028

@freyes

Description

@freyes

Description

libjuju crashes when the shared state watcher was stopped, libjuju tries to handle and fails with the following error: AttributeError: 'NoneType' object has no attribute 'exception'

We are seeing this issue in our CI - https://github.com/openstack-charmers/zaza/actions/runs/7907308186/job/21769045812?pr=608

The full stacktrace is:

  Error: -20 13:19:12 [ERROR] Exception in callback create_task_with_handler.<locals>._task_result_exp_handler(task_name='tmp', logger=None)(<Task finishe...was stopped')>) at /home/runner/work/zaza/zaza/.tox/func-target/lib/python3.10/site-packages/juju/jasyncio.py:53
  handle: <Handle create_task_with_handler.<locals>._task_result_exp_handler(task_name='tmp', logger=None)(<Task finishe...was stopped')>) at /home/runner/work/zaza/zaza/.tox/func-target/lib/python3.10/site-packages/juju/jasyncio.py:53>
  Traceback (most recent call last):
    File "/home/runner/work/zaza/zaza/.tox/func-target/lib/python3.10/site-packages/juju/jasyncio.py", line 55, in _task_result_exp_handler
      task.result()
    File "/home/runner/work/zaza/zaza/.tox/func-target/lib/python3.10/site-packages/juju/client/facade.py", line 486, in wrapper
      reply = await f(*args, **kwargs)
    File "/home/runner/work/zaza/zaza/.tox/func-target/lib/python3.10/site-packages/juju/client/_client1.py", line 315, in Next
      reply = await self.rpc(msg)
    File "/home/runner/work/zaza/zaza/.tox/func-target/lib/python3.10/site-packages/juju/client/overrides.py", line 113, in rpc
      result = await self.connection.rpc(msg, encoder=TypeEncoder)
    File "/home/runner/work/zaza/zaza/.tox/func-target/lib/python3.10/site-packages/juju/client/connection.py", line 635, in rpc
      raise errors.JujuAPIError(result)
  juju.errors.JujuAPIError: shared state watcher was stopped
  During handling of the above exception, another exception occurred:
  Traceback (most recent call last):
    File "/usr/lib/python3.10/asyncio/events.py", line 80, in _run
      self._context.run(self._callback, *self._args)
    File "/home/runner/work/zaza/zaza/.tox/func-target/lib/python3.10/site-packages/juju/jasyncio.py", line 67, in _task_result_exp_handler
      logger.exception("Task %s raised an exception: %s" % (task_name, e))
  AttributeError: 'NoneType' object has no attribute 'exception'

Urgency

Casually reporting

Python-libjuju version

2.9.46.1

Juju version

2.9.46

Reproduce / Test

git clone -b issues/545 https://github.com/freyes/zaza.git
cd zaza
# make sure you have a running juju 2.9 controller
tox -e func-target -- third

Metadata

Metadata

Assignees

Labels

hint/2.9going on 2.9 branchhint/3.xgoing on main branchhint/good-first-issuea small bug good for newcomerskind/bugindicates a bug in the project

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions