Raise limit on number of open file descriptors per process
| Originator: | bdkjones | ||
| Number: | rdar://13014239 | Date Originated: | 15 Jan 2013 |
| Status: | Open | Resolved: | |
| Product: | OS X | Product Version: | 10.8.2 |
| Classification: | Enhancement | Reproducible: | Always |
Summary: In <syslimits.h>, on line 88, there is a hard-coded limit that allows a running process to have no more than 10,240 open file descriptors. The comment on that same line says: "Todo: make this a config option?" I would like that to-do implemented. Specifically, I would like the limitation on open file descriptors raised or (ideally) eliminated. JUSTIFICATION FOR REQUEST: There are several categories of apps that need to watch a broad swath of files for changes. I write one them. My app is used by web developers. Whenever the user saves a file, my app processes that file (example: it takes a CSS file or a JPEG and minifies it, then reloads the web browser so the user can see the changes live.) Many of my users develop massively complex websites that have thousands of files and run into this limitation. Benchmarking apps are another type of application that frequently want to create many thousands of sockets or descriptors simultaneously. STABILITY CONSIDERATIONS: I understand that removing this limit entirely would enable developers to write apps that simply suck up system resources until the entire system crashes. There is, however, a key safeguard against that: By default, an app is limited to far less than the maximum number of open descriptors. Until the developer uses setrlimit(RLIMIT_NOFILE, x) to raise it, the limit is far lower (around 4,864 I believe). Leaving this "soft" limit in place would guard against bad developers who simply forget to close file descriptors, etc. Eventually their apps would crash when they hit the limit, but they would not go on sucking up resources until the system became unstable. PLAN B: If removing the hard-coded limit is not acceptable, then please consider raising it substantially. Virtually every Mac now ships with at least 8GB of RAM and *plenty* of resources to handle more than 10,240 open file descriptors in a single process. I propose *at least* doubling the limit, but preferably tripling it. Thank you.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!