-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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
nixos/nginx: add option typesHashMaxSize #341072
Conversation
cec8390
to
f592c64
Compare
source? This strikes me like the kinda thing that explodes at runtime, not build/eval time. Can this be added to the tests? |
@@ -896,6 +893,22 @@ in | |||
''; | |||
}; | |||
|
|||
typesHashMaxSize = mkOption { | |||
type = types.ints.positive; | |||
default = if cfg.defaultMimeTypes == "${pkgs.mailcap}/etc/nginx/mime.types" then 2688 else 1024; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should move this into a let in and deduplicate with the other option to prevent it accidentally getting out of date.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mime.types file is rarely updated. If it is, the test will show that a change will be required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean defaultText
? That option is in the very next line.
f592c64
to
2bf2d23
Compare
https://nginx.org/en/docs/hash.html
I'll see what I can do. |
2bf2d23
to
4e5d0c3
Compare
Updated test. |
4e5d0c3
to
093a12c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I played a bit around with this.
If set to 1024:
vm-test-run-nginx> subtest: check optimal size of types_hash
vm-test-run-nginx> webserver: must fail: journalctl --unit nginx --grep 'could not build optimal types_hash'
vm-test-run-nginx> Test "check optimal size of types_hash" failed with error: "command `journalctl --unit nginx --grep 'could not build optimal types_hash'` unexpectedly succeeded"
if set to 4096, it passes.
if set to 16400, it passes.
How did you arrive at 2688
? Is there any way to test for the max_size being too big? (assuming there is a performance penalty for that)
093a12c
to
a1dac0a
Compare
I adjusted the parameter manually, in increments of 64 and the current |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, i leave it to code-owner to decide if the typesHashMaxSize
limit should be this tight, and whether the types_hash
test should be a (i assume) release blocker.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I think we don't need the nginx test to be a release blocker since this technically doesn't render nginx to be broken. It should only incur a small performance hit. The failing test should be enough to cover this.
a1dac0a
to
b06b3f4
Compare
@fpletz is that an variant? |
Sorry, I didn't mean any change by my review. I'm fine with either the nginx test standalone or having the nginx test in mailcap. My only intention with the review was to convey that the nginx test doesn't need to be a release blocker - if anybody feels otherwise I'm also fine with that. |
b06b3f4
to
fb91d20
Compare
Updated and rebased PR. |
fb91d20
to
9343e69
Compare
Description of changes
Allow to change maximum size of the types hash tables.
It is recommended to reduce the size if a custom file with mime-types is used.
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.