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

Remove directories leftover from improper shutdown so sage-cleaner won't kill random processes #35204

Merged
merged 1 commit into from
Mar 26, 2023

Conversation

tornaria
Copy link
Contributor

📚 Description

From #27769:

Under rare conditions, sage is killed at startup by sage-cleaner.

This requires:

Files left over in ~/.sage/temp/HOSTNAME/PID
A pid in ~/.sage/temp/HOSTNAME/PID/spawned_processes must exist, and be started at init time. Its process group id will be 0

When sage-cleaner tries to clean up, it will do a "kill 0", which will kill sage.

Files will only be left in ~/.sage/temp/HOSTNAME if sage is not shutdown properly. Most likely because of a reboot.

Even if the situation doesn't result on a "kill 0", sage-cleaner would still go on a killing spree for random processes which is awful.

The current PR removes everything under ~/.sage/temp/HOSTNAME/ at sage-cleaner startup so this doesn't happen.

Since sage-cleaner won't run more than once at a time, this seems safe.

Fixes #27769

📝 Checklist

  • I have made sure that the title is self-explanatory and the description concisely explains the PR.
  • I have linked an issue or discussion.

@tornaria
Copy link
Contributor Author

I was hit by this bug and I wasn't able to even start sage. I found the ticket with a ready to review patch. I cherry-picked the commit into my current sage and voila: everything worked.

I looked at the code and comments, and I think it's a good solution so I'm giving it a positive review.

Component: scripts

Keywords: sage-cleaner

Author: Andy Howell

@github-actions
Copy link

Documentation preview for this PR is ready! 🎉
Built with commit: 2b155c7

@codecov-commenter
Copy link

Codecov Report

Base: 88.60% // Head: 88.59% // Decreases project coverage by -0.01% ⚠️

Coverage data is based on head (2b155c7) compared to base (8f5bbd2).
Patch has no changes to coverable lines.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #35204      +/-   ##
===========================================
- Coverage    88.60%   88.59%   -0.01%     
===========================================
  Files         2140     2140              
  Lines       397273   397273              
===========================================
- Hits        352004   351966      -38     
- Misses       45269    45307      +38     
Impacted Files Coverage Δ
src/sage/interfaces/qsieve.py 71.30% <0.00%> (-2.61%) ⬇️
src/sage/graphs/generators/random.py 91.43% <0.00%> (-1.20%) ⬇️
src/sage/schemes/elliptic_curves/hom_velusqrt.py 94.09% <0.00%> (-1.19%) ⬇️
src/sage/coding/channel.py 97.10% <0.00%> (-0.73%) ⬇️
src/sage/modular/modform/numerical.py 94.19% <0.00%> (-0.65%) ⬇️
...sage/geometry/hyperbolic_space/hyperbolic_model.py 88.95% <0.00%> (-0.62%) ⬇️
src/sage/modular/arithgroup/congroup_gamma0.py 94.41% <0.00%> (-0.56%) ⬇️
src/sage/sets/integer_range.py 91.41% <0.00%> (-0.51%) ⬇️
src/sage/graphs/tutte_polynomial.py 93.57% <0.00%> (-0.46%) ⬇️
src/sage/graphs/generic_graph.py 89.12% <0.00%> (-0.46%) ⬇️
... and 19 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@vbraun vbraun merged commit 4676d93 into sagemath:develop Mar 26, 2023
@mkoeppe mkoeppe added this to the sage-10.0 milestone Mar 26, 2023
@tornaria tornaria deleted the sage-cleaner branch April 4, 2023 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sage is killed on startup via sage-cleaner
6 participants