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

Fix temp dir creation #2018

Merged
merged 2 commits into from
Oct 29, 2024
Merged

Fix temp dir creation #2018

merged 2 commits into from
Oct 29, 2024

Conversation

chipshort
Copy link
Collaborator

fixes #2017

Looks like most chains copied this code for their wasmd integration.
We should probably inform them about this change.

@@ -260,7 +260,6 @@ var tempDir = func() string {
if err != nil {
panic("failed to create temp dir: " + err.Error())
}
defer os.RemoveAll(dir)
Copy link
Collaborator Author

@chipshort chipshort Oct 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This defer call just immediately removed the folder after being created. This causes wasmvm to create the folder again and then it is never deleted. Over time that leads to a lot of temp folders accumulating when people run the cli.
What we actually want to do (and what is implemented in this PR) is to remove it after we are done with it.

@chipshort chipshort requested a review from pinosu October 28, 2024 14:04
Copy link
Contributor

@pinosu pinosu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 👍
As you said, we need to communicate it to the chains.
Maybe we could add a comment explaining why we need it etc. WDYT?

@chipshort
Copy link
Collaborator Author

Sounds good. I added a comment.

Copy link
Contributor

@pinosu pinosu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! LGTM 👍

@chipshort chipshort merged commit 88cba83 into main Oct 29, 2024
9 of 12 checks passed
@chipshort chipshort deleted the co/fix-tmp-dir branch October 29, 2024 14:43
Copy link

codecov bot commented Oct 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 48.81%. Comparing base (028261c) to head (8df66c4).
Report is 5 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2018      +/-   ##
==========================================
+ Coverage   48.79%   48.81%   +0.01%     
==========================================
  Files          65       65              
  Lines       10079    10079              
==========================================
+ Hits         4918     4920       +2     
+ Misses       4726     4725       -1     
+ Partials      435      434       -1     

see 1 file with indirect coverage changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: SDK binary creates a bunch of spam folders in /tmp
2 participants