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

[6.0.1] Avoid infinite loop when finding principal in circular relationships #26699

Merged
merged 1 commit into from
Nov 15, 2021

Conversation

ajcvickers
Copy link
Member

Fixes #26629

Description

We added code in 6.0 to find the corresponding principal key property of a foreign key property when looking for value comparers. However, we missed the case where the foreign key property is itself the principal key for another overlapping relationship. This can happen when two entity types act as principal and dependents of each other, with one having a composite foreign key containing the principal key of the other. In this case, the code goes into an infinite loop.

Customer impact

Stack overflow when a model of this form is used. This is not a super common model, but is also not extremely rare, so we expect many more people to hit this as the update to 6.0.

How found

Customer reported on 6.0.

Regression

Yes, from 5.0.

Testing

Added this model to our tests.

Risk

Low; keep track of the properties we have checked so we can avoid cycles. Also added a quirk mode.

…onships

Fixes #26629

**Description**

We added code in 6.0 to find the corresponding principal key property of a foreign key property when looking for value comparers. However, we missed the case where the foreign key property is itself the principal key for another overlapping relationship. This can happen when two entity types act as principal and dependents of each other, with one having a composite foreign key containing the principal key of the other. In this case, the code goes into an infinite loop.

**Customer impact**

Stack overflow when a model of this form is used. This is not a super common model, but is also not extremely rare, so we expect many more people to hit this as the update to 6.0.

**How found**

Customer reported on 6.0.

**Regression**

Yes, from 5.0.

**Testing**

Added this model to our tests.

**Risk**

Low; keep track of the properties we have checked so we can avoid cycles. Also added a quirk mode.
@ajcvickers ajcvickers merged commit e621b10 into release/6.0 Nov 15, 2021
@ajcvickers ajcvickers deleted the AppleAppleAppleAppleApp1115 branch November 15, 2021 23:39
@ajcvickers ajcvickers removed this from the 6.0.1 milestone Nov 17, 2021
@NicolasDorier
Copy link

when does it releases? we can't update to .net6.0 until this is fixed.

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.

3 participants