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

Add timeout to create #39

Merged
merged 2 commits into from
Jan 4, 2024
Merged

Add timeout to create #39

merged 2 commits into from
Jan 4, 2024

Conversation

codchen
Copy link
Collaborator

@codchen codchen commented Jan 3, 2024

Certain inputs may cause vm.create to take an indefinite amount of time, effectively leaving the chain in a hanging state. This PR adds a 5-second timeout to create. This is a bandaid fix. The real fix will be in CosmWasm's Jan release.

Tested with local sei using:
seid tx wasm store ~/Downloads/exp.wasm --from admin --gas 35000000 --fees 30000000usei -y -b block
Screen Shot 2024-01-03 at 5 53 44 PM

@codchen codchen requested review from philipsu522, yzang2019 and udpatil and removed request for yzang2019 January 3, 2024 09:56
Comment on lines +33 to +36
go func() {
checksum, err = w.WasmerEngine.Create(code)
done <- struct{}{}
}()

Check notice

Code scanning / CodeQL

Spawning a Go routine Note

Spawning a Go routine may be a possible source of non-determinism

"github.com/CosmWasm/wasmd/x/wasm/types"
wasmvm "github.com/CosmWasm/wasmvm"
wasmvmtypes "github.com/CosmWasm/wasmvm/types"
)

const CreateTimeout time.Duration = 5 * time.Second
Copy link
Contributor

Choose a reason for hiding this comment

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

5 seconds seems pretty low timeout

@philipsu522 philipsu522 merged commit e172ac5 into main Jan 4, 2024
1 check passed
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.

3 participants