diff options
| author | Donald Sharp <sharpd@nvidia.com> | 2024-02-01 21:18:50 -0500 |
|---|---|---|
| committer | Donald Sharp <sharpd@nvidia.com> | 2024-02-01 21:23:56 -0500 |
| commit | d023a0ceec496353a588d8073aae953bb25c6686 (patch) | |
| tree | 3bbb144f60f8017d3cf1f3558ec3cfd3e0154204 /lib/event.c | |
| parent | a2caf2b5e132ad6d50d83348d8efe9cdea72ec6e (diff) | |
lib: Warn operator when fd limit is set too large
It's unlikely that an operator will ever set a fd
limit of over 100k. Let's warn the operator that
things are in a bit of a wonky state.
Fixes: #15280
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'lib/event.c')
| -rw-r--r-- | lib/event.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/event.c b/lib/event.c index a7851f6983..6427705e90 100644 --- a/lib/event.c +++ b/lib/event.c @@ -543,6 +543,7 @@ static void initializer(void) pthread_key_create(&thread_current, NULL); } +#define STUPIDLY_LARGE_FD_SIZE 100000 struct event_loop *event_master_create(const char *name) { struct event_loop *rv; @@ -569,6 +570,10 @@ struct event_loop *event_master_create(const char *name) rv->fd_limit = (int)limit.rlim_cur; } + if (rv->fd_limit > STUPIDLY_LARGE_FD_SIZE) + zlog_warn("FD Limit set: %u is stupidly large. Is this what you intended? Consider using --limit-fds", + rv->fd_limit); + rv->read = XCALLOC(MTYPE_EVENT_POLL, sizeof(struct event *) * rv->fd_limit); |
