Merge lp://staging/~cjwatson/storm/more-weakrefs into lp://staging/storm

Proposed by Colin Watson
Status: Merged
Approved by: Adam Collard
Approved revision: 487
Merged at revision: 485
Proposed branch: lp://staging/~cjwatson/storm/more-weakrefs
Merge into: lp://staging/storm
Diff against target: 143 lines (+50/-7)
4 files modified
storm/cextensions.c (+17/-4)
storm/variables.py (+3/-2)
tests/store/base.py (+29/-0)
tests/variables.py (+1/-1)
To merge this branch: bzr merge lp://staging/~cjwatson/storm/more-weakrefs
Reviewer Review Type Date Requested Status
Adam Collard (community) Approve
Tony Simpson (community) Approve
Review via email: mp+365639@code.staging.launchpad.net

Commit message

Use weak references from Variable and MutableValueVariable to EventSystem, to avoid GC cycles.

Description of the change

Launchpad's test suite has had occasional problems for years with PostgresConnection leaks (Zope's test runner is careful about checking for GC garbage), but a combination of randomised test order and the fact that it often took hours to reach the failure on development systems even when we did manage to reproduce it meant that we had to work around it rather than fixing it properly; we've found that the problems are generally around dealing with MutableValueVariable instances. A couple of days ago, by chance, I ran across a much smaller subset of the Launchpad test suite that reproduced this bug, and so I was able to figure out a proper fix in Storm.

The problem was that, when change tracking was enabled on a MutableValueVariable, the variable became part of a reference cycle with the store via the event system. Using weak references for the event system appears to fix this, and I've been able to do a full successful Launchpad test run with this patch and with some of our workarounds reverted.

To post a comment you must log in.
486. By Colin Watson

Simplify C extension changes.

Revision history for this message
Tony Simpson (tonysimpson) wrote :

Looks good.

C changes look good.

Test looks a bit long but I understand it follows convention with other tests. I would add a comment as to why there needs to be an existing object in the store to get the behaviour.

review: Approve
487. By Colin Watson

Explain test a little more.

Revision history for this message
Adam Collard (adam-collard) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to status/vote changes: