New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Backend shutdown after bad data from linux command input read #682
Comments
Have you tried putting your commands in a bash script and executing the script with Mycodo? |
The two exceptions you pasted shouldn't stop the daemon. In fact, those exceptions are handled by the Input module and are merely warnings. Do you have log lines demonstrating a deamon malfunction? |
I've added more concise exception-handling, but I'm still skeptical this is causing a daemon crash, or that if the daemon is crashing, this is the cause. Also in the commit moments ago, I changed the log line from error to debug, so you'll need to set Log Level Debug in the Input settings to see them. That should reduce the clutter in the daemon log. |
Not sure what is happening but with those two linux commands deactivated I have had no daemon crashes. 2019-08-30 15:44:28,925 - INFO - mycodo.daemon - Mycodo daemon v7.6.3 starting It doesn't seem to crash, just shut down. This is how I have the command configured. If it helps any. |
Have you tried moving the command into a bash script and making the command the execution of the script? Try making the edits from this commit, restart the daemon, and see if it fixes the issue: 2340fef |
Just tried putting it into a bash script and executing via script call. 2019-08-30 18:49:15,149 - ERROR - mycodo.inputs.linux_command_f3048a36 - The command returned a non-numerical value. Ensure only one numerical value is returned by the command. Value returned: 'b''' |
Have you tried both recommendations? |
Yes, I made the commit changes and all I get is a 503 Bad Gateway error. I can't get the web interface up until I reverse the changes. |
An error would indicate you made a typo in the manual edit of the files. Make sure you use only spaces (no tabs). |
Yes it was the "tabs" that did me in. Wasn't aware python saw a difference between tabs and spaces. I did the commits and now have no 503 error anymore but I have the similar shutdown issues but at this point it happens only randomly instead of every time also only seems to happen when "Error:" here's my latest log: 2019-09-07 21:56:58,066 - DEBUG - mycodo.inputs.linux_command_727d9bd8 - Command being executed: curl -s 'http://10.10.0.53/cm?cmnd=%20Status%2011' | jq -r '.StatusSTS' | jq -r '.POWER1'| grep -c ON |
Ok so using the commits you made and modifying my curl call some seems to have resolved the problem: Thanks for the help, Appreciate it! |
Good to hear! It was likely the timeout because all I did was prevent the exception from stopping the whole Input. It seems there's something else with curl that caused the whole daemon to stop. |
Seems so, going to convert these to a single python input now that you've implemented it (thanks for that as well) Now off to learn enough python to do that. LOL |
You'll probably want to check out the Python module "urllib" |
Mycodo Issue Report:
7.6.3
Problem Description
Please list:
Backend Daemon stops randomly due to "bad reads"
Linux command/Bash command from input(s)
curl -s 'http://10.10.0.88/cm?cmnd=%20Status%2011' | jq -r '.StatusSTS' | jq -r '.POWER1'| grep -c ON
AND/OR
curl -s 'http://10.10.0.88/cm?cmnd=%20Status%2011' | jq -r '.StatusSTS' | jq -r '.POWER2'| grep -c ON
Parsing data from a tasmota sonoff module to get it's power status
Errors
List any errors you encountered.
Backend just stops after getting no data from tasmota module or getting corrupt data from it
Copy and pasting crash logs, or link to any specific
code lines you've isolated (please use GitHub permalinks for this)
2019-08-30 15:45:07,288 - ERROR - mycodo.inputs.linux_command_c419a78e - The command returned a non-numerical value. Ensure only one numerical value is returned by the command. Value returned: 'b'''
2019-08-30 15:45:07,292 - ERROR - mycodo.inputs.linux_command_f3048a36 - InputModule raised an exception when taking a reading: 'NoneType' object has no attribute 'isalpha'
Steps to Reproduce the issue:
How can this issue be reproduced?
(I'm polling same sonoff/tasmota device but two power states from it)
Additional Notes
Is there anything that should be added to make it easier
to address this issue?
Seems like 7.6.3 wants to error and shut down on corrupt values from a linux/bash command call whereas the older 7.4 would ignore errors and continue on it's way.
This is completely unusable asis since it kills the server on any "bad/missing" data.
The text was updated successfully, but these errors were encountered: