Skip to content
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

If environment variable validation fails, CPU usage is very high #36

Closed
freinbichler opened this issue Mar 21, 2024 · 4 comments
Closed

Comments

@freinbichler
Copy link

Today after updating to version 0.7.2 and 0.7.3, which caused issues #33 and #35, my server CPU usage was constantly at >90%. Probably there is an endless loop running trying to validate the config again and again.
After I stopped the (broken) teslamatetelegrambot container, CPU usage returned to normal:

Screenshot 2024-03-21 at 13 43 11
@JakobLichterfeld
Copy link
Owner

Probably there is an endless loop running trying to validate the config again and again.

Yeah, no more releases for me after 3 hours sleep

@JakobLichterfeld
Copy link
Owner

JakobLichterfeld commented Mar 21, 2024

I assume you have restart: unless-stopped in your docker-compose.yml config. This causes the container to restart on every exit beside of a docker compose stop.
So its kind of expected behavior.

However Logs would indicate it:

teslamatetelegrambot-1 | 2024-03-21 13:48:17,000 - ERROR - Error: Please set the environment variable CAR_ID to a valid number and try again.
teslamatetelegrambot-1 exited with code 1
teslamatetelegrambot-1 | 2024-03-21 13:48:17,521 - ERROR - Error: Please set the environment variable CAR_ID to a valid number and try again.
teslamatetelegrambot-1 exited with code 1
teslamatetelegrambot-1 | 2024-03-21 13:48:18,184 - ERROR - Error: Please set the environment variable CAR_ID to a valid number and try again.
teslamatetelegrambot-1 exited with code 1
teslamatetelegrambot-1 | 2024-03-21 13:48:19,060 - ERROR - Error: Please set the environment variable CAR_ID to a valid number and try again.
teslamatetelegrambot-1 exited with code 1
teslamatetelegrambot-1 | 2024-03-21 13:48:20,357 - ERROR - Error: Please set the environment variable CAR_ID to a valid number and try again.
teslamatetelegrambot-1 exited with code 1

@freinbichler
Copy link
Author

True, I have restart: unless-stopped in my docker compose config. However, I do not see exited with code 1

teslamate-teslamatetelegrambot-1  | 2024-03-21 12:06:47,886 - INFO - Starting the Teslamate Telegram Bot.
teslamate-teslamatetelegrambot-1  | 2024-03-21 12:06:47,888 - INFO - Setting up the MQTT client...
teslamate-teslamatetelegrambot-1  | 2024-03-21 12:06:47,889 - INFO - Connect to MQTT broker at mosquitto:1883
teslamate-teslamatetelegrambot-1  | 2024-03-21 12:06:48,135 - INFO - Setting up the Telegram bot...
teslamate-teslamatetelegrambot-1  | 2024-03-21 12:06:49,878 - ERROR - Error: Please set the environment variable TELEGRAM_BOT_CHAT_ID to a valid number and try again.
teslamate-teslamatetelegrambot-1  | 2024-03-21 12:07:23,891 - INFO - Starting the Teslamate Telegram Bot.
teslamate-teslamatetelegrambot-1  | 2024-03-21 12:07:23,892 - INFO - Setting up the MQTT client...
teslamate-teslamatetelegrambot-1  | 2024-03-21 12:07:23,893 - INFO - Connect to MQTT broker at mosquitto:1883
teslamate-teslamatetelegrambot-1  | 2024-03-21 12:07:24,643 - INFO - Setting up the Telegram bot...
teslamate-teslamatetelegrambot-1  | 2024-03-21 12:07:26,650 - ERROR - Error: Please set the environment variable TELEGRAM_BOT_CHAT_ID to a valid number and try again.
teslamate-teslamatetelegrambot-1  | 2024-03-21 12:08:00,153 - INFO - Starting the Teslamate Telegram Bot.
teslamate-teslamatetelegrambot-1  | 2024-03-21 12:08:00,154 - INFO - Setting up the MQTT client...
teslamate-teslamatetelegrambot-1  | 2024-03-21 12:08:00,154 - INFO - Connect to MQTT broker at mosquitto:1883
teslamate-teslamatetelegrambot-1  | 2024-03-21 12:08:00,398 - INFO - Setting up the Telegram bot...
teslamate-teslamatetelegrambot-1  | 2024-03-21 12:08:01,897 - ERROR - Error: Please set the environment variable TELEGRAM_BOT_CHAT_ID to a valid number and try again.
teslamate-teslamatetelegrambot-1  | 2024-03-21 12:08:35,397 - INFO - Starting the Teslamate Telegram Bot.
teslamate-teslamatetelegrambot-1  | 2024-03-21 12:08:35,398 - INFO - Setting up the MQTT client...
teslamate-teslamatetelegrambot-1  | 2024-03-21 12:08:35,399 - INFO - Connect to MQTT broker at mosquitto:1883
teslamate-teslamatetelegrambot-1  | 2024-03-21 12:08:35,647 - INFO - Setting up the Telegram bot...
teslamate-teslamatetelegrambot-1  | 2024-03-21 12:08:37,144 - ERROR - Error: Please set the environment variable TELEGRAM_BOT_CHAT_ID to a valid number and try again.
teslamate-teslamatetelegrambot-1  | 2024-03-21 12:09:19,880 - INFO - Starting the Teslamate Telegram Bot.
teslamate-teslamatetelegrambot-1  | 2024-03-21 12:09:19,880 - INFO - Setting up the MQTT client...
teslamate-teslamatetelegrambot-1  | 2024-03-21 12:09:19,881 - INFO - Connect to MQTT broker at mosquitto:1883
teslamate-teslamatetelegrambot-1  | 2024-03-21 12:09:20,158 - INFO - Setting up the Telegram bot...
teslamate-teslamatetelegrambot-1  | 2024-03-21 12:09:23,387 - ERROR - Error: Please set the environment variable TELEGRAM_BOT_CHAT_ID to a valid number and try again.

@JakobLichterfeld
Copy link
Owner

Will add a 2-Minute wait before exiting the python code

JakobLichterfeld added a commit that referenced this issue Mar 21, 2024
…e check for some environment variables including 2 minute wait before retry

closes: #35 and #36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants