Skip to content
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

Singular interface (and possibly others) can lose synchronization due to GC #955

Closed
sagetrac-cwitty mannequin opened this issue Oct 21, 2007 · 5 comments
Closed

Comments

@sagetrac-cwitty
Copy link
Mannequin

sagetrac-cwitty mannequin commented Oct 21, 2007

I'm going to describe the problem in terms of the Singular interface, but I think probably at least some other interfaces are similarly vulnerable.

The bad sequence of events is:

  1. Some Singular computation is requested, by calling Singular.eval().

  2. Singular.eval() calls Expect.eval().

  3. Expect.eval() sends a command to Singular, to perform the requested computation.

  4. A Python garbage collection is triggered.

  5. One of the collected objects is a Singular wrapper object (of type SingularElement).

  6. Singular.clear() is called on this object.

  7. Singular.clear() calls Singular.eval() to kill the Singular variable corresponding to this object.

  8. Singular.eval() calls Expect.eval().

  9. Expect.eval() sends the kill command to Singular.

  10. Expect.eval() waits for a response from Singular. Unfortunately, the next response it sees from Singular is the response to the command sent in step 3), from the mathematical computation.

  11. Expect.eval() returns this response to Singular.eval().

  12. Singular.eval() returns this response to Singular.clear().

  13. Singular.clear() discards the response.

  14. Garbage collection completes.

  15. Expect.eval() waits for a response from Singular. Unfortunately, the next response it sees from Singular is the null response from the kill command.

  16. Expect.eval() returns this response to Singular.eval().

  17. Singular.eval() returns this null response as the result of the requested computation.

I'll attach two log files to this ticket; log7027 shows the interface working, and log7028 shows the interface failing because the print(sage10); command is interrupted by the command to kill sage7.

Component: interfaces

Issue created by migration from https://trac.sagemath.org/ticket/955

@sagetrac-cwitty sagetrac-cwitty mannequin added this to the sage-2.8.9 milestone Oct 21, 2007
@sagetrac-cwitty
Copy link
Mannequin Author

sagetrac-cwitty mannequin commented Oct 21, 2007

Attachment: log7027.gz

@sagetrac-cwitty
Copy link
Mannequin Author

sagetrac-cwitty mannequin commented Oct 21, 2007

Attachment: log7028.gz

@williamstein
Copy link
Contributor

comment:1

See rings/morphism.pyx for an example of this that is # not tested right now.

@sagetrac-mabshoff sagetrac-mabshoff mannequin modified the milestones: sage-2.8.9, sage-2.8.10 Oct 25, 2007
@sagetrac-cwitty sagetrac-cwitty mannequin assigned sagetrac-cwitty and unassigned williamstein Oct 25, 2007
@sagetrac-cwitty
Copy link
Mannequin Author

sagetrac-cwitty mannequin commented Oct 25, 2007

comment:4

Release 2.8.8 had a patch for this that fixed most or all of the issues with Singular. However, other interfaces are still vulnerable to the same problem. All interfaces should be audited and fixed.

@sagetrac-cwitty
Copy link
Mannequin Author

sagetrac-cwitty mannequin commented Oct 27, 2007

comment:5

Attachment: 7176.patch.gz

I've fixed several places that looked slightly dubious, although I could have missed something.

The attached patch will be in 2.8.10.

@sagetrac-cwitty sagetrac-cwitty mannequin closed this as completed Oct 27, 2007
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant