This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
PR 10708 is about gold running out of file descriptors. I've found several places where gold can re-open a file descriptor for reading without holding a lock on the file; when that happens, the file descriptor never gets marked as available for reuse. This can cause fd exhaustion with --no-keep-files-mapped and a low limit on open file descriptors (ulimit -n). This patch fixes most of the file descriptor leakages by holding a Task_lock_obj on the object while we're reading from it. There are three more cases in the ARM backend -- two are easily fixable, but Doug wants to restructure the third so that reading the file is unnecessary, so I'll leave the arm.cc patches to him. I originally added an assert in fileread.cc, File_read::find_or_make_view(), to give an internal error if we ever try to get a view on a file while the file is unlocked (that's how I ended up finding most of these), but I'm leaving that out at least until we fix the remaining known problems in arm.cc. -cary PR gold/10708 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the object when reading from the file. * gold.cc (queue_middle_tasks): Hold a lock on the object when doing second layout pass. * icf.cc (preprocess_for_unique_sections): Hold a lock on the object when reading section contents. (get_section_contents): Likewise. (icf::find_identical_sections): Likewise. * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the object when reading from the file. * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on the object when doing deferred section layout.
Attachment:
gold-fd-leak-patch-1.txt
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |