[MC-1599] File Handle leak in RegionFileCache (MCP) Created: 01/Nov/12  Updated: 19/Feb/13  Resolved: 19/Feb/13

Status: Resolved
Project: Minecraft: Java Edition
Component/s: None
Affects Version/s: Minecraft 1.4.2
Fix Version/s: Minecraft 1.4.6

Type: Bug
Reporter: cpw Assignee: Unassigned
Resolution: Fixed Votes: 3
Labels: None

Confirmation Status: Unconfirmed

 Description   

File handles can leak if the soft references in RegionFileCache(MCP) are garbage collected. This can lead to a slow decrease in performance and ultimately IO problems because file handles run out.

https://github.com/cpw/FML/commit/6edce8b5f4d522f58421da4e00735cb6493103e6

I fixed it by removing the soft reference. The other approach is to apply a finalizer, but that's considered bad form. Better to always control this manually.

FYI the leak is the RandomAccessFile inside the RegionFile itself- note that there is no "finalizer cleanup" on RandomAccessFile.



 Comments   
Comment by Tails [ 19/Feb/13 ]

Thanks for verifying.

Comment by Markku [ 19/Feb/13 ]

Just for the detail, the soft references are no longer used in the source of version 1.4.7. That is, this issue has been 'fixed'. No idea in which version.

Comment by Tails [ 19/Feb/13 ]

No answer on querry, assuming not an issue anymore.

Comment by Tails [ 05/Feb/13 ]

Is this still a concern in the current Minecraft version? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases.

Generated at Sun Jan 12 11:54:59 UTC 2025 using Jira 9.12.2#9120002-sha1:301bf498dd45d800842af0b84230f1bb58606c13.