Fix deprecated fitz import, log unhandled scan-thread crashes
Build — Windows, Linux & macOS / GDPRScanner / linux (push) Has been cancelled
Build — Windows, Linux & macOS / GDPRScanner / macos (push) Has been cancelled
Build — Windows, Linux & macOS / GDPRScanner / windows (push) Has been cancelled
Build — Windows, Linux & macOS / Create GitHub Release (push) Has been cancelled
Build — Windows, Linux & macOS / GDPRScanner / linux (push) Has been cancelled
Build — Windows, Linux & macOS / GDPRScanner / macos (push) Has been cancelled
Build — Windows, Linux & macOS / GDPRScanner / windows (push) Has been cancelled
Build — Windows, Linux & macOS / Create GitHub Release (push) Has been cancelled
document_scanner.py: `import fitz` is PyMuPDF's deprecated import alias, scheduled for removal - switched both sites to `import pymupdf as _fitz`. Pure rename, no behavior change (all 227 tests still pass). routes/scan.py: the background scan thread caught no exceptions, so an unexpected crash in run_scan() escaped into Python's default unhandled-thread-exception hook instead of the app's own logging/audit trail. The scan lock was already released correctly via `finally` - now the crash itself is also logged (`_log.exception`, full traceback) and audit-recorded before that. Confirmed by test_lock_released_when_ run_scan_raises: the PytestUnhandledThreadExceptionWarning it triggered is now gone, with no change to the test's own assertions.
This commit is contained in:
1 parent
efbbeb7306
commit
2260a451a5
2 files changed
+5
-2
No files matched your search
@@ -114,6 +114,9 @@ def scan_start():
|
||||
try:
|
||||
run_scan(options)
|
||||
_maybe_send_auto_email()
|
||||
except Exception:
|
||||
_log.exception("[scan] background scan thread crashed")
|
||||
_audit("scan_error", "background scan thread crashed", ip="")
|
||||
finally:
|
||||
state._scan_lock.release()
|
||||
threading.Thread(target=_run, daemon=True).start()
|
||||
|
||||
Reference in new issue
Block a user