3 Commits

Author SHA1 Message Date
David Rodenkirchen 68c51a09f8 Analyze mem leak 2026-04-15 09:29:56 +02:00
dusker a53e7100da Fix mariadb health check by adding the root password 2026-04-03 22:09:39 +02:00
David Rodenkirchen 2902c6a58c add sanitized production export 2026-02-24 00:54:24 +01:00
3 changed files with 603 additions and 1 deletions
+2 -1
View File
@@ -21,7 +21,7 @@ services:
MARIADB_USER: ezgg_lan_manager MARIADB_USER: ezgg_lan_manager
MARIADB_PASSWORD: Alkohol1 MARIADB_PASSWORD: Alkohol1
healthcheck: healthcheck:
test: ["CMD", "mariadb-admin", "ping", "-h", "localhost"] test: ["CMD", "mariadb-admin", "ping", "-h", "localhost", "-pAlkohol1"]
interval: 5s interval: 5s
timeout: 3s timeout: 3s
retries: 5 retries: 5
@@ -30,6 +30,7 @@ services:
volumes: volumes:
- database:/var/lib/mysql - database:/var/lib/mysql
- ./sql/create_database.sql:/docker-entrypoint-initdb.d/init.sql - ./sql/create_database.sql:/docker-entrypoint-initdb.d/init.sql
- ./sql:/sql
volumes: volumes:
File diff suppressed because one or more lines are too long
+46
View File
@@ -1,9 +1,15 @@
import logging import logging
import tracemalloc
import sys import sys
from pathlib import Path from pathlib import Path
from uuid import uuid4 from uuid import uuid4
import gc
import time
import threading
from collections import Counter
from datetime import datetime, UTC
from rio import App, Theme, Color, Font, ComponentPage, Session from rio import App, Theme, Color, Font, ComponentPage, Session
from from_root import from_root from from_root import from_root
@@ -13,9 +19,49 @@ from src.ezgg_lan_manager.helpers.LoggedInGuard import logged_in_guard, not_logg
from src.ezgg_lan_manager.services.LocalDataService import LocalData from src.ezgg_lan_manager.services.LocalDataService import LocalData
from src.ezgg_lan_manager.types.UserSession import UserSession from src.ezgg_lan_manager.types.UserSession import UserSession
tracemalloc.start(25)
logger = logging.getLogger("EzggLanManager") logger = logging.getLogger("EzggLanManager")
def log_object_summary():
gc.collect()
objs = gc.get_objects()
counter = Counter(type(obj).__name__ for obj in objs)
timestamp = datetime.now(UTC).isoformat()
with open("memory_objects.log", "a") as f:
f.write(f"\n=== {timestamp} ===\n")
f.write(f"Total objects: {len(objs)}\n")
for name, count in counter.most_common(25):
f.write(f"{name}: {count}\n")
def log_top_allocations():
snapshot = tracemalloc.take_snapshot()
top_stats = snapshot.statistics('lineno')
timestamp = datetime.now(UTC).isoformat()
with open("memory_allocations.log", "a") as f:
f.write(f"\n=== {timestamp} ===\n")
for stat in top_stats[:10]:
f.write(str(stat) + "\n")
def start_hourly_logger():
def loop():
while True:
log_object_summary()
log_top_allocations()
time.sleep(3) # 1 hour
t = threading.Thread(target=loop, daemon=True)
t.start()
if __name__ == "__main__": if __name__ == "__main__":
start_hourly_logger()
theme = Theme.from_colors( theme = Theme.from_colors(
primary_color=Color.from_hex("ffffff"), primary_color=Color.from_hex("ffffff"),
secondary_color=Color.from_hex("018786"), secondary_color=Color.from_hex("018786"),