Skip to content

Commit c2776a8

Browse files
authored
Limit number of file descriptors which might be closed (#13336)
1 parent 8d21174 commit c2776a8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Framework/Core/src/runDataProcessing.cxx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -721,8 +721,11 @@ void spawnDevice(uv_loop_t* loop,
721721
struct rlimit rlim;
722722
getrlimit(RLIMIT_NOFILE, &rlim);
723723
// We close all FD, but the one which are actually
724-
// used to communicate with the driver.
725-
int rlim_cur = rlim.rlim_cur;
724+
// used to communicate with the driver. This is a bad
725+
// idea in the first place, because rlim_cur could be huge
726+
// FIXME: I should understand which one is really to be closed and use
727+
// CLOEXEC on it.
728+
int rlim_cur = std::min((int)rlim.rlim_cur, 10000);
726729
for (int i = 0; i < rlim_cur; ++i) {
727730
if (childFds[ref.index].childstdin[0] == i) {
728731
continue;

0 commit comments

Comments
 (0)