Home Assistant release with the issue:
0.91.3
Last working Home Assistant release (if known):
0.91.3
Operating environment (Hass.io/Docker/Windows/etc.):
Docker
Component/platform:
shell_command
Description of problem:
When I enable stream component than all shell commands stop working and return code -11
Problem-relevant configuration.yaml
entries and (fill out even if it seems unimportant):
N/A
Traceback (if applicable):
019-04-11 16:22:57 ERROR (MainThread) [homeassistant.components.shell_command] Error running command: bash /config/monitor/restart_monitor.sh {{ ha_token }}
, return code: -11
NoneType: None
Additional information:
If I disable stream than everything works fine
I'm also having trouble with shell commands. I have the stream component enabled, will try to remove and see if it makes any difference. My whole setup freezes up and all I can do is restart hass. I do not get any errors in the log, everything just stops.
same here, disabling the stream component helps 馃憤
I have stream
enabled and also am using shell_command
and both of which work fine. I have a freezing issue related to my wifi cameras dropping signal but that is a separate issue. I have HA installed in a venv on ubuntu 18 with python 3.6.7. Might be helpful for everyone to comment on their setup.
Hey there @home-assistant/core, mind taking a look at this issue as its been labeled with a integration (shell_command
) you are listed as a codeowner for? Thanks!
I have hassio in docker on ubuntu 16.04. Hass 0.91.3. Also just froze up when a notification sent with a camera entity. Have now tried disabling stream to see if that helps. Nothing in logs still when freezing.
Just verified that removing stream component stops the freezing. Can now make the shell commands without problem. My shell commands relates to the cameras (ptz) if that makes any difference.
Not sure if this is the same problem however I was having some similar issues. I was able to get it working again by using full path! usr/bin/curl
vs just curl
I just noticed you didn't provide full path to bash
so give that a try!
Also have this error, running hassio in docker on an ubuntu system. My shell command also calls curl to control PTZ. Tried adding full path, no luck. Hassio crashes and only way to get back is restart the container. Also have stream component enabled.
my shell command is a python script, crashing with full path, too. only disabling stream compinent helps.
@hunterjm
Using dlink DCS-2132L Rev A/B, DCS-2132L-ES, and DCS-2330 with the generic camera.
Running HASS on an Ubuntu computer with Docker. Currently running 0.91.4, but same issue for several releases.
I'm having the same issues, and have disabled the stream component also.
Some examples of failing commands which return -11.
command_line sensor:
command: 'git --version >/dev/null && echo "Installed"'
shell_command:
install_git: "dpkg --configure -a && apt update && apt install git -y &>/dev/null"
z_wave_graph: /usr/local/bin/python3 /config/python_scripts/z-wave-graph/z-wave-graph.py --token=XXX
check_usps: /usr/local/bin/python3 /config/python_scripts/usps.py
git_commit: /usr/local/bin/python3 /config/python_scripts/git-commit/git-commit.py
restart_hass: 'curl http://192.168.1.X:8126/container/home-assistant/restart'
Doing a bit of searching it is due to:
Return code -11 means "segmentation fault". A negative return code usually means that the process was terminated by a signal. Return code -11 means it was signal 11, which is SIGSEGV.
A segmentation fault is:
Segmentation faults can arise from similar conditions. A buffer overflow, such as trying to reach outside the bounds of an array, can cause a segfault, or trying to access memory that has not been allocated or has been deleted. Trying to write to memory that is read-only can also cause a memory error.
It is worth noting that my cameras can be flakey at times and come and go from my wireless network. Numerous errors reflecting failed streams are in my logs.
Same issue. Using shell commands to adjust camera when the stream component is enabled and as soon as one of the shell commands activates the home assistant frontend stops working and become inaccessible.
hm just wondering if any home assistant developer could take care of this obvious bug? or is anything needed from other users affected like more logs etc?
@nicx I'm guessing they need time, and I'm also guessing that's something we can't really help with ;)
+1 to this issue, tried to run multiple SSH commands via shell_command and just hangs the HA ui till i restart, to clarify i disable the stream: component and it also works fine as previously mentioned.
Can verify that the problem persists in 92. I have enabled debug logging for stream and shell_component but the log doesn't give me anything. Hass just freezes..
Now I did get this at the exakt moment I executed the shell command, however I don't know if it relates or not:
```
2019-04-25 21:28:49 ERROR (MainThread) [homeassistant.core] Error doing job: Fatal error on transport
Traceback (most recent call last):
File "uvloop/sslproto.pyx", line 574, in uvloop.loop.SSLProtocol._do_shutdown
File "/usr/local/lib/python3.7/ssl.py", line 767, in unwrap
return self._sslobj.shutdown()
ssl.SSLError: [SSL: KRB5_S_INIT] application data after close notify (_ssl.c:2609)
I still have this issue after updating HA to 0.92.1
Hi, I get this problem pretty much like @isabellaalstrom setup.
Not logs error, just HA freeze
+1
I was setting up my first shell command, to call a script to delete some old camera snapshots, and thought I was making a mistake. Finally found this thread. It works fine when called from a terminal, and when stream component is disabled, but throws the error when stream is enabled.
camera_cleanup: '/bin/bash -c /config/scripts/camera_cleanup.sh'
Error running command: /bin/bash -c /config/scripts/camera_cleanup.sh
, return code: -11
8:00 PM /usr/src/app/homeassistant/components/shell_command/__init__.py (ERROR)
Error running command: /bin/bash -c /config/scripts/camera_cleanup.sh
, return code: -11
NoneType: None
+1 under 0.92.2.
Agreed, issue still persists. I'm not sure any dev is aware/looking into this. I tried tagging @hunterjm as the issue is related to the stream component. Lack of shell commands makes stream unusable for my setup. ~~Additionally there is another issue posted for the same problem.
Ive just checked on the discord group and devs are aware hunterjm and balloob said the following "it's a bug in uvloop and people have been looking at it"
Not sure if it helps out but there are more details in the forum thread I posted a while back. https://community.home-assistant.io/t/0-92-2-locks-up/115307/11
Hope they dont realease 0.93 with this but still there.
I cant shut down PC right now, because of this.
I think that you may find this is a complicated issue to fix, since the bug is with uvloop not HA now i'm not sure if it's this uvloop (https://github.com/MagicStack/uvloop) but i don't think this will be a simple HA fix.
0.93 also has this issue
Yes, this is not really an issue within ha, so it will be a bit harder to fix. Do not expect a fix in 93.
For now just disable stream component if you need shell_commands so badly, or disable shell_commands if you need stream component so badly.
You can follow this issue over at uvloop repo: https://github.com/MagicStack/uvloop/issues/118
Thanks @isabellaalstrom i was trying to find the issue on there but couldn't find it.
A lot of my commands can be run via the command line components instead, I have found, and then doesn't cause Hass to freeze when stream is enabled. This might be a good workaround for some of you others as well. I have tried the command line switch and the command line cover with success with stream enabled.
great idea @isabellaalstrom, but as far as I know this doesn't help in case of passing variables/attributes to the shell command. Am I missing something here? ;)
@nicx I don't pass stuff to my commands, but that is why I said it might be a workaround for _some of you_. :)
Same here, disabling the stream component seems to get the shell_commands working again.
any other workaround ideas for a shell command with passed variables/attributes? i am afraid that the uvloop bug will not be solved in the next months, its open since 2017 :( hence we need to talk about alternatives...
Just turn of the stream component. I've had no issues since.
Stream is a nice feature but not important in my opinion, and between this and steams not being live it's just not worth using yet.
I love stream, its just working great independently which browser I use. When turning off I have this issue since years: https://github.com/home-assistant/home-assistant/issues/13995#issuecomment-500213938
So for me stream would be the solution :)
I also have some secure info in my scripts, so for me pretty important to pass this info as variables. But I have found some workaround. I am using docker, so I can use env variables. I gave created .env file and add some logic to my gitlab-ci pipelines. And I can use my variables in scripts.I agree that it is not the best solution and I duplicate variables in secrets.yaml and .env files, but at least it works. May be I will also try to combine shell component with command line switch, and create some custom component
I have the same issue, when streams component is enabled all shell commands crash hassio. I love stream component, works great but I need shell commands too, especially using hassio... 驴it's possible to solve this issue?
@DendelX The issue is out of HA's hands, the issue starts here https://github.com/MagicStack/uvloop/issues/118
@Fma965 Ouchh... thanks... seems difficult to solve soon...
Same here:
Im running hassio on an OP Ubuntu 18.04.2 LTS.
Hassio in docker - Home Assistant V 0.96.5
Hass crashes when using shell_command:
with stream:
enabled...
+1
Chiming in. It took me a while to narrow this down to stream after I knew shell commands weren't working.
Just remember to remove all of you camera_view: live
otherwise it will continue to crash
@isabellaalstrom - Changing to switch commands worked for me. Thanks for the suggestion - I had no ideas those existed and they were a life saver! :-)
Everything seems to be working great on 0.98.0! I think this could probably be closed
uvloop is back in hassio version ? I got this warning (i amrunninf 0.102.3) : "You are using UVLoop with stream and shell_command. This is known to cause issues. Please uninstall uvloop."
I didn't note such message but since a couple of days my hassio started to hang again using shell_command (on cron-like automation) and stream camera.
if I remove the "stream:" config... the stream component still active! weird.
if I remove the "stream:" config... the stream component still active! weird.
If you diff /usr/local/lib/python3.7 between 20191127 and 20191128 all of a sudden uvloop 0.14.0 is there, and it was not before. I see this code which is dynamically loading uvloop if it is installed, which would explain why the issue all of a sudden shows up:
Most helpful comment
Everything seems to be working great on 0.98.0! I think this could probably be closed