AttributeError: module 'asyncio' has no attribute 'create_task'

Bug #1928737 reported by Chris Johnston
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Kubernetes Control Plane Charm
Fix Released
Critical
Cory Johns

Bug Description

When running with the fix for LP:#1927145 on bionic I am seeing:

[2021-05-18 01:09:55 +0000] [8610] [ERROR] Exception in gunicorn worker
Traceback (most recent call last):
  File "/var/lib/juju/agents/unit-kubernetes-master-1/.venv/lib/python3.6/site-packages/aiohttp/worker.py", line 57, in run
    self.loop.run_until_complete(self._task)
  File "/usr/lib/python3.6/asyncio/base_events.py", line 484, in run_until_complete
    return future.result()
  File "/var/lib/juju/agents/unit-kubernetes-master-1/.venv/lib/python3.6/site-packages/aiohttp/worker.py", line 84, in _run
    await runner.setup()
  File "/var/lib/juju/agents/unit-kubernetes-master-1/.venv/lib/python3.6/site-packages/aiohttp/web_runner.py", line 275, in setup
    self._server = await self._make_server()
  File "/var/lib/juju/agents/unit-kubernetes-master-1/.venv/lib/python3.6/site-packages/aiohttp/web_runner.py", line 375, in _make_server
    await self._app.startup()
  File "/var/lib/juju/agents/unit-kubernetes-master-1/.venv/lib/python3.6/site-packages/aiohttp/web_app.py", line 416, in startup
    await self.on_startup.send(self)
  File "/var/lib/juju/agents/unit-kubernetes-master-1/.venv/lib/python3.6/site-packages/aiohttp/signals.py", line 34, in send
    await receiver(*args, **kwargs) # type: ignore
  File "/root/cdk/auth-webhook/auth-webhook.py", line 401, in startup
    app['secrets_task'] = asyncio.create_task(_task())
AttributeError: module 'asyncio' has no attribute 'create_task'

If I change create_task to ensure_future things seem to work:
https://python.tutorialink.com/attributeerror-module-asyncio-has-no-attribute-create_task/

Tags: seg sts
Revision history for this message
George Kraft (cynerva) wrote :

We marked LP:1927145 as critical, so I'm marking this one as critical too.

Changed in charm-kubernetes-master:
importance: Undecided → Critical
milestone: none → 1.21+ck2
status: New → Triaged
Revision history for this message
Cory Johns (johnsca) wrote :
Changed in charm-kubernetes-master:
assignee: nobody → Cory Johns (johnsca)
status: Triaged → In Progress
tags: added: backport-needed review-needed
Revision history for this message
Cory Johns (johnsca) wrote :
Changed in charm-kubernetes-master:
status: In Progress → Fix Committed
tags: removed: backport-needed review-needed
tags: added: seg sts
Revision history for this message
Cory Johns (johnsca) wrote :

This was released on May 28th with bundle rev 679 / kubernetes-master rev 1008.

Changed in charm-kubernetes-master:
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.