Skip to content

Conversation

@jrushford
Copy link
Contributor

Fixes #6321 when proxy.config.http.no_dns_just_forward_to_parent is enabled.

When this configuration variable is enabled, a parent selection strategies findParent() function is called twice on each transaction resulting in unexpected results such as every other parent is only used in a strict round robin strategy.

// findParent() is called early in the transaction so, use that
// query result and clear the flag.
if (result->parent_exists_result && result->result == PARENT_SPECIFIED) {
result->parent_exists_result = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we resetting the flag here? if findParent is called 3 times instead of 2 times, are we going to see the problem again?

result->reset();
// when proxy.config.http.no_dns_just_forward_to_parent is enabled
// findParent() is called early in the transaction so, use that
// query result and clear the flag.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we make ParentExists() not to change any structures instead of using a flag?

Copy link
Member

Choose a reason for hiding this comment

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

+1, IMHO ParentExists() should be an idempotent method

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@vmamidi an d @jvgutierrez I see your point. I'll do some more work on this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@vmamidi and @jvgutierrez I've modified parentExists() to just search for an available parent returning true/false as is found by iterating through the parent lists. Later in the transaction where the result is actually used, findParent() is called which looks up an available parent using the strategy algorithm. parentExists() just needs to return true/false on whether there is an available parent and is not concerned with the selection algorithm. parentExists() is now idempotent which fixes the strict round robin selection issue.

…ward_to_parent

is enabled.  When this configuration variable is enabled, a parent selection
strategies findParent() function is called twice on each transaction resulting
in unexpected results such as every other parent is only used in a strict
round robin strategy.
@jrushford jrushford merged commit 98893b6 into apache:master Jan 22, 2020
@zwoop zwoop modified the milestones: 10.0.0, 9.0.0 Jan 23, 2020
@zwoop
Copy link
Contributor

zwoop commented Jan 23, 2020

Cherry-picked to v9.0.x branch.

@zwoop
Copy link
Contributor

zwoop commented Mar 31, 2020

This has merge conflicts.

@jrushford
Copy link
Contributor Author

@zwoop I'll have a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

strict round robin parent select doesn't work as expected

4 participants