Skip to contentSkip to conversation

Fix running failure when > 69 CPUs for open file limitation

PATCH Sergey Senozhatsky 1 participant 1 message Jun 4, 2013 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Sergey Senozhatsky

author
#1 lore raw
Quoted 8 lines · Youquan Song
Quoted 4 lines

Hello,
I'd like to ask you to try out the following patch. We leak fd in read_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
-Youquan

Quoted 37 lines

------8<--------8<--------

- Do not leak file descriptor in perf_bundle read_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
index 35b4017..e919741 100644
@@ -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
index 38e1e91..8d480e8 100644
@@ -123,6 +123,7 @@ static char * read_file(const char *file)
 		buffer[len] = '\0';
 	}
 out:
+	close(fd);
 	return buffer;
 }