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

[5.8] Fix memory leak in JOIN queries #28220

Merged
merged 1 commit into from
Apr 15, 2019
Merged

[5.8] Fix memory leak in JOIN queries #28220

merged 1 commit into from
Apr 15, 2019

Conversation

staudenmeir
Copy link
Contributor

Every JoinClause instance receives and stores the parent query. The instance itself then gets stored in the parent query's $joins property. This circular reference causes a memory leak and can be an issue for long-running scripts.

We can fix it by storing the parent query's connection, grammar, processor and class name separately instead of the whole query instance.

The removed $parentQuery property was private, so this shouldn't be a breaking change.

Fixes #28195.

@taylorotwell taylorotwell merged commit eb9ea35 into laravel:5.8 Apr 15, 2019
@staudenmeir staudenmeir deleted the join branch April 15, 2019 13:04
@laurencei
Copy link
Contributor

Thanks @staudenmeir

@deleugpn
Copy link
Contributor

Maybe it would have been better to have these attributes as private as well to make it possible to fix future bugs without breaking change?

@staudenmeir
Copy link
Contributor Author

@deleugpn We are only using private properties in very few places (probably not on purpose) and I think we should keep it like that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[5.8] Memory leak in DB join queries
5 participants