Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase the open file limit before writing PDFs #64

Merged
merged 1 commit into from
Sep 10, 2024
Merged

Conversation

tagatac
Copy link
Owner

@tagatac tagatac commented Sep 10, 2024

What is changing: Check the OS-level open file limit (and adjust it if necessary) prior to writing PDF files.

Why this change is being made: There is the potential for wkhtmltopdf to need many open files (see wkhtmltopdf/wkhtmltopdf#3081). This was fixed in #14, where it depended on the order of events:

  1. Stage the PDF file, getting the number of images
  2. Check and adjust the open file limit
  3. Flush the PDF file to disk

Number 3 was achieved via the call defer outFile.Close():

defer outFile.Close()

However, #29 removed Close() from the OutFile interface, collapsing Stage() and Flush() into a single function Flush() run prior to checking and adjusting the open file limit.

Related issue(s): Fixes #63

Follow-up changes needed: None AFAIK

Is the change completely covered by unit tests? If not, why not?: Yes

@tagatac tagatac merged commit 2ec2203 into main Sep 10, 2024
4 checks passed
@tagatac tagatac deleted the fix-file-limit branch September 10, 2024 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pdfFile: Too many open files
1 participant