Skip to content

Leak removal: Set BaseStream to null when closing connections. - #510

Merged
roji merged 1 commit into
npgsql:2.2from
havard:2.2
Mar 2, 2015
Merged

roji merged 1 commit into
npgsql:2.2from
havard:2.2

Conversation

@havard

@havard havard commented Mar 1, 2015

Copy link
Copy Markdown

Issue #505 identified several cases of resource starvation. This commit fixes leaking NpgsqlBaseStream instances.

roji added a commit that referenced this pull request Mar 2, 2015
Leak removal: Set BaseStream to null when closing connections.
@roji
roji merged commit 124adeb into npgsql:2.2 Mar 2, 2015
@roji roji added the bug label Mar 2, 2015
@roji roji added this to the 2.2.5 milestone Mar 2, 2015
@roji

roji commented Mar 2, 2015

Copy link
Copy Markdown
Member

Thanks for this, once again. I have forward-ported this to master as well.

A bit out of curiosity: did you actually experience a leak because of this? If so, I'm wondering if it is the result of the cyclical references (between NpgsqlConnector and NpgsqlNetworkStream), or if NpgsqlConnector was still being referenced after being closed (e.g. by the pool).

If it's the latter then we probably have another leak somewhere, if it's a matter of cyclical references I was under the impression that the garbage collector knows how to deal with this kind of case...

@havard

havard commented Mar 2, 2015

Copy link
Copy Markdown
Author

This was also found in the same analysis I posted earlier, so yes, it is very likely a result of the cyclic references discussed in #505.

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.

2 participants