Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib: Warn operator when fd limit is set too large #15282

Merged
merged 1 commit into from
Feb 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this.

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
Loading