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

[release/6.0] Clear reference to DbDataReader from RelationalDataReader #29005

Merged
merged 1 commit into from
Oct 4, 2022

Conversation

roji
Copy link
Member

@roji roji commented Sep 7, 2022

Fixes #28988

Description

In EF Core 6.0, we started recycling RelationalDataReader instances across RelationalCommand invocations, to optimize the query pipeline and cut down on needless allocations. However, the RelationalDataReader retains its reference to its DbDataReader until a new query is executed; if a BufferedDataReader is used, that can mean needlessly preventing garbage collection of lots of all query data. This is exarcebated by context pooling (where the context is kept around for much longer).

Customer impact

Significantly increased memory usage when a retrying execution is used, context pooling is activated and large results are queries from the database.

How found

Customer reported on 6.0

Regression

Yes, in 6.0.

Testing

Added a test.

Risk

Low.

This is port of #28989 which was already merged for 7.0.

@roji roji changed the title Clear reference to DbDataReader from RelationalDataReader (#28989) [release/6.0] Clear reference to DbDataReader from RelationalDataReader Sep 7, 2022
@rbhanda rbhanda added this to the 6.0.11 milestone Sep 20, 2022
@wtgodbe wtgodbe merged commit bbd8552 into dotnet:release/6.0 Oct 4, 2022
@ajcvickers ajcvickers removed this from the 6.0.11 milestone Oct 5, 2022
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.

4 participants