Bug 58669 - pdfunite reaches max open files limit on MAX OS X
Summary: pdfunite reaches max open files limit on MAX OS X
Status: RESOLVED MOVED
Alias: None
Product: poppler
Classification: Unclassified
Component: utils (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Mac OS X (All)
: medium normal
Assignee: poppler-bugs
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-23 05:09 UTC by kabeya
Modified: 2018-08-21 10:42 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description kabeya 2012-12-23 05:09:28 UTC
pdfunite tmp000.pdf tmp001.pdf tmp002.pdf .... tmp253.pdf tmp254.pdf output.pdf

Ver. 0.20.5 on Mac OS X (10.7), it fails when 253 input files.

1. pdfunite.cc opens all input files at once, and merge them. Too many open files.
No need to keep input files open?

2. In PDFDoc constructor, format string (arg no.) is wrong.

line 156.
    error(errIO, -1, "Couldn't open file '{0:t}': {0:s}.", fileName, strerror(errno));

must be.

    error(errIO, -1, "Couldn't open file '{0:t}': {1:s}.", fileName, strerror(errno));
Comment 1 Thomas Freitag 2012-12-27 16:42:02 UTC
(In reply to comment #0)
> pdfunite tmp000.pdf tmp001.pdf tmp002.pdf .... tmp253.pdf tmp254.pdf
> output.pdf
> 
> Ver. 0.20.5 on Mac OS X (10.7), it fails when 253 input files.
> 
> 1. pdfunite.cc opens all input files at once, and merge them. Too many open
> files.
> No need to keep input files open?

This is a question of design: the FILE pointer belongs to the stream object which itself belongs to the xref object which is finally created in the constructor of PDFDoc. And it will be closed therefore in the destructor of the PDFDoc instance.

In a "normal" operating system one process can open much more than 256 files with the default settings and the default can easily be increased, i.e. via ulimit -n. 256 are a special default setting for Mac OS X, but even there it is possible to increase it, s. i.e. http://stackoverflow.com/questions/5377450/maximum-number-of-open-filehandles-per-process-on-osx-and-how-to-increase.

And because in my opinion it is not the normal use case to merge such a lot of PDF in one step, and even then You can divide it into several steps as a workaround for the Mac OS, I'm not willing to work on it. If You want to do, You're welcome.
 
> 
> 2. In PDFDoc constructor, format string (arg no.) is wrong.
> 
> line 156.
>     error(errIO, -1, "Couldn't open file '{0:t}': {0:s}.", fileName,
> strerror(errno));
> 
> must be.
> 
>     error(errIO, -1, "Couldn't open file '{0:t}': {1:s}.", fileName,
> strerror(errno));

@Albert: that's obviously true. Can You change it?
Comment 2 Albert Astals Cid 2012-12-27 22:32:05 UTC
Fixed the argument typo.

I agree with Thomas that this is OSX being too smart for its own sake, as he says we'll have a look at patches if you have them
Comment 3 GitLab Migration User 2018-08-21 10:42:12 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/poppler/poppler/issues/334.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.