You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
.expect("desired_open_file_limit is too large to convert to u64."),
154
+
){
155
+
Ok(open_file_limit) => {
151
156
event!(
152
157
Level::INFO,
153
-
"set_open_file_limit({limit})::ulimit success. New fs.ulimit: {fs_ulimit} (20% increase of {limit}).",
158
+
"set_open_file_limit() assigns new open file limit {open_file_limit}.",
154
159
);
155
-
usize::try_from(new_fs_ulimit).expect("new_fs_ulimit too large")
160
+
usize::try_from(open_file_limit)
161
+
.expect("open_file_limit is too large to convert to usize.")
156
162
}
157
163
Err(e) => {
158
164
event!(
159
165
Level::ERROR,
160
-
"set_open_file_limit({limit})::ulimit failed. Maybe system does not have ulimits, continuing anyway. - {e:?}",
166
+
"set_open_file_limit() failed to assign open file limit. Maybe system does not have ulimits, continuing anyway. - {e:?}",
161
167
);
162
-
limit
168
+
DEFAULT_OPEN_FILE_LIMIT
163
169
}
164
170
}
165
171
};
166
-
if new_limit < DEFAULT_OPEN_FILE_PERMITS{
172
+
// Can we give a better estimate?
173
+
if new_open_file_limit < DEFAULT_OPEN_FILE_LIMIT{
167
174
event!(
168
175
Level::WARN,
169
-
"set_open_file_limit({limit}) succeeded, but this is below the default limit of {DEFAULT_OPEN_FILE_PERMITS}. Will continue, but we recommend increasing the limit to at least the default.",
176
+
"The new open file limit ({new_open_file_limit}) is below the recommended value of {DEFAULT_OPEN_FILE_LIMIT}. Consider raising max_open_files.",
170
177
);
171
178
}
172
-
if new_limit < limit {
179
+
180
+
// Use only 80% of the open file limit for permits from OPEN_FILE_SEMAPHORE
181
+
// to give extra room for other file descriptors like sockets, pipes, and
182
+
// other things.
183
+
let reduced_open_file_limit = new_open_file_limit.saturating_sub(new_open_file_limit / 5);
184
+
let previous_open_file_limit = OPEN_FILE_LIMIT.load(Ordering::Acquire);
185
+
// No permit should be aquired yet, so this warning should not occur.
"set_open_file_limit({limit}) succeeded, but new open file limit is {new_limit}. Will continue, but likely a config or system options (ie: ulimit) needs updated.",
191
+
"There are not enough available permits to remove {previous_open_file_limit} - {reduced_open_file_limit} permits.",
176
192
);
177
193
}
178
-
179
-
let current_total = TOTAL_FILE_SEMAPHORES.load(Ordering::Acquire);
180
-
if limit < current_total {
181
-
event!(
182
-
Level::ERROR,
183
-
"set_open_file_limit({}) must be greater than {}",
184
-
limit,
185
-
current_total
194
+
if previous_open_file_limit <= reduced_open_file_limit {
0 commit comments