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

DIMACS sat solver leaves junk files in /tmp folder #38328

Open
2 tasks done
seblabbe opened this issue Jul 2, 2024 · 0 comments · May be fixed by #38333
Open
2 tasks done

DIMACS sat solver leaves junk files in /tmp folder #38328

seblabbe opened this issue Jul 2, 2024 · 0 comments · May be fixed by #38333
Labels

Comments

@seblabbe
Copy link
Contributor

seblabbe commented Jul 2, 2024

Steps To Reproduce

sage: for _ in range(1000):
....:     s = SAT('glucose')
....:     s.add_clause((1000,10))
....:     _ = s()
....:     del s
....:     

Expected Behavior

sage: tmp_filename('AAAAAA')
'/tmp/tmp8tkni7g0/AAAAAAw9zty138'
sage: ls /tmp/tmp8tkni7g0/
AAAAAAw9zty138
sage: for _ in range(10):
....:     s = SAT('glucose')
....:     s.add_clause((1000,10))
....:     _ = s()
....:     del s
....:     
sage: ls /tmp/tmp8tkni7g0/
AAAAAAw9zty138

Actual Behavior

Files remain in the tmp folder:

sage: tmp_filename('AAAAAA')
'/tmp/tmp8tkni7g0/AAAAAAw9zty138'
sage: ls /tmp/tmp8tkni7g0/
AAAAAAw9zty138
sage: 
sage: for _ in range(10):
....:     s = SAT('glucose')
....:     s.add_clause((1000,10))
....:     _ = s()
....:     del s
....:     
sage: ls /tmp/tmp8tkni7g0/
AAAAAAw9zty138  tmp__9688b61  tmp_j6m8wx1d  tmp_yfyquecu
tmp_130r60ii    tmp_97giqg02  tmp_rq5xdtoa  tmp_z6knu_hr
tmp_1hbs_ysf    tmp_hun_mc3u  tmp_v5h_3r_b

These file add up to 20 GB of memory on a problem (involving lots of sat instances) I was recently looking at.

Additional Information

Here is one way to fix it (os.unlink):

sage: tmp_filename('AAAAAA')
'/tmp/tmp8tkni7g0/AAAAAAw9zty138'
sage: ls /tmp/tmp8tkni7g0/
AAAAAAw9zty138
sage: 
sage: for _ in range(10):
....:     s = SAT('glucose')
....:     s.add_clause((1000,10))
....:     _ = s()
....:     os.unlink(s._headname)
....:     del s
....:     
sage: ls /tmp/tmp8tkni7g0/
AAAAAAw9zty138

Environment

- **OS**: Ubuntu 18.04
- **Sage Version**: 10.4.beta9, Release Date: 2024-06-09

Checklist

  • I have searched the existing issues for a bug report that matches the one I want to file, without success.
  • I have read the documentation and troubleshoot guide
@seblabbe seblabbe added the t: bug label Jul 2, 2024
@seblabbe seblabbe linked a pull request Jul 3, 2024 that will close this issue
5 tasks
vbraun pushed a commit to vbraun/sage that referenced this issue Jul 20, 2024
    
In the method `DIMACS.__del__`, we delete the temporary file created in
the `DIMACS.__init__` method.

This fixes sagemath#38328.

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [x] I have created tests covering the changes.
- [x] I have updated the documentation and checked the documentation
preview.
    
URL: sagemath#38333
Reported by: Sébastien Labbé
Reviewer(s): Marc Mezzarobba
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant