Fix running failure when > 69 CPUs for open file limitation
A message that is not in the archive (sent off-list or not yet received): [email protected]
Sergey Senozhatsky
Quoted 8 lines · Youquan Song
Quoted 4 lines
Hello,
I'd like to ask you to try out the following patch. We leak fd inread_file().No. below patch does not fix the issue. The issue happen at open too many files at beginning.
Well, the patch is a separate issue not addressing the rlimit problem directly. We just leak fd in read_file().
-ss
Quoted 42 lines
Thanks
-YouquanQuoted 37 lines
------8<--------8<--------
- Do not leak file descriptor in
perf_bundleread_file().
- Clear perf event (unmap memory and close fd) on event destruction.Signed-off-by Sergey Senozhatsky <sergey.senozhatsky(a)gmail.com>---
src/perf/perf.cpp +1
-0@@ -167,6 +167,7 @@ perf_event::~perf_event(void) if (perf_event::pevent->ref_count == 1) { pevent_free(perf_event::pevent); perf_event::pevent = NULL; + clear(); } else pevent_unref(perf_event::pevent); }src/perf/perf_bundle.cpp +1
-0@@ -123,6 +123,7 @@ static char * read_file(const char *file) buffer[len] = '\0'; } out: + close(fd); return buffer; }