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

Conversation

Projects
None yet
5 participants
@staudenmeir
Copy link
Contributor

commented Apr 15, 2019

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

2 checks passed

continuous-integration/styleci/pr The analysis has passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@staudenmeir staudenmeir deleted the staudenmeir:join branch Apr 15, 2019

@laurencei

This comment has been minimized.

Copy link
Member

commented Apr 15, 2019

Thanks @staudenmeir

@deleugpn

This comment has been minimized.

Copy link
Contributor

commented Apr 15, 2019

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

This comment has been minimized.

Copy link
Contributor Author

commented Apr 16, 2019

@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
You can’t perform that action at this time.