Repository navigation
fix divide by zero when upsync host resolves to no IPv4 address - #329
Merged
Merged
Conversation
ngx_http_upsync_init_server() counts only AF_INET results from getaddrinfo() and then picks one with ngx_random() % n. If the host resolves only to IPv6 (AAAA) addresses, n is 0 and the worker crashes with SIGFPE on every sync attempt. Fall back to the configured address instead, as is already done when getaddrinfo() fails.
Member
|
wow, do you still use the module? @gfrankliu |
Collaborator
Author
|
Some old systems are still running |
xiaokai-wang
approved these changes
Oct 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ngx_http_upsync_init_server()counts onlyAF_INETresults fromgetaddrinfo()and then picks one withngx_random() % n. If the upsync host resolves only to IPv6 (AAAA) addresses,nis 0 and the worker crashes with SIGFPE (signal 8) on every sync attempt.This falls back to the address resolved at config time (
goto valid), the same path already used whengetaddrinfo()fails. IPv6 support for the upsync connection itself is still out of scope (see #216).