Asyncio_loop Over 100% CPU, middlewared, GUI slow - Seems Docker / GHCR / Custom App Related

Hello. Just reporting an issue I am seeing that I talked about in another thead.

What I see
After a certain period of time asyncio_loop consumes over 100% CPU and TrueNAS is unusable.

I have traced it back to a very specific image I am using (Docker Custom App)

ghcr.io/open-webui/open-webui:main

This is the official OpenWebUI docker image on GitHub Container Registry.

I found this inside of the middlewared logs by running:

➜ ~ grep -i check_update_for_image /var/log/middlewared.log

I have attached the logs.

It seems like when making this call it does not fail gracefully and looks like it keeps retrying. I’m assuming at some point they just block my IP but hard to tell since the call is not logged in the aiohttp calls. Seems like we need pattern to fail gracefully, and backoff and retry.

error.txt (133.6 KB)

If I cycle the service, it is fine for a bit, but then it seems to come back.

➜ ~ systemctl restart middlewared

I have also added my GHCR creds/PAT in the registry credentials section but I am not sure if that applies to this call, maybe only pulls? And maybe that’s the bug?

e.g.

➜ ~ curl -I https://ghcr.io/v2/ollama-webui/ollama-webui/manifests/main

1 Like

Can you report is a s a bug and provide the NAS ticket ID.

Any idea why this specific App (GHCR) has the issue?

Has anyone else run the App?

Ah, sorry, thought you meant create it as a thread. The image I am using is linked in in this thread and it’s the official way to run open web ui. I will report a bug here soon!

OpenwebUI is a community App…

Have you tried using that?

https://apps.truenas.com/catalog/open-webui/

Thank you very much @technotim it seems that I’m facing the same error, I just started investigating. For several weeks now, I have noticed that my cpu temperature keeps rising until I restart the NAS, which is why I suspected a runaway process. Unfortunately, I haven’t had time to look into the problem in detail yet, but the middlewared.log logs similar to yours.
I also wrote two custom apps “caddy” and “mmc-utils” for checking the health of my emmc storage.

1 Like

I have not. I am using a standard image from open-webui. I think this image is just a red herring though however and it’s the underlying process that’s the issue. Possibly something to do with non Docker registries or custom apps in general.

Agreed… I was just looking to confirm…

Next step is to work out whether its ghcr or some credential issues.

1 Like

I don’t want to call victory too soon but after patching with 25.04.2.1 asyncio_loop is in check, never going above ~20% CPU (except when actively using the TrueNAS UI). Before patching last night it was still over 110% making everything sluggish to the point where I had to cycle the middlewared service every time I wanted to use it. I don’t see any related “notable” changes in the release notes, so I am hoping there was an “unnotable” change that fixed it, otherwise it’s just a odd coincidence.

I’m seeing asyncio_loop spiking over 100% in 25.04.2.1 and generally my cpu compared to 25.04 is higher (10-20%) on a lower powered older 4-core celeron cpu. Middlewared is also spiking over 100%. This newly built server (an older QNAP) is bare metal with a single VM installed in 25.04 (pbs). Not sure any of that matters.

Stopping the VM so there is nothing by TrueNAS running, this is a snapshot of what I’m seeing.

Edit: I rolled back to 25.04 and the CPU stayed high (as with 25.04.2.1), so started looking around and in var/log/middlewared.log I found this error seemingly related to ipv6 (apologize for the mess but this is how it was displayed).

[2025/08/08 15:18:39] (INFO) RouteService.sync():83 - Adding IPv4 default route to 172.20.100.1
[2025/08/08 15:18:39] (INFO) RouteService.sync():129 - Adding IPv6 default route to fe80::ae16:2dff:fea2:6e44
[2025/08/08 15:18:39] (INFO) InterfaceService.sync():1799 - Failed to sync routes @cee:{“TNLOG”: {“exception”: “Traceback (most recent call last):\n File "/usr/lib/python3/dist-packages/middlewared/plugins/network.py", line 1797, in sync\n await self.middleware.call(‘route.sync’)\n File "/usr/lib/python3/dist-packages/middlewared/main.py", line 1005, in call\n return await self._call(\n ^^^^^^^^^^^^^^^^^\n File "/usr/lib/python3/dist-packages/middlewared/main.py", line 720, in call\n return await methodobj(*prepared_call.args)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "/usr/lib/python3/dist-packages/middlewared/plugins/network/route.py", line 130, in sync\n routing_table.add(ipv6_gateway)\n File "/usr/lib/python3/dist-packages/middlewared/plugins/interface/netif_linux/routing.py", line 201, in add\n self._op("add", route)\n File "/usr/lib/python3/dist-packages/middlewared/plugins/interface/netif_linux/routing.py", line 245, in _op\n ip.route(op, **kwargs)\n File "/usr/lib/python3/dist-packages/pyroute2/iproute/linux.py", line 2334, in route\n ret = self.nlm_request(\n ^^^^^^^^^^^^^^^^^\n File "/usr/lib/python3/dist-packages/pyroute2/netlink/nlsocket.py", line 870, in nlm_request\n return tuple(self._genlm_request(*argv, **kwarg))\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "/usr/lib/python3/dist-packages/pyroute2/netlink/nlsocket.py", line 1214, in nlm_request\n for msg in self.get(\n ^^^^^^^^^\n File "/usr/lib/python3/dist-packages/pyroute2/netlink/nlsocket.py", line 873, in get\n return tuple(self._genlm_get(*argv, **kwarg))\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "/usr/lib/python3/dist-packages/pyroute2/netlink/nlsocket.py", line 550, in get\n raise msg[‘header’][‘error’]\npyroute2.netlink.exceptions.NetlinkError: (22, ‘Invalid argument’)”, “type”: “PYTHON_EXCEPTION”, “time”: “2025-08-08 19:18:40.013620”}}

Since ipv6 is really not important for this server, I added a sysctl entry “net.ipv6.conf.all.disable_ipv6=1” to disable ipv6 and the CPU dropped and middlewared (which was spiking over 100% for seconds at a time is now more often 10-30% peak). As for the asyncio process…I don’t even see it anymore. Footnote, I’m no expert so this could be a coincidence.

Just throwing in what I’ve noticed suffering the same cpu usage with asyncio_loop , if I restart the middlewared service but never go back in the truenas webui everything behaves normally, cpu doesn’t run wild. As soon as I access the webui asyncio_loop starts acting up and never stops until I restart middlewared again.

Yeah, it’s happening again. Makes the UI unusable and unnecessary energy and heat.

When things are in a bad state are you able to run the commands:
midclt call core.threads_stacks | jq and midclt call core.get_tasks | jq to get an idea of what the middlewared process is busy with? (WARNING: don’t blindly post these on the internet). You can PM them to me if you can get the info, but I can’t promise when I’ll be able to look at it.

1 Like

I would however even those calls are timing out.

➜  ~ midclt call core.threads_stacks | jq
Traceback (most recent call last):
  File "/usr/bin/midclt", line 33, in <module>
    sys.exit(load_entry_point('truenas-api-client==0.0.0', 'console_scripts', 'midclt')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/truenas_api_client/__init__.py", line 918, in main
    with Client(uri=args.uri) as c:
         ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/truenas_api_client/__init__.py", line 94, in __init__
    self.__client = client_class(uri, reserved_ports, py_exceptions, log_py_exceptions, call_timeout, verify_ssl)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/truenas_api_client/__init__.py", line 433, in __init__
    raise ClientException('Failed connection handshake')
truenas_api_client.exc.ClientException: Failed connection handshake
➜  ~ midclt call core.get_tasks | jq
Traceback (most recent call last):
  File "/usr/bin/midclt", line 33, in <module>
    sys.exit(load_entry_point('truenas-api-client==0.0.0', 'console_scripts', 'midclt')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/truenas_api_client/__init__.py", line 918, in main
    with Client(uri=args.uri) as c:
         ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/truenas_api_client/__init__.py", line 94, in __init__
    self.__client = client_class(uri, reserved_ports, py_exceptions, log_py_exceptions, call_timeout, verify_ssl)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/truenas_api_client/__init__.py", line 433, in __init__
    raise ClientException('Failed connection handshake')
truenas_api_client.exc.ClientException: Failed connection handshake
➜  ~

I tried adding -t 60 for timeout but it didn’t have any effect.

Saw an increase in CPU usage again over the course of the last 14 days. For me, the problem builds up slowly over time. Is it the same for you guys?
I’ve now created the following ticket.

I am experiencing the same problem: the CPU usage of the middlewared asyncio_loop initially idles at 0.0%, but its idle usage gradually increases. I restart the middleware service twice a week now to keep the CPU usage low.

I don’t use the app at the OP, and middlewared.log show nothing out of the ordinary.

My Ticket is closed with the comment that my problem does not appear to be an error in TrueNAS code or regression in functionality.
So no general TrueNAS bug which is a good thing. Is it realated to custom docker container perhaps?

Just a final word to my post above (unable to edit it) where I thought incorrectly that disabling ipv6 was somehow related but was not. I observed middlewared uses excessive cpu, but restarting the service “appears” to resolve it. Apologies for muddying the thread.

Is anyone else with this issue using a custom docker via compose? (Apps → Discover → Three Dots → Install via YAML)

I may have the same issue:

  • asyncio_loop goes up in %CPU over time
  • select cron-jobs (but not all) do no longer run

I don’t have a custom app created via GUI, but there is a cron-job, which creates a docker container temporarily. It is “gilleslamiral/imapsync” aiming to synchronize email.

Strangely, this “imapsync” cron job runs every couple of minutes. But cron-job for “multi-report” fails after a couple of days.

I will pause running this docker command for a couple of days, then see.

I am having this EXACT issue. Just submitted another Jira for this, so lets see what happens.
https://ixsystems.atlassian.net/browse/NAS-137783

Has anyone else been able to resolve this?