-
-
Notifications
You must be signed in to change notification settings - Fork 565
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 uncaught infinite loop in coercion discovery #7420
Comments
comment:1
I reviewed the change, and it looks good. Robert: please double check; I don't guarantee that all the invariants are preserved. |
comment:2
Another option is to wrap that coerce_map_from call in a _register_pair try/except block. |
comment:3
Yes, calling _register_pair would work here, even a helper is_registered function might be better than using _coerce_test_dict directly. Also, instead of
it might be clearer to do
|
This is a variant of the previous patch, using register_pair |
comment:4
Attachment: trac_7420-fix-infinite-coercion-discovery-loop-2.patch.gz Replying to @robertwb:
I gave it a shot, and this works almost fine: all sage tests pass; except that for jack polynomials. Looking at it, it appears that the coercion model is picking a path which is really far from the shortest (see the attached log). The previous version was doing reasonably. This sounds like a pure piece of luck though, since in both cases, the strategy seems to be depth first search + limited selection among the first conversions found. Robert, Mike: from here, I see two options:
In both cases, after the category patches are in, we should definitely rewrite the coercion lookup to use a breath first search. |
Attachment: log.gz Log showing a long conversion path |
comment:5
I should mention: the error appearing in the log comes from the having the coercion go through |
comment:7
I'm going to move this to 4.3 where it's more relevant. |
comment:8
I'd say at this point go for the first version of the patch, but with an eye towards improving things in the multiple paths case. (A breath first search sounds like a good idea, but could be more expensive if paths "all the way down" have already been explored. Also, there's the notion of assigning a cost to a morphism which has not been exploited.) |
comment:9
I'll merge the first patch, and then look into a better solution. |
Merged: sage-4.3.alpha0 |
#5597 or #5598 introduced a potential infinite loop (and segfault) upon coercion discovery on a cyclic graph. The first occurence of such a graph was with the newly refactored symmetric functions.
The attached patch fixes this. By the way, it uses a dictionary rather than a list to hold the marks used (register_pair) to detect cycles.
The category patches #5981 depend on this!!!
CC: @sagetrac-sage-combinat @robertwb
Component: coercion
Author: Mike Hansen
Reviewer: Nicolas M. Thiéry, Robert Bradshaw
Merged: sage-4.3.alpha0
Issue created by migration from https://trac.sagemath.org/ticket/7420
The text was updated successfully, but these errors were encountered: