-
-
Notifications
You must be signed in to change notification settings - Fork 601
Non-deterministic test failure in cluster_algebra_quiver #22482
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
Comments
This comment has been minimized.
This comment has been minimized.
comment:2
Freudian slip? |
comment:3
I noticed that these mutation_class files get written to the user's actual |
comment:4
It seems this probably happens if |
comment:5
Replying to @embray:
No, that's not quite it either because testing just |
comment:6
For what it's worth, from knowledge of the mathematical context and code: I would say that a priori this result cannot happen unless Q is something else that the value given in the previous line. How this can happen is unknown to me. There is caching of the result in |
comment:8
I think I know the issue. To avoid infinite loops when trying to figure out what the mutation type is, the first step in the command Q.mutation_type() for quivers is to run "Q.is_mutation_finite()" (unless the type of Q is already known from the start). However, as is documented, this command "Uses a non-deterministic method by random mutations in various directions. Can result in a wrong answer." I'm surprised that so many wrong answers are arising from this non-deterministic process, but it seems like the pseudo-random seeds are being consistently poorly chosen for this example. Anyway, I agree that this is leading to potentially wrong answers but unless we change the "is_mutation_finite" command, this is not an entirely unexpected bug, but part of the way the code was written for computational efficiency sake. |
comment:9
I agree with Gregg: this is, in general, an artifact that comes from the non On the other hand the specific error in the description of the ticket is yet |
comment:10
I have made some micro-enhancements to the is_mutation_finite code. This could help prevent the sporadic doctest failure, maybe. New commits:
|
Branch: u/chapoton/22482 |
Commit: |
Author: Frédéric Chapoton |
comment:11
Thanks for looking into this! For the tests, would it make sense to just run them with a hard-coded random seed? There should even be a context manager for that somewhere... |
comment:12
review, somebody ? |
comment:14
For some reason the merge preview seems to have broken--trying to view it returns an internal server error. Maybe try rebasing it, just for the heck of it? |
comment:15
same here, but you can by hand navigate to sagemath/sagetrac-mirror@0f0b3c2 .
Also, I did millions of automated tests when I wrote the code some years ago, and this non-deterministic way really always produced the correct answer. I cannot believe this can be the problem! The reason that it should work is very simple: a finite type is usually very finite (in the sense that one usually does not consider finite types with |
comment:16
Always is a strong word though. To be clear, this was a very hard to reproduce issue, and when I run the tests for this code under normal circumstances it always passes. It just happens that if the tests are run under certain conditions there must be some state of the RNG under which it ends up failing. I could try to add some further diagnostics and try to reproduce the failure again, if you point me in the right direction as to what to add. |
comment:17
Replying to @embray: Okay, let's go through the problem step by step (and if below is correct, than this has nothing to do with this non-deterministic test, which I still ensure to be correctly working):
I am not to all depth into the context of your issue. But if I must place a bet, your doctest environment has a problem with writing these external files in (6) correctly and this causes the buggy behaviour. Cheers, Christian |
comment:18
What would you mean by "has a problem writing these external files correctly" (or for that matter, by "external")? I can see that the files are being written. One thing I noticed is that they're written to my actual Other than that there's nothing "special" about the environment or with Docker with regard to writing files. |
comment:19
One possible problem could be that multiple tests do Is it correct that you don't have a way to trigger the bug? How often did it happen? Once the file is there, the correct answer should come out of (3) above directly. Have you seen the bug after the file was correctly computed and placed? |
comment:20
Replying to @stumpc5:
If I'm reading the code correctly, the files are written using To debug further, it would be very interesting to know if the problem occurs when testing just a single file or only when testing in parallel. |
comment:21
Replying to @embray:
Assuming of course that there are no bugs in Docker or the OS. |
comment:22
Note: there has been a bug in Sage involving the pexpect interface (don't ask me the number, I think it was reported by Erik) which was only reproducible on Docker. The underlying bug was a genuine race condition involving a So: if anything in this code path involves multiple processes or threads, that's certainly a place to look for bugs. |
comment:23
I don't think there's a bug here in Docker or the OS beyond that fact that it might cause the tests to run in a slightly different order than usual. As I stated in the description this happens when running the tests in parallel, and only sometimes. It can't be reproduced normally. |
comment:24
My choice of direction never makes a useless choice, instead of rejecting backward moves. |
comment:25
Note that my branch also changes the behaviour for rank n=2, where we know that everybody is of finite-mutation-type. So G2 should be handled more gracefully. EDIT: |
Changed commit from |
Changed branch from u/chapoton/22482 to none |
Changed keywords from none to cluster |
When running
sage -t -a -p 0
in the develop Docker container (off a current version of the develop branch) I'm getting:but only sometimes. Seems like maybe a test ordering issue.
CC: @tscrim @stumpc5 @Etn40ff @sagetrac-gmoose05
Component: combinatorics
Keywords: cluster
Author: Frédéric Chapoton
Issue created by migration from https://trac.sagemath.org/ticket/22482
The text was updated successfully, but these errors were encountered: