Closed RaveGun closed 3 years ago
generic documentation generic source (message by IssueLinks)
Since the exception comes from anyio
, I think this might be related to httpx and httpcore >= 0.13.4. I don't know much about the underlying issue - maybe @bdraco might have more insight?
See also https://github.com/home-assistant/core/pull/51799 and https://github.com/home-assistant/core/pull/53257
It would help to get the full traceback
I have switched to the ONVIF integration but with the same result.
Is this the whole traceback that is required?
Logger: aiohttp.server
Source: components/onvif/camera.py:129
First occurred: August 12, 2021, 5:27:50 PM (13 occurrences)
Last logged: 5:05:10 PM
Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
resp = await self._request_handler(request)
File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 499, in _handle
resp = await handler(request)
File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 119, in impl
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 84, in forwarded_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 24, in request_context_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 78, in ban_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 144, in auth_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 135, in handle
result = await result
File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 517, in get
return await self.handle(request, camera)
File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 534, in handle
image = await camera.async_camera_image()
File "/usr/src/homeassistant/homeassistant/components/onvif/camera.py", line 129, in async_camera_image
image = await self.device.device.get_snapshot(
File "/usr/local/lib/python3.9/site-packages/onvif/client.py", line 331, in get_snapshot
response = await self._snapshot_client.get(uri, auth=auth)
File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1722, in get
return await self.request(
File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1481, in request
response = await self.send(
File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1568, in send
response = await self._send_handling_auth(
File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1604, in _send_handling_auth
response = await self._send_handling_redirects(
File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1640, in _send_handling_redirects
response = await self._send_single_request(request, timeout)
File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1681, in _send_single_request
) = await transport.handle_async_request(
File "/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py", line 283, in handle_async_request
) = await self._pool.handle_async_request(
File "/usr/local/lib/python3.9/site-packages/httpcore/_async/connection_pool.py", line 222, in handle_async_request
async with self._connection_acquiry_lock:
File "/usr/local/lib/python3.9/site-packages/httpcore/_backends/base.py", line 76, in __aenter__
await self.acquire()
File "/usr/local/lib/python3.9/site-packages/httpcore/_backends/anyio.py", line 104, in acquire
await self._lock.acquire()
File "/usr/local/lib/python3.9/site-packages/anyio/_core/_synchronization.py", line 119, in acquire
self.acquire_nowait()
File "/usr/local/lib/python3.9/site-packages/anyio/_core/_synchronization.py", line 146, in acquire_nowait
raise RuntimeError('Attempted to acquire an already held Lock')
RuntimeError: Attempted to acquire an already held Lock
I'm seeing this too
My gut tells me it's related to httpx and https://github.com/home-assistant/core/pull/50562
My gut tells me it's related to httpx and https://github.com/home-assistant/core/pull/50562
Why does your gut tell you that? #50562 was already in 2021.6.0, so to me it seems like it is more likely related to the issues I referenced above.
i have the exact same error. Restarting core fix it and then it takes 1 to 2 days before it reappears...
If you have access to pip, try installing an updated version of anyio from this PR like this:
pip install git+https://github.com/agronholm/anyio.git@fix-write-future
Thank you.
I think that the above mentioned branch got merged into the "master".
So I just installed the default, into the CORE container, like this:
pip install git+https://github.com/agronholm/anyio.git
Will see how it behaves, I just restarted the CORE.
Hi, it worked for a day but then I upgraded to the latest core version and the docker changes got lost. One camera stopped working with the latest core version. I installed again the anyio and restarted. So far so good after 2 hours.
It is still working fine after a day. When will the updated package be a part of the core?
Thanks.
When anyio
has a new release (>3.3) on pypi, we can update HA to use the updated version. I'm not sure when the library will be updated.
The problem
A while after a restart the still images for all my 4 generic cameras stop refreshing and an missing image gets displayed.
I reported a similar issue a while back that got fixed: [https://github.com/home-assistant/core/issues/47624]
What is version of Home Assistant Core has the issue?
core-2021.8.0
What was the last working version of Home Assistant Core?
core-2021.6.0
What type of installation are you running?
Home Assistant Supervised
Integration causing the issue
integration: generic
Link to integration documentation on our website
https://www.home-assistant.io/integrations/generic
Example YAML snippet
Anything in the logs that might be useful for us?