File Descriptor Exhaustion |
Category ID: 769 (Category) | Status: Incomplete |
Description Summary
Extended Description
There are at least three distinct scenarios which can commonly lead to file descriptor exhaustion:
1. Lack of throttling for the number of open file descriptors
2. Losing all references to a file descriptor before reaching the shutdown stage
3. Failure to close file descriptors after processing
Phases: Implementation; Architecture and Design If file I/O is being supported by an application for multiple users, balancing the resource allotment across the group may help to prevent exhaustion as well as differentiate malicious activity from an insufficient resource pool. |
Phase: Implementation Consider using the getrlimit() function included in the sys/resources library in order to determine how many files are currently allowed to be opened for the process. (Good Code) Example Language: C #include <sys/resource.h> ... int return_value; struct rlimit rlp; ... return_value = getrlimit(RLIMIT_NOFILE, &rlp); |
Nature | Type | ID | Name | View(s) this relationship pertains to |
---|---|---|---|---|
ChildOf | Weakness Base | 400 | Uncontrolled Resource Consumption ('Resource Exhaustion') | Development Concepts (primary)699 |
ParentOf | Weakness Variant | 773 | Missing Reference to Active File Descriptor or Handle | Development Concepts (primary)699 |
ParentOf | Weakness Variant | 774 | Allocation of File Descriptors or Handles Without Limits or Throttling | Development Concepts (primary)699 |
ParentOf | Weakness Variant | 775 | Missing Release of File Descriptor or Handle after Effective Lifetime | Development Concepts (primary)699 |
"kernel.org man page for getrlmit()". <http://www.kernel.org/doc/man-pages/online/pages/man2/setrlimit.2.html>. |