home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.43k stars 30.67k forks source link

Synology Surveillance Station: Uncaught thread exception, Invalid argument: '<none>'; last error log: [mp4] dimensions not set #123114

Open charlespick opened 3 months ago

charlespick commented 3 months ago

The problem

Camera streams from Synology Surveillance Station integration will not start, or take over 60 seconds to start. In the Home Assistant Log, the error "Invalid argument: ''; last error log: [mp4] dimensions not set" posts every time you try to view a camera in the frontend.

What version of Home Assistant Core has the issue?

2024.7.2

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Core

Integration causing the issue

Synology DSM

Link to integration documentation on our website

https://www.home-assistant.io/integrations/synology_dsm/

Diagnostics information

{
  "home_assistant": {
    "installation_type": "Home Assistant Core",
    "version": "2024.7.2",
    "dev": false,
    "hassio": false,
    "virtualenv": true,
    "python_version": "3.12.3",
    "docker": false,
    "arch": "x86_64",
    "timezone": "America/Phoenix",
    "os_name": "Linux",
    "os_version": "5.15.0-116-generic",
    "run_as_root": false
  },
  "custom_components": {},
  "integration_manifest": {
    "domain": "synology_dsm",
    "name": "Synology DSM",
    "codeowners": [
      "hacf-fr",
      "Quentame",
      "mib1185"
    ],
    "config_flow": true,
    "dependencies": [
      "http"
    ],
    "documentation": "https://www.home-assistant.io/integrations/synology_dsm",
    "iot_class": "local_polling",
    "loggers": [
      "synology_dsm"
    ],
    "requirements": [
      "py-synologydsm-api==2.4.4"
    ],
    "ssdp": [
      {
        "manufacturer": "Synology",
        "deviceType": "urn:schemas-upnp-org:device:Basic:1"
      }
    ],
    "zeroconf": [
      {
        "type": "_http._tcp.local.",
        "properties": {
          "vendor": "synology*"
        }
      }
    ],
    "is_built_in": true
  },
  "setup_times": {
    "null": {
      "setup": 2.5071902200579643e-05
    },
    "01J3VGTT7989CAH5XPRVG9NJ9Z": {
      "wait_import_platforms": -0.015691008884459734,
      "wait_base_component": -0.008522325893864036,
      "config_entry_setup": 9.767367422115058
    }
  },
  "data": {
    "entry": {
      "data": {
        "host": "nvr01.makerland.xyz",
        "port": "443",
        "ssl": true,
        "verify_ssl": true,
        "username": "**REDACTED**",
        "password": "**REDACTED**",
        "mac": [
          "**REDACTED**"
        ],
        "device_token": "**REDACTED**"
      },
      "disabled_by": null,
      "domain": "synology_dsm",
      "entry_id": "01J3VGTT7989CAH5XPRVG9NJ9Z",
      "minor_version": 1,
      "options": {},
      "pref_disable_new_entities": false,
      "pref_disable_polling": false,
      "source": "user",
      "title": "nvr01.makerland.xyz",
      "unique_id": "2370UKR79R1H7",
      "version": 1
    },
    "device_info": {
      "model": "DS223j",
      "version": "DSM 7.2.1-69057 Update 5",
      "ram": 1024,
      "uptime": 358222,
      "temperature": 39
    },
    "network": {
      "interfaces": {
        "eth0": {
          "type": "lan",
          "ip": [
            {
              "address": "10.3.3.**REDACTED**",
              "netmask": "255.255.255.0"
            }
          ]
        }
      }
    },
    "storage": {
      "disks": {
        "sata1": {
          "name": "Drive 1",
          "vendor": "Synology",
          "model": "HAT3300-4T",
          "device": "/dev/sata1",
          "temp": 35,
          "size_total": "4000787030016"
        },
        "sata2": {
          "name": "Drive 2",
          "vendor": "Synology",
          "model": "HAT3300-4T",
          "device": "/dev/sata2",
          "temp": 37,
          "size_total": "4000787030016"
        }
      },
      "volumes": {
        "volume_1": {
          "name": "btrfs",
          "size": {
            "free_inode": "0",
            "total": "3829365997568",
            "total_device": "3988950876160",
            "total_inode": "0",
            "used": "476169977856"
          }
        }
      }
    },
    "surveillance_station": {
      "cameras": {
        "1": {
          "name": "Portercam",
          "is_enabled": true,
          "is_motion_detection_enabled": true,
          "model": "IP2M-841B",
          "resolution": "1920x1080"
        },
        "2": {
          "name": "Doorbell",
          "is_enabled": true,
          "is_motion_detection_enabled": true,
          "model": "Video Doorbell WiFi",
          "resolution": "2560x1920"
        }
      },
      "camera_diagnostics": {
        "camera.portercam": {
          "start_worker": 2,
          "keepalive": false,
          "orientation": 1,
          "container_format": "rtsp",
          "video_codec": "h264"
        },
        "camera.doorbell": {}
      }
    },
    "upgrade": {
      "update_available": false,
      "available_version": null,
      "reboot_needed": null,
      "service_restarts": null
    },
    "utilisation": {
      "cpu": {
        "15min_load": 26,
        "1min_load": 90,
        "5min_load": 43,
        "device": "System",
        "other_load": 11,
        "system_load": 4,
        "user_load": 5
      },
      "memory": {
        "avail_real": 140360,
        "avail_swap": 1745336,
        "buffer": 10952,
        "cached": 591288,
        "device": "Memory",
        "memory_size": 1048576,
        "real_usage": 25,
        "si_disk": 4,
        "so_disk": 4,
        "swap_usage": 16,
        "total_real": 991744,
        "total_swap": 2097084
      },
      "network": [
        {
          "device": "total",
          "rx": 725928,
          "tx": 22967
        },
        {
          "device": "eth0",
          "rx": 725928,
          "tx": 22967
        }
      ]
    },
    "is_system_loaded": true,
    "api_details": {
      "fetching_entities": {
        "SYNO.Core.SecurityScan.Status": [
          "2370UKR79R1H7_SYNO.Core.SecurityScan.Status:status"
        ],
        "SYNO.Storage.CGI.Storage": [
          "2370UKR79R1H7_SYNO.Storage.CGI.Storage:disk_exceed_bad_sector_thr_sata1",
          "2370UKR79R1H7_SYNO.Storage.CGI.Storage:disk_temp_sata2",
          "2370UKR79R1H7_SYNO.Storage.CGI.Storage:disk_exceed_bad_sector_thr_sata2",
          "2370UKR79R1H7_SYNO.Storage.CGI.Storage:volume_disk_temp_avg_volume_1",
          "2370UKR79R1H7_SYNO.Storage.CGI.Storage:disk_temp_sata1",
          "2370UKR79R1H7_SYNO.Storage.CGI.Storage:disk_status_sata1",
          "2370UKR79R1H7_SYNO.Storage.CGI.Storage:disk_below_remain_life_thr_sata1",
          "2370UKR79R1H7_SYNO.Storage.CGI.Storage:disk_status_sata2",
          "2370UKR79R1H7_SYNO.Storage.CGI.Storage:volume_size_used_volume_1",
          "2370UKR79R1H7_SYNO.Storage.CGI.Storage:volume_percentage_used_volume_1",
          "2370UKR79R1H7_SYNO.Storage.CGI.Storage:volume_status_volume_1",
          "2370UKR79R1H7_SYNO.Storage.CGI.Storage:disk_below_remain_life_thr_sata2"
        ],
        "SYNO.Core.System.Utilization": [
          "2370UKR79R1H7_SYNO.Core.System.Utilization:cpu_15min_load",
          "2370UKR79R1H7_SYNO.Core.System.Utilization:cpu_5min_load",
          "2370UKR79R1H7_SYNO.Core.System.Utilization:network_up",
          "2370UKR79R1H7_SYNO.Core.System.Utilization:memory_real_usage",
          "2370UKR79R1H7_SYNO.Core.System.Utilization:cpu_user_load",
          "2370UKR79R1H7_SYNO.Core.System.Utilization:memory_available_swap",
          "2370UKR79R1H7_SYNO.Core.System.Utilization:memory_total_real",
          "2370UKR79R1H7_SYNO.Core.System.Utilization:memory_available_real",
          "2370UKR79R1H7_SYNO.Core.System.Utilization:network_down",
          "2370UKR79R1H7_SYNO.Core.System.Utilization:memory_total_swap",
          "2370UKR79R1H7_SYNO.Core.System.Utilization:cpu_total_load"
        ],
        "SYNO.DSM.Info": [
          "2370UKR79R1H7_SYNO.DSM.Info:temperature"
        ],
        "SYNO.SurveillanceStation.HomeMode": [
          "2370UKR79R1H7_SYNO.SurveillanceStation.HomeMode:home_mode"
        ],
        "SYNO.Core.Upgrade": [
          "2370UKR79R1H7_SYNO.Core.Upgrade:update"
        ],
        "SYNO.SurveillanceStation.Camera": [
          "2370UKR79R1H7_SYNO.SurveillanceStation.Camera:1",
          "2370UKR79R1H7_SYNO.SurveillanceStation.Camera:2"
        ]
      }
    }
  }
}

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: root
Source: components/stream/worker.py:272
First occurred: 8:46:34 AM (1 occurrences)
Last logged: 8:46:34 AM

Uncaught thread exception
Traceback (most recent call last):
  File "/usr/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.12/threading.py", line 1010, in run
    self._target(*self._args, **self._kwargs)
  File "/srv/homeassistant_2024_7_2/lib/python3.12/site-packages/homeassistant/components/stream/__init__.py", line 438, in _run_worker
    stream_worker(
  File "/srv/homeassistant_2024_7_2/lib/python3.12/site-packages/homeassistant/components/stream/worker.py", line 617, in stream_worker
    muxer.mux_packet(first_keyframe)
  File "/srv/homeassistant_2024_7_2/lib/python3.12/site-packages/homeassistant/components/stream/worker.py", line 272, in mux_packet
    self._av_output.mux(packet)
  File "av/container/output.pyx", line 218, in av.container.output.OutputContainer.mux
  File "av/container/output.pyx", line 224, in av.container.output.OutputContainer.mux_one
  File "av/container/output.pyx", line 190, in av.container.output.OutputContainer.start_encoding
  File "av/container/core.pyx", line 290, in av.container.core.Container.err_check
  File "av/error.pyx", line 336, in av.error.err_check
av.error.ValueError: [Errno 22] Invalid argument: '<none>'; last error log: [mp4] dimensions not set

Additional information

Tested viewing stream on iOS HA App, Firefox on Windows Tested 1 Amcrest and 1 Reolink camera, both record reliably and smoothly to DSM/SS (Doorbell was intentionally offline while the above diagnostics were captured) NAS was just setup with the latest DSM a couple weeks ago I did find a possibly related issue that wasn't solved #46184

home-assistant[bot] commented 3 months ago

Hey there @hacf-fr, @quentame, @mib1185, mind taking a look at this issue as it has been labeled with an integration (synology_dsm) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `synology_dsm` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign synology_dsm` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


synology_dsm documentation synology_dsm source (message by IssueLinks)

mib1185 commented 2 months ago

the stream of your doorbell camera seems to be not compatible with the stream integration - please provide more details about this camera and how exactly did you integrate it into the surveillance station, thx :+1:

charlespick commented 2 months ago

@mib1185 the doorbell is not online yet. Could that be causing the problem you are seeing? I can bring it back online and collect logs again if needed.

mib1185 commented 2 months ago

I'm a bit confused - as per your provided diagnostics data you've two cameras connected to the Surveillance Station Portercam and Doorbell, while Doorbell is disconnected. How exactly do you start these streams? And which one?

Further please enable debug logging, restart the integration and download and provide the log file after the issue occur again.

Note: it is better to drag the log into the comment (which will add it as an attachment) and not copy paste as it is hard to read logs in GitHub.

thx 👍

charlespick commented 2 months ago

@mib1185 just ignore the doorbell for now. I had it wired up to a power brick for a moment to configure the wifi but it is having other issues so I haven't mounted it on my house yet.

Would it be possible to share the log privately somewhere? When enabling debug logging the log grows to over 1000 lines in minutes. I can't go through it all to make sure it is free of secrets and there is encoded information that I can't even tell how it's encoded to know if it is a secret.

mib1185 commented 2 months ago

Hi @charlespick feel free to contact me on discord (mib1185) 👍

charlespick commented 2 months ago

@mib1185 sent you a message

mib1185 commented 1 month ago

It seems to be an incompatibility between the video stream of the camera (Portercam) and the stream integration which is responsible to show the stream in HA. Maybe you can adjust some settings in the SurveillanceStation for this camera, but the synology_dsm integration itself does only pass-through the rtsp url (provided by the SurveillanceStation) to the stream integration - maybe this note in the stream docs can help?

charlespick commented 1 month ago

The only codec selected anywhere in Surveillance Station is H.264. H.265 is nowhere to be seen. I changed Stream 1 in Surveillance Station to constant bitrate and it appears to have helped in getting the stream started more often but it is still failing maybe 10% of the time I try starting the stream as opposed to 90% before. Similar errors [mp4] dimensions not set and Uncaught thread exception showing in my logs when that happens.

Screenshot 2024-09-15 at 10 52 39 AM Screenshot 2024-09-15 at 10 52 53 AM
mib1185 commented 1 month ago

please also provide the further logs about the stream component, which you showed me on discord, thx 👍

charlespick commented 1 month ago

Explore-logs-2024-09-15 12_21_04.txt

home-assistant[bot] commented 1 month ago

Hey there @hunterjm, @uvjustin, @allenporter, mind taking a look at this issue as it has been labeled with an integration (stream) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `stream` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign stream` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


stream documentation stream source (message by IssueLinks)

charlespick commented 1 month ago

What I said yesterday about it appearing to be more reliable I think was a one off. It is back to never starting the stream.

issue-triage-workflows[bot] commented 1 month ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

charlespick commented 1 month ago

I'll need a few days to update to the latest version since one just came out. I'll test again and report here in a few days.

charlespick commented 1 month ago

After upgrading to 2024.10.1 the error is still posting when trying to load the stream, viewing the stream is still very unreliable/extremely slow (3+ minutes) to start:

2024-10-05 11:44:43.180 2024-10-05 18:44:43.081 WARNING (MainThread) [homeassistant.components.media_player] Error retrieving proxied image from http://10.3.5.96:1400
2024-10-05 11:44:50.698 2024-10-05 18:44:50.551 ERROR (stream_worker) [root] Uncaught thread exception
2024-10-05 11:44:50.698 Traceback (most recent call last):
2024-10-05 11:44:50.698   File "/usr/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
2024-10-05 11:44:50.698     self.run()
2024-10-05 11:44:50.698   File "/srv/homeassistant_2024_10_1/lib/python3.12/site-packages/sentry_sdk/integrations/threading.py", line 101, in run
2024-10-05 11:44:50.698     return _run_old_run_func()
2024-10-05 11:44:50.698            ^^^^^^^^^^^^^^^^^^^
2024-10-05 11:44:50.698   File "/srv/homeassistant_2024_10_1/lib/python3.12/site-packages/sentry_sdk/integrations/threading.py", line 96, in _run_old_run_func
2024-10-05 11:44:50.698     reraise(*_capture_exception())
2024-10-05 11:44:50.698   File "/srv/homeassistant_2024_10_1/lib/python3.12/site-packages/sentry_sdk/utils.py", line 1715, in reraise
2024-10-05 11:44:50.698     raise value
2024-10-05 11:44:50.698   File "/srv/homeassistant_2024_10_1/lib/python3.12/site-packages/sentry_sdk/integrations/threading.py", line 94, in _run_old_run_func
2024-10-05 11:44:50.698     return old_run_func(self, *a, **kw)
2024-10-05 11:44:50.698            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-10-05 11:44:50.698   File "/usr/lib/python3.12/threading.py", line 1010, in run
2024-10-05 11:44:50.698     self._target(*self._args, **self._kwargs)
2024-10-05 11:44:50.698   File "/srv/homeassistant_2024_10_1/lib/python3.12/site-packages/homeassistant/components/stream/__init__.py", line 438, in _run_worker
2024-10-05 11:44:50.698     stream_worker(
2024-10-05 11:44:50.698   File "/srv/homeassistant_2024_10_1/lib/python3.12/site-packages/homeassistant/components/stream/worker.py", line 618, in stream_worker
2024-10-05 11:44:50.698     muxer.mux_packet(first_keyframe)
2024-10-05 11:44:50.698   File "/srv/homeassistant_2024_10_1/lib/python3.12/site-packages/homeassistant/components/stream/worker.py", line 271, in mux_packet
2024-10-05 11:44:50.698     self._av_output.mux(packet)
2024-10-05 11:44:50.698   File "av/container/output.pyx", line 218, in av.container.output.OutputContainer.mux
2024-10-05 11:44:50.698   File "av/container/output.pyx", line 224, in av.container.output.OutputContainer.mux_one
2024-10-05 11:44:50.698   File "av/container/output.pyx", line 190, in av.container.output.OutputContainer.start_encoding
2024-10-05 11:44:50.698   File "av/container/core.pyx", line 290, in av.container.core.Container.err_check
2024-10-05 11:44:50.698   File "av/error.pyx", line 336, in av.error.err_check
2024-10-05 11:44:50.698 av.error.ValueError: [Errno 22] Invalid argument: '<none>'; last error log: [mp4] dimensions not set
issue-triage-workflows[bot] commented 2 weeks ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

charlespick commented 2 weeks ago

I'm still having this issue on the latest version 👍

issue-triage-workflows[bot] commented 1 day ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

charlespick commented 20 hours ago

Still having the issue with 2024.10.1