Add out of memory warning

This commit is contained in:
Taylor Helsper 2021-03-02 20:11:37 -06:00
parent b040bff158
commit d23aa39f0f
4 changed files with 31 additions and 8 deletions

View File

@ -51,8 +51,8 @@ QUICKSYNC_TORRENT_URL="https://mynodebtc.com/device/blockchain.tar.gz.torrent"
QUICKSYNC_TORRENT_BETA_URL="https://mynodebtc.com/device/blockchain_beta.tar.gz.torrent" QUICKSYNC_TORRENT_BETA_URL="https://mynodebtc.com/device/blockchain_beta.tar.gz.torrent"
QUICKSYNC_UPLOAD_RATE_FILE="/mnt/hdd/mynode/settings/quicksync_upload_rate" QUICKSYNC_UPLOAD_RATE_FILE="/mnt/hdd/mynode/settings/quicksync_upload_rate"
QUICKSYNC_BACKGROUND_DOWNLOAD_RATE_FILE="/mnt/hdd/mynode/settings/quicksync_background_download_rate" QUICKSYNC_BACKGROUND_DOWNLOAD_RATE_FILE="/mnt/hdd/mynode/settings/quicksync_background_download_rate"
LATEST_VERSION_URL="http://www.mynodebtc.com/device_api/get_latest_version.php?type=${DEVICE_TYPE}" LATEST_VERSION_URL="https://www.mynodebtc.com/device_api/get_latest_version.php?type=${DEVICE_TYPE}"
LATEST_BETA_VERSION_URL="http://www.mynodebtc.com/device_api/get_latest_version.php?type=${DEVICE_TYPE}&beta=1" LATEST_BETA_VERSION_URL="https://www.mynodebtc.com/device_api/get_latest_version.php?type=${DEVICE_TYPE}&beta=1"
UPLOADER_FILE="/mnt/hdd/mynode/settings/uploader" UPLOADER_FILE="/mnt/hdd/mynode/settings/uploader"
UPGRADE_ERROR_FILE="/mnt/hdd/mynode/settings/upgrade_error" UPGRADE_ERROR_FILE="/mnt/hdd/mynode/settings/upgrade_error"
LND_BACKUP_FOLDER="/home/bitcoin/lnd_backup/" LND_BACKUP_FOLDER="/home/bitcoin/lnd_backup/"
@ -84,10 +84,10 @@ if [ -f $PRODUCT_KEY_FILE ]; then
fi fi
fi fi
UPGRADE_DOWNLOAD_URL="http://www.mynodebtc.com/device_api/download_latest_standard.php?type=${DEVICE_TYPE}&product_key=${PRODUCT_KEY}" UPGRADE_DOWNLOAD_URL="https://www.mynodebtc.com/device_api/download_latest_standard.php?type=${DEVICE_TYPE}&product_key=${PRODUCT_KEY}"
UPGRADE_DOWNLOAD_SIGNATURE_URL="http://www.mynodebtc.com/device_api/download_latest_standard.php?type=${DEVICE_TYPE}&product_key=${PRODUCT_KEY}&hash=1" UPGRADE_DOWNLOAD_SIGNATURE_URL="https://www.mynodebtc.com/device_api/download_latest_standard.php?type=${DEVICE_TYPE}&product_key=${PRODUCT_KEY}&hash=1"
UPGRADE_BETA_DOWNLOAD_URL="http://www.mynodebtc.com/device_api/download_latest_standard.php?type=${DEVICE_TYPE}&product_key=${PRODUCT_KEY}&beta=1" UPGRADE_BETA_DOWNLOAD_URL="https://www.mynodebtc.com/device_api/download_latest_standard.php?type=${DEVICE_TYPE}&product_key=${PRODUCT_KEY}&beta=1"
UPGRADE_BETA_DOWNLOAD_SIGNATURE_URL="http://www.mynodebtc.com/device_api/download_latest_standard.php?type=${DEVICE_TYPE}&product_key=${PRODUCT_KEY}&beta=1&hash=1" UPGRADE_BETA_DOWNLOAD_SIGNATURE_URL="https://www.mynodebtc.com/device_api/download_latest_standard.php?type=${DEVICE_TYPE}&product_key=${PRODUCT_KEY}&beta=1&hash=1"
UPGRADE_PUBKEY_URL="https://raw.githubusercontent.com/mynodebtc/pubkey/master/mynode_release.pub" UPGRADE_PUBKEY_URL="https://raw.githubusercontent.com/mynodebtc/pubkey/master/mynode_release.pub"
# Update settings for other devices # Update settings for other devices

View File

@ -612,6 +612,8 @@ def index():
"product_key_error": pk_error, "product_key_error": pk_error,
"fsck_error": has_fsck_error(), "fsck_error": has_fsck_error(),
"fsck_results": get_fsck_results(), "fsck_results": get_fsck_results(),
"oom_error": has_oom_error(),
"oom_info": get_oom_error_info(),
"sd_rw_error": has_sd_rw_error(), "sd_rw_error": has_sd_rw_error(),
"drive_usage": drive_usage, "drive_usage": drive_usage,
"low_drive_space_error": low_drive_space_error, "low_drive_space_error": low_drive_space_error,
@ -862,6 +864,12 @@ def page_clear_fsck_error():
clear_fsck_error() clear_fsck_error()
return redirect("/") return redirect("/")
@app.route("/clear-oom-error")
def page_clear_oom_error():
check_logged_in()
clear_oom_error()
return redirect("/")
@app.route("/login", methods=["GET","POST"]) @app.route("/login", methods=["GET","POST"])
def page_login(): def page_login():
templateData = { templateData = {

View File

@ -26,6 +26,16 @@
</div> </div>
{% endif %} {% endif %}
{% if oom_error %}
<div class="main_page_warning_block">
<center>
<p><b>Low Memory Warning</b><br/>Your device was running low on memory and a process has been killed. Please disable some applications and reboot the device.</p>
<p>{{ oom_info }}</p>
<a href="/clear-oom-error" class="ui-button ui-widget ui-corner-all settings_button_small">OK</a>
</center>
</div>
{% endif %}
{% if not has_changed_password %} {% if not has_changed_password %}
<div class="main_page_warning_block"> <div class="main_page_warning_block">
<p style="text-align: center;"><b>Warning!</b><br/>You appear to be using the default password! You should change it to something else on the <a href="/settings">settings</a> page.</p> <p style="text-align: center;"><b>Warning!</b><br/>You appear to be using the default password! You should change it to something else on the <a href="/settings">settings</a> page.</p>

View File

@ -171,6 +171,7 @@ def dmesg_log(msg):
# This will monitor dmesg for system errors or issues # This will monitor dmesg for system errors or issues
def monitor_dmesg(): def monitor_dmesg():
dmesg_log_clear() dmesg_log_clear()
dmesg_log("Starting dmesg log monitor")
cmd = ["dmesg","--follow"] cmd = ["dmesg","--follow"]
dmesg = subprocess.Popen(cmd, stdout=subprocess.PIPE) dmesg = subprocess.Popen(cmd, stdout=subprocess.PIPE)
while True: while True:
@ -179,8 +180,12 @@ def monitor_dmesg():
l = l.encode('utf-8', 'ignore').decode('utf-8') l = l.encode('utf-8', 'ignore').decode('utf-8')
#TODO: Check for things like OOM, etc... #TODO: Check for things like OOM, etc...
if "Out of memory" in l:
set_oom_error(l)
dmesg_log(l) dmesg_log(l)
else:
#dmesg_log(l)
pass
except Exception as e: except Exception as e:
dmesg_log("dmesg exception: "+str(e)) dmesg_log("dmesg exception: "+str(e))