ISC2 Certified Secure Software Lifecycle Professional (CSSLP) Practice Question
During a code review of a Java-based file-processing microservice, you notice a method that opens a FileInputStream for every request but never closes the stream. After several hours of heavy traffic the container repeatedly crashes with the error "Too many open files." Which code change BEST prevents this security risk in accordance with secure resource-management practices?
Move the file-reading logic into a separate microservice so the main API thread pool is protected.
Increase the operating system's maximum open-file descriptor limit to accommodate more simultaneous streams.
Use a try-with-resources construct (or a finally block) to ensure the FileInputStream is always closed after use.
Wrap access to the FileInputStream in a synchronized block to avoid concurrent access issues.
Failing to release operating-system resources such as file descriptors causes a resource-exhaustion vulnerability that can be exploited-intentionally or accidentally-to produce a denial of service. In Java, wrapping the FileInputStream in a try-with-resources statement (or, in older code, placing the close() call in a finally block) guarantees that the stream is closed even if an exception occurs, ensuring the handle is always returned to the OS. Simply synchronizing the code does not release resources, off-loading the work to another service only moves the problem, and raising the file-descriptor limit treats the symptom rather than eliminating the vulnerability.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is a resource-exhaustion vulnerability?
Open an interactive chat with Bash
How does `try-with-resources` work in Java?
Open an interactive chat with Bash
Why is increasing the file-descriptor limit not a valid solution?
Open an interactive chat with Bash
ISC2 Certified Secure Software Lifecycle Professional (CSSLP)
Secure Software Implementation
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
Pass with Confidence.
IT & Cybersecurity Package
You have hit the limits of our free tier, become a Premium Member today for unlimited access.
Military, Healthcare worker, Gov. employee or Teacher? See if you qualify for a Community Discount.
Monthly
$19.99
$19.99/mo
Billed monthly, Cancel any time.
3 Month Pass
$44.99
$14.99/mo
One time purchase of $44.99, Does not auto-renew.
MOST POPULAR
Annual Pass
$119.99
$9.99/mo
One time purchase of $119.99, Does not auto-renew.
BEST DEAL
Lifetime Pass
$189.99
One time purchase, Good for life.
What You Get
All IT & Cybersecurity Package plans include the following perks and exams .