Actions
Bug #1977
openHTML_TO_PDF: Chrome temp files fill production disk
Start date:
10/07/2026
Due date:
% Done:
0%
Estimated time:
Description
The HTML_TO_PDF service filled the production server's disk with leftover Chrome temp files. The server failed on 2026-10-06, and more than 10 million files had to be deleted.
Probable cause
Every PDF request starts a new headless Chrome (chrome-php) with a throwaway profile folder in %TEMP% (chromium-php-*). The library's cleanup is best-effort and fails silently. On Windows Server the folder is left behind when:
- Chrome child processes or antivirus still have files locked at delete time
- IIS/FastCGI kills the PHP worker mid-request, so the cleanup never runs
- Chrome also writes its own temp files (scoped_dir*, crash dumps) to %TEMP%, and the library never removes those
Fix (HTML_TO_PDF, branch Bug-1977-chrome-temp-cleanup)
- Each request gets its own folder under %TEMP%\html_to_pdf_chrome holding the Chrome profile and Chrome's TMP/TEMP
- The service deletes that folder itself, retrying if files are locked; failures are logged
- A backup cleanup runs if the PHP worker dies mid-request
- A periodic sweep deletes leftover folders older than 1 hour, including old chromium-php-* folders
- Chrome flags turn off crash dumps, disk cache, extensions and component updates
Still to confirm
- Which folder held the 10M files (chromium-php-, scoped_dir, or something else)
- Whether orphaned chrome.exe processes are building up on the server
- Test the fix on a Windows staging server before deploying
Actions