question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

trace backs on what look like basic connection error

See original GitHub issue

Version of the custom_component

0.9.36

Logs

2022-02-12 23:35:50 WARNING (MainThread) [custom_components.dahua] Failed to sync device state
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 986, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)  # type: ignore[return-value]  # noqa
  File "/usr/local/lib/python3.9/asyncio/base_events.py", line 1056, in create_connection
    raise exceptions[0]
  File "/usr/local/lib/python3.9/asyncio/base_events.py", line 1041, in create_connection
    sock = await self._connect_sock(
  File "/usr/local/lib/python3.9/asyncio/base_events.py", line 955, in _connect_sock
    await self.sock_connect(sock, address)
  File "/usr/local/lib/python3.9/asyncio/selector_events.py", line 502, in sock_connect
    return await fut
  File "/usr/local/lib/python3.9/asyncio/selector_events.py", line 537, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
OSError: [Errno 113] Connect call failed ('192.168.103.8', 80)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/config/custom_components/dahua/__init__.py", line 279, in _async_update_data
    results = await asyncio.gather(*coros)
  File "/config/custom_components/dahua/client.py", line 187, in async_get_config_lighting
    return await self.async_get_config("Lighting[{0}][{1}]".format(channel, profile_mode))
  File "/config/custom_components/dahua/client.py", line 172, in async_get_config
    return await self.get(url)
  File "/config/custom_components/dahua/client.py", line 675, in get
    raise exception
  File "/config/custom_components/dahua/client.py", line 660, in get
    response = await auth.request("GET", url)
  File "/config/custom_components/dahua/digest.py", line 46, in request
    response = await self.session.request(method, url, headers=headers, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/client.py", line 535, in _request
    conn = await self._connector.connect(
  File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 542, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 907, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 1206, in _create_direct_connection
    raise last_exc
  File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 1175, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
  File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 992, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.103.8:80 ssl:default [Connect call failed ('192.168.103.8', 80)]

Describe the bug

AD110 is slow and sometimes drops off WiFi if it roams APs etc… This looks like a simple connection failure causes a unstrapped error.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
rrollercommented, Feb 13, 2022

Got it. I will only log a single line going forward but log the full stack trace as a debug log. Those who want the full stack trace can enable debug logs if they need it.

0reactions
bagobonescommented, Feb 14, 2022

Got the following after rebooting and letting it run for a few hours…

2022-02-14 03:03:33 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration dahua which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-02-14 03:03:33 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-02-14 03:07:46 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
    resp = await request_handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 117, 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 98, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 79, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 219, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 137, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 753, in get
    return await self.handle(request, camera)
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 771, in handle
    image = await _async_get_image(
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 169, in _async_get_image
    image_bytes = await camera.async_camera_image(
  File "/config/custom_components/dahua/camera.py", line 233, in async_camera_image
    return await self._coordinator.client.async_get_snapshot(self._channel_number)
  File "/config/custom_components/dahua/client.py", line 66, in async_get_snapshot
    return await self.get_bytes(url)
  File "/config/custom_components/dahua/client.py", line 654, in get_bytes
    response.raise_for_status()
  File "/usr/local/lib/python3.9/site-packages/aiohttp/client_reqrep.py", line 1004, in raise_for_status
    raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 400, message='Bad Request', url=URL('http://192.168.103.8:80/cgi-bin/snapshot.cgi?channel=1')
2022-02-14 03:23:27 ERROR (MainThread) [homeassistant.components.homekit.type_cameras] Camera has no stream source
2022-02-14 03:23:27 ERROR (MainThread) [pyhap.camera] [ca6e9f52-3dc2-4f1e-a030-dfb546e26841] Failed to start/reconfigure stream, deleting session.
2022-02-14 03:23:57 ERROR (MainThread) [pyhap.camera] Requested to stop stream for session ca6e9f52-3dc2-4f1e-a030-dfb546e26841, but no such session was found
2022-02-14 03:42:54 ERROR (MainThread) [homeassistant.components.homekit.type_cameras] Camera has no stream source
2022-02-14 03:42:54 ERROR (MainThread) [pyhap.camera] [c801a1f8-a43e-4d0a-a2c1-dde0cb3dbcc3] Failed to start/reconfigure stream, deleting session.
2022-02-14 03:43:06 ERROR (MainThread) [pyhap.camera] Requested to stop stream for session c801a1f8-a43e-4d0a-a2c1-dde0cb3dbcc3, but no such session was found
2022-02-14 03:54:57 WARNING (MainThread) [homeassistant.components.automation.doods_doorbell] Doods: Doorbell  Person Scan Events: Already running
2022-02-14 04:21:21 ERROR (MainThread) [homeassistant.components.homekit.type_cameras] Camera has no stream source
2022-02-14 04:21:21 ERROR (MainThread) [pyhap.camera] [8b840c05-a65a-4505-ada0-5e262efe31fc] Failed to start/reconfigure stream, deleting session.
2022-02-14 04:21:21 ERROR (MainThread) [homeassistant.components.homekit.type_cameras] Camera has no stream source
2022-02-14 04:21:21 ERROR (MainThread) [pyhap.camera] [a74392f4-da3c-4232-8979-e22d5198782d] Failed to start/reconfigure stream, deleting session.
2022-02-14 04:21:41 WARNING (MainThread) [homeassistant.components.automation.doods_doorbell] Doods: Doorbell  Person Scan Events: Already running
2022-02-14 04:21:51 ERROR (MainThread) [pyhap.camera] Requested to stop stream for session 8b840c05-a65a-4505-ada0-5e262efe31fc, but no such session was found
2022-02-14 04:21:51 ERROR (MainThread) [pyhap.camera] Requested to stop stream for session a74392f4-da3c-4232-8979-e22d5198782d, but no such session was found
2022-02-14 04:24:02 ERROR (MainThread) [homeassistant.components.homekit.type_cameras] Camera has no stream source
2022-02-14 04:24:02 ERROR (MainThread) [pyhap.camera] [00c2f65e-d115-46f8-944d-88f6be922b14] Failed to start/reconfigure stream, deleting session.
2022-02-14 04:24:02 ERROR (MainThread) [homeassistant.components.homekit.type_cameras] Camera has no stream source
2022-02-14 04:24:02 ERROR (MainThread) [pyhap.camera] [92d9ee51-6e61-4d11-8fb9-94317e46e04a] Failed to start/reconfigure stream, deleting session.
2022-02-14 04:24:33 ERROR (MainThread) [pyhap.camera] Requested to stop stream for session 00c2f65e-d115-46f8-944d-88f6be922b14, but no such session was found
2022-02-14 04:24:33 ERROR (MainThread) [pyhap.camera] Requested to stop stream for session 92d9ee51-6e61-4d11-8fb9-94317e46e04a, but no such session was found
2022-02-14 04:30:12 ERROR (MainThread) [homeassistant.components.homekit.type_cameras] Camera has no stream source
2022-02-14 04:30:12 ERROR (MainThread) [pyhap.camera] [213ca0b9-53aa-46b9-94b1-620846748822] Failed to start/reconfigure stream, deleting session.
2022-02-14 04:30:12 ERROR (MainThread) [homeassistant.components.homekit.type_cameras] Camera has no stream source
2022-02-14 04:30:12 ERROR (MainThread) [pyhap.camera] [f51807df-39a8-4c2c-ac6e-7aecd5ee59a1] Failed to start/reconfigure stream, deleting session.
2022-02-14 04:30:29 ERROR (MainThread) [pyhap.camera] Requested to stop stream for session 213ca0b9-53aa-46b9-94b1-620846748822, but no such session was found
2022-02-14 04:30:42 ERROR (MainThread) [pyhap.camera] Requested to stop stream for session f51807df-39a8-4c2c-ac6e-7aecd5ee59a1, but no such session was found
Read more comments on GitHub >

github_iconTop Results From Across the Web

Understanding the Python Traceback
A traceback is a report containing the function calls made in your code at a specific point. Tracebacks are known by many names,...
Read more >
How to Run a Traceroute to Troubleshoot Connection and ...
Run in concert with local traceroutes, using a service or tool like this one can help diagnose precisely where the connection issues are...
Read more >
How to Use TRACERT to Troubleshoot TCP/IP Problems in ...
This article describes TRACERT (Trace Route), a command-line utility that you can use to trace the path that an Internet Protocol (IP) packet...
Read more >
13 Tips to Troubleshoot Your Internet Connection | PCMag
Start with the obvious: is the problem only happening on one device or all your devices? If your computer's having problems, see if...
Read more >
Home Network Problems? 8 Diagnostic Tricks and Fixes to Try
Learn how to troubleshoot network connectivity problems and get back online! ... network issues right away, as the fix to your problem might...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found