Fix missing condition for max_filedescriptors use - #2488
Conversation
The max_filedescriptors directive is only useful when the OS setrlimit() API is available. Add markup to the squid.conf definition that enables appropriate errors and documentation automatically.
|
|
||
| NAME: max_filedescriptors max_filedesc | ||
| TYPE: int | ||
| IFDEF: HAVE_SETRLIMIT&&(RLIMIT_NOFILE||RLIMIT_OFILE) |
There was a problem hiding this comment.
Nice! But would it be even nicer if the logic were moved to some header and here it used only a derived value?
There was a problem hiding this comment.
If we all agree I can do that and the RLIMIT_OFILE hack in compat/compat_shared.h where the related SQUID_MAXFD_LIMIT is defined.
rousskov
left a comment
There was a problem hiding this comment.
PR description: The max_filedescriptors directive is only useful when the OS
setrlimit() API is available
I strongly disagree with that statement and, hence, this PR direction. If we continue to improve how Squid determines the maximum number of descriptors, max_filedescriptors should continue to be available in all Squid builds because it represents (or should represent) a fundamental limit/setting that is applicable to all builds, regardless of setrlimit() API availability.
Document what reality is, not what aspirations one has. @rousskov: you "disagree" with this Squid code line: Line 757 in dd5ea20 ... all the logic using this directive for meaningful action is disabled (not even built). The directive is literally only useful when the OS setrlimit() API is available to the built binary. |
rousskov
left a comment
There was a problem hiding this comment.
PR description: The max_filedescriptors directive is only useful when the OS
setrlimit() API is availableI strongly disagree with that statement and, hence, this PR direction. If we continue to improve how Squid determines the maximum number of descriptors,
max_filedescriptorsshould continue to be available in all Squid builds because it represents (or should represent) a fundamental limit/setting that is applicable to all builds, regardless ofsetrlimit()API availability.Document what reality is, not what aspirations one has.
In many cases, documenting both is better, especially when it helps to clarify why one would want to move in the opposite direction of one's aspirations. Do you agree that we should aspire to honor max_filedescriptors directive when setrlimit() is unavailable?
@rousskov: you "disagree" with this Squid code line:
Line 757 in dd5ea20
Yes, that code is essentially a bug. I "disagree" that we should adjust existing max_filedescriptors directive metadata to match existing problematic code. The correct adjustment should go in the opposite direction (i.e. we should fix code rather than break metadata).
... all the logic using this directive for meaningful action is disabled (not even built). The directive is literally only useful when the OS setrlimit() API is available to the built binary.
I am aware of this existing implementation problem. When the backlog problem is addressed, we should fix that implementation.
P.S. In the official code, a bit of useful max_filedescriptors "logic using this directive for meaningful action" exists even when setrlimit() is unavailable.
|
Thinking back about this PR, I wonder if it makes sense to leave max_filedescriptors in. what do you think? |
Yes,
And the above list does not enumerate all important environments. To get closer to a comprehensive list, we at least need to "multiply" the above by what we think Once/if we agree on what those two directives/options should mean, we can adjust Squid code accordingly. |
The max_filedescriptors directive is only useful when the OS
setrlimit() API is available. Add markup to the squid.conf
definition that enables appropriate errors and documentation
automatically.