-
-
Notifications
You must be signed in to change notification settings - Fork 556
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
Fix another "recursion depth exceeded" in memory deallocation for weak dictionaries #15506
Comments
Branch: u/nbruin/ticket/15506 |
comment:2
This should do the trick for Code that verifies the problem has been solved:
This used to fail, but with the code on this branch it works. New commits:
|
Commit: |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:5
That was quick :-) Thank you Nils! Is there a reason for not putting the above code that verifies the solution as a doctest? Other than that, what shall we do? Backport this ticket and its dependencies to mercurial, or move #10963 to git? |
comment:6
Replying to @nthiery:
No, if you want to add a doctest, go ahead.
I have no preference. Given that you'd have to backport #15367 as well, I think you'd better bite the bullet and go with git. |
comment:7
Replying to @nbruin:
I am fine with both, as long as it goes quickly. Volker, Jeroen, what do you think from a release management point of view? |
comment:8
I don't see a good reason to force this ticket in Sage 5.13. So it should not be a blocker and should be postponed to Sage 6.0 which means git. |
comment:12
can we get this reviewed? ;-) |
comment:13
Replying to @vbraun:
I suppose this is independent of the patch:
|
comment:14
Is it really needed to additionally import this during startup:
I am particularly talking about binary recurrence sequences. |
comment:15
Has this really been introduced by this branch:
Or is this from #14320? |
comment:16
Concerning additional imports and Calcul-math things: None of that is directly effected by commits on this ticket, so it has to from the state of "master" on which this branch is based. This ticket is only meant to change |
comment:17
Replying to @nbruin:
OK, so, it is a bug in the plugins.
And now I am really confused. In #15432, you introduce a weak reference from the callback to the weak value dictionary. Namely, on #15432, you point out that when passing the weak value dictionary to the callback via a closure then there are examples requiring many garbage collections to clear a weak value dictionary. Now, you revert this change. Can you explain why you did so? Doesn't this re-introduce the problem that you fixed in #15432? If not: Why not? And why did you merge #15432 into this branch? What is left from #15432 in the HEAD of this branch? |
comment:18
Hm. I just tested that the problematic behaviour (namely: Numerous garbage collection cycles required to clear the dict) does not occur with your branch. Could it perhaps be the case that I was (again) reading in a wrong way the diff shown by trac? |
comment:19
Replying to @simon-king-jena:
I figured that this was the new way to express a "dependency" on another ticket. It results in the branch I would have ended up with if I had started this ticket based on the branch there.
Everything, I think. I really just merged and it did so without conflict. Certainly all the commits listed at #15432 show up in the history here. |
comment:20
Then perhaps I was misreading what trac showed me as diff. I now took #15432, merged with master, and compare it with the branch from here, merged with master. These are the differences I see with
So, are these the changes I have to review here? Best regards, |
comment:21
Replying to @simon-king-jena:
Correct (isn't it a list rather than a tuple? Doesn't matter for our purposes, though).
That's from #15432. It's more than speed: it also saves us from having to keep a weakened reference in the IterationContext, so it makes it easier to avoid circular references. I was actually surprised to see the complication that a context produced here. In addition to these changes, #15432 also introduces an WeakKeyDictionary eraser class to make it possible to keep a weak reference (and avoid circular references). I'd recommend just reviewing all of this here and be done with it (unless you feel any of this is controversial of course) |
comment:22
Simon, are you still reviewing this and #15432? The list of commits in question is https://github.com/sagemath/sagetrac-mirror/commits/u%2Fnbruin%2Fticket%2F15506&qt=range&q=develop..u%2Fnbruin%2Fticket%2F15506 |
Dependencies: #15432 |
Author: Nils Bruin |
comment:24
Am I right that I don't need to push a merge with my review-commit from #15432, since there is no merge conflict? |
comment:25
Yes, if there is no conflict then you don't have to merge. |
Reviewer: Simon King |
Changed branch from u/nbruin/ticket/15506 to u/SimonKing/ticket/15506 |
comment:26
I have added the example from commit:2 as a doc test (otherwise the fix wouldn't be tested against). All tests pass (including the new one), and the code makes sense. I only wonder if we can use Python's trashcan in a different more efficient way (such as to avoid the creation of a list of length two during deletion of a dictionary item). But I think this ticket is about fixing a bug in the first place, and if we see the need for yet more efficiency, we can open another ticket. I.e.: Positive review. |
comment:27
Yeah, that's a nice Chrismas present :-) Thanks Simon, thanks Nils! |
See: #10963 and follow up for details
This is a follow up to #13394 #15069, and a blocker for #10963.
Depends on #15432
CC: @sagetrac-sage-combinat @vbraun @jdemeyer @simon-king-jena
Component: performance
Author: Nils Bruin
Branch/Commit: u/SimonKing/ticket/15506 @
6147777
Reviewer: Simon King
Issue created by migration from https://trac.sagemath.org/ticket/15506
The text was updated successfully, but these errors were encountered: