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

Bug 5312: Startup aborts if OPEN_MAX exceeds RLIMIT_NOFILE #1551

Closed
wants to merge 1 commit into from

Conversation

alanc
Copy link
Contributor

@alanc alanc commented Oct 27, 2023

FATAL: Event loop exited with failure

The DP_POLL ioctl on Solaris fails with EINVAL when the number of
supplied descriptors (OPEN_MAX) is higher than the current RLIMIT_NOFILE
setting. When it comes to the maximum number of descriptors, we should
use Squid_MaxFD (which already reflects RLIMIT_NOFILE setting).

@squid-prbot
Copy link
Collaborator

Can one of the admins verify this patch?

@alanc
Copy link
Contributor Author

alanc commented Oct 27, 2023

More details are explained in https://bugs.squid-cache.org/show_bug.cgi?id=5312

@squid-anubis squid-anubis added the M-failed-description https://github.com/measurement-factory/anubis#pull-request-labels label Oct 27, 2023
@yadij
Copy link
Contributor

yadij commented Oct 28, 2023

OK to test

yadij
yadij previously approved these changes Oct 28, 2023
@yadij yadij changed the title Bug 5312: ModDevPoll aborts on startup if fd limit is less than MAX_OPEN Bug 5312: ModDevPoll aborts on startup if fd limit is less than OPEN_MAX Oct 28, 2023
@alanc
Copy link
Contributor Author

alanc commented Oct 28, 2023

The force push just fixed the MAX_OPEN -> OPEN_MAX typo in the commit title.

@rousskov
Copy link
Contributor

rousskov commented Oct 28, 2023

The force push just fixed the MAX_OPEN -> OPEN_MAX typo in the commit title.

@alanc, just FYI: We do not use PR branch commit titles and messages when merging changes into master. Anubis, the bot automating such merging, uses GitHub PR title and PR description for the squashed master commit. We need to add an automated greeting message to explain that and other caveats to new contributors...

rousskov
rousskov previously approved these changes Oct 28, 2023
Copy link
Contributor

@rousskov rousskov left a comment

Choose a reason for hiding this comment

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

Thank you for this bug fix!

I cannot object to this fix because it makes some things better without making other things worse, but I think we should finish this update by addressing several closely related problems, as detailed in my change requests. I can implement those change requests if you prefer -- just let me know! Both look trivial to me, but I may be missing some hidden caveats.

src/comm/ModDevPoll.cc Outdated Show resolved Hide resolved
src/comm/ModDevPoll.cc Show resolved Hide resolved
@rousskov rousskov added the S-waiting-for-author author action is expected (and usually required) label Oct 28, 2023
alanc added a commit to alanc/squid that referenced this pull request Oct 28, 2023
Also partially addresses https://bugs.squid-cache.org/show_bug.cgi?id=5314
by replacing the devpoll_state array (that was sized to SQUID_MAXFD) with
use of the epoll_state member of the fde structure, to match ModEpoll, but
doesn't solve the problem of devpoll_fd not being opened in that path.
@alanc alanc dismissed stale reviews from rousskov and yadij via 0a13636 October 28, 2023 20:58
@rousskov rousskov self-requested a review October 29, 2023 06:22
@rousskov rousskov added S-waiting-for-reviewer ready for review: Set this when requesting a (re)review using GitHub PR Reviewers box and removed S-waiting-for-author author action is expected (and usually required) labels Oct 29, 2023
alanc added a commit to alanc/squid that referenced this pull request Oct 29, 2023
Also partially addresses https://bugs.squid-cache.org/show_bug.cgi?id=5314
by replacing the devpoll_state array (that was sized to SQUID_MAXFD) with
use of the epoll_state member of the fde structure, to match ModEpoll, but
doesn't solve the problem of devpoll_fd not being opened in that path.
src/comm/ModDevPoll.cc Outdated Show resolved Hide resolved
Copy link
Contributor

@rousskov rousskov left a comment

Choose a reason for hiding this comment

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

FWIW, I am quite surprised by the recent PR updates. I expected this PR to do what its current description says -- use Squid_MaxFD for everything.

I hope this PR does not need to make all these complex decisions to fully address Bug 5312 (i.e. it is sufficient to just make all the three arrays Squid_MaxFD in size), but I may be missing something.

I left a few specific questions to facilitate progress. At the end of the day, if there are good reasons to make those complex decisions in this PR, we will need to document, via C++ comments, the rationale behind those new constants (i.e., why "256" and why "1024").

src/comm/ModDevPoll.cc Outdated Show resolved Hide resolved
src/comm/ModDevPoll.cc Outdated Show resolved Hide resolved
src/comm/ModDevPoll.cc Outdated Show resolved Hide resolved
src/comm/ModDevPoll.cc Show resolved Hide resolved
@rousskov rousskov added S-waiting-for-author author action is expected (and usually required) and removed S-waiting-for-reviewer ready for review: Set this when requesting a (re)review using GitHub PR Reviewers box labels Oct 30, 2023
The DP_POLL ioctl on Solaris will fail with EINVAL if the number of fds
specified is higher than the current RLIMIT_NOFILE setting.  Fortunately,
squid already puts the RLIMIT_NOFILE value in the Squid_MaxFD variable,
so we just use that instead.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
@rousskov rousskov changed the title Bug 5312: ModDevPoll aborts on startup if fd limit is less than OPEN_MAX Bug 5312: Startup aborts if OPEN_MAX exceeds RLIMIT_NOFILE Nov 3, 2023
Copy link
Contributor

@rousskov rousskov left a comment

Choose a reason for hiding this comment

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

Thank you for addressing my concerns. I have adjusted PR title/description to supply (assumed) logged symptoms and fix formatting.

I am approving this PR and requesting @yadij re-review (I believe his earlier concern has been addressed as well).

src/comm/ModDevPoll.cc Outdated Show resolved Hide resolved
src/comm/ModDevPoll.cc Outdated Show resolved Hide resolved
src/comm/ModDevPoll.cc Outdated Show resolved Hide resolved
@rousskov rousskov added S-waiting-for-reviewer ready for review: Set this when requesting a (re)review using GitHub PR Reviewers box and removed S-waiting-for-author author action is expected (and usually required) labels Nov 3, 2023
@rousskov rousskov requested a review from yadij November 3, 2023 14:46
@squid-anubis squid-anubis removed the M-failed-description https://github.com/measurement-factory/anubis#pull-request-labels label Nov 3, 2023
Copy link
Contributor

@yadij yadij left a comment

Choose a reason for hiding this comment

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

FTR; this will need a re-work when the max_filedescriptors directive becomes reconfigurable. However since it is currently limited to a full restart on changes this PR change is sufficient.

@yadij yadij added M-cleared-for-merge https://github.com/measurement-factory/anubis#pull-request-labels and removed S-waiting-for-reviewer ready for review: Set this when requesting a (re)review using GitHub PR Reviewers box labels Nov 18, 2023
squid-anubis pushed a commit that referenced this pull request Nov 19, 2023
    FATAL: Event loop exited with failure

The DP_POLL ioctl on Solaris fails with EINVAL when the number of
supplied descriptors (OPEN_MAX) is higher than the current RLIMIT_NOFILE
setting. When it comes to the maximum number of descriptors, we should
use Squid_MaxFD (which already reflects RLIMIT_NOFILE setting).
@squid-anubis squid-anubis added the M-waiting-staging-checks https://github.com/measurement-factory/anubis#pull-request-labels label Nov 19, 2023
@squid-anubis squid-anubis added M-merged https://github.com/measurement-factory/anubis#pull-request-labels and removed M-waiting-staging-checks https://github.com/measurement-factory/anubis#pull-request-labels M-cleared-for-merge https://github.com/measurement-factory/anubis#pull-request-labels labels Nov 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
M-merged https://github.com/measurement-factory/anubis#pull-request-labels
Projects
None yet
5 participants