Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 367482 - Resource leak in ProcessHelper.copyBinaryFile may cause 'too many files opened' error
Summary: Resource leak in ProcessHelper.copyBinaryFile may cause 'too many files opene...
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-core (show other bugs)
Version: 8.1.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 8.0.2   Edit
Assignee: Sergey Prigogin CLA
QA Contact: Doug Schaefer CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-23 03:50 EST by Raphael Zulliger CLA
Modified: 2012-05-22 20:45 EDT (History)
1 user (show)

See Also:


Attachments
Proposed fix (1.91 KB, patch)
2011-12-23 03:57 EST, Raphael Zulliger CLA
cdtdoug: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Raphael Zulliger CLA 2011-12-23 03:50:57 EST
Build Identifier: 20110615-0604

In ProcessHelper.copyBinaryFile, the call to close() is missing for FileInputStream and FileOutputStream objects. This may cause "real problems" if this function is used to copy many files. In our case, we use the function in the "new project" context where we have to copy several hundred files.

Funnily, on Windows, no error occurs. I guess Windows can handle more opened files than my Ubuntu Linux can (by default).

Reproducible: Always

Steps to Reproduce:
1. Program a for-loop copying files using the mentioned function
2. Make sure to copy several hundred (e.g ~2000) files
3. The mentioned resource error will occur
Comment 1 Raphael Zulliger CLA 2011-12-23 03:57:25 EST
Created attachment 208765 [details]
Proposed fix
Comment 2 Sergey Prigogin CLA 2011-12-23 19:50:30 EST
Patch applied to cdt_8_0 and master.