修复EasyOCR CUDA OOM冻结+时间戳day=0崩溃+OCR图片分目录img/raw+processed

- 冻结根因: CUDA OOM后worker不退出, 损坏context持续占显存, 父进程不杀子进程
  反复发图→线程堆积+显存耗尽→桌面冻结
- worker: readtext CUDA/kernel错误→立即退出释放显存(faulerhandler已有兜底)
- 父进程: 收到CUDA错误→立即杀子进程+30s冷却; 连续2次CUDA错误→EASYOCR_FORCE_CPU=1
  强制CPU模式启动(显存不足降级防冻结)
- 时间戳day=0崩溃: _is_timestamp_old跨午夜用replace(day-1), 每月1号day=1→day=0
  抛ValueError day is out of range for month→微信OCR整轮失败; 改用timedelta(days=±1)
- OCR调试图片回源码目录: img/raw(原图PNG) + img/processed(处理后JPG) 分目录存储
- 崩溃日志回源码根 easyocr_crash.log (不写%LOCALAPPDATA%)
- _clean_old_ocr_debug 默认 keep=20 (回退上一轮激进keep=6)
- .gitignore: 忽略 img/ 与 worker_stderr/stdout.txt
This commit is contained in:
youpaishidifu
2026-08-01 22:23:55 +08:00
parent 0405e42a90
commit 4ae189e82f
3 changed files with 76 additions and 42 deletions
+5
View File
@@ -32,8 +32,13 @@ tim_dump.txt
ocr_debug_*.png
wechat_ocr_*.png
# OCR 调试图片分目录(img/raw 原图 + img/processed 处理后)
img/
# Shell redirect artifacts
nul
worker_stderr.txt
worker_stdout.txt
# Logs
*.log