Skip to content

Commit

Permalink
Merge pull request #15282 from donaldsharp/poll_info
Browse files Browse the repository at this point in the history
lib: Warn operator when fd limit is set too large
  • Loading branch information
ton31337 authored Feb 2, 2024
2 parents a4f2222 + d023a0c commit 4ec8522
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);

Expand Down

0 comments on commit 4ec8522

Please sign in to comment.