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
Random failure in coerce_action.pyx #18157
Comments
comment:1
Reliable reproduction of the error condition:
The reason is simple: It may just be that this action object does get used properly and that this doctest is broken. In that case the fix is:
|
This comment has been minimized.
This comment has been minimized.
comment:3
Also for this one: the coercion framework will never be asked to discover an action on an otherwise unreferenced parent. At the same time, the action object does get cached (globally!) somewhere in the coercion framework and hence should probably not hold a strong reference (at least to one of the sets it acts on). The container it gets stored in is probably a TripleDict, keyed on the two parents involved. It takes care of having a callback to delete the action object when one of the domains gets deleted, so the action objects will normally not outlive the shortest lifetime of the parents involved. If we have an absolute need of handling actions outside the coercion framework, we should probably make other action objects that do keep strong references. We do this for maps that get used for conversion and coercion. But these actions are showing desirable behaviour for use in the coercion framework. I think the bug is in the doctests. |
comment:4
Replying to @nbruin:
Me too! |
comment:5
Somebody please write a patch instead of me-too-ing ;-) |
Commit: |
comment:6
Might be other wrong doctests... not sure how to find them. New commits:
|
Branch: public/18157 |
comment:7
There is another one in |
comment:8
Would be nice if people would run the testsuite with this patch (and #10513)
Or even better, does somebody know how to call |
comment:9
Replying to @videlec:
That wouldn't help, right? |
Reviewer: Simon King |
comment:12
With one exception, the flaky tests constitute a misuse: Objects that are normally used internally are suddenly put out into the wild. It is clear that that can lead to disaster unless precautions are taken. Hence, I support the general approach in the attached branch: In these tests, one should work with permanent rather than temporary objects, to prevent premature garbage collection. However, one should also explicitly say in these tests that we are talking about things that normally happen in the innards of Sage, and that the tests do not show how to work with them! One test is different: @@ -606,7 +624,8 @@ cdef class IntegerMulAction(Action):
This used to hang before :trac:`17844`::
- sage: E = EllipticCurve(GF(5), [4,0])
+ sage: GF5 = GF(5)
+ sage: E = EllipticCurve(GF5, [4,0])
sage: P = E.random_element()
sage: (-2^63)*P
(0 : 1 : 0) Defining an elliptic curve over a finite field should certainly be enough to prevent the finite field from garbage collection! So, here I do not agree with the fix. Apparently the test fails because of an internal bug, not because of misuse. So, I put it to "needs work", because we should either find and fix the underlying bug here, or open a new ticket for the elliptic curve issue. |
Work Issues: Find underlying problem for elliptic curve problem, or open a new ticket for it |
comment:13
I don't see a problem with the elliptic curve example:
So, why should it be changed? |
comment:14
Even if right now E is kept alive elsewhere (presumably another doctest leaked it) you shouldn't assume that this will not change in the future. |
comment:15
Replying to @simon-king-jena:
Agreed. You can revert it. |
comment:16
Replying to @vbraun:
What are you talking about? In the test in question, the elliptic curve |
Branch pushed to git repo; I updated commit sha1. New commits:
|
Author: Vincent Delecroix, SImon King |
comment:18
I added comments in appropriate places, telling to be careful when using coerce actions outside of coercion models, reverting the elliptic curve test, and fixing some more tests in which a premature garbage collection was possible. From my point of view, it is a positive review, but of course someone should have a look at my commit. New commits:
|
comment:20
Hi Simon, I merge on sage-6.7.beta1 (sorry if I did wrong). If you prefer you can only cherry-pick 60fcedc. I agree with your commits and just added references to your ticket. I am ok for the positive review. Vincent |
comment:21
Replying to @videlec:
I suppose that Volker will tell you that (1) one should only merge if there is a good reason, and (2) one must not change the history, even if one has merged without a good reason. So, just leave it as it is. I had a look at your changes, and they look fine to me. Provided that the patchbot gives a green blob, it should be positive review. |
comment:22
The patchbot tells us that all tests pass, and based on the discussion above we have a positive review. |
Changed work issues from Find underlying problem for elliptic curve problem, or open a new ticket for it to none |
Changed branch from public/18157 to |
Changed author from Vincent Delecroix, SImon King to Vincent Delecroix, Simon King |
Changed commit from |
Zmod(6) can be collected at the wrong time
Idem with
CC: @simon-king-jena
Component: coercion
Keywords: random_fail
Author: Vincent Delecroix, Simon King
Branch:
60fcedc
Reviewer: Simon King
Issue created by migration from https://trac.sagemath.org/ticket/18157
The text was updated successfully, but these errors were encountered: