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

🐛 There are Two Instances of the cosmwasm VM running #395

Open
gluax opened this issue Oct 23, 2024 · 2 comments
Open

🐛 There are Two Instances of the cosmwasm VM running #395

gluax opened this issue Oct 23, 2024 · 2 comments
Labels
priority: medium Should be fixed soon type: bug 🐛 Something isn't working

Comments

@gluax
Copy link
Contributor

gluax commented Oct 23, 2024

🐛 Bug Report

There are two instances of the wasmVM for cosmwasm running.

Steps to Reproduce

It's pretty un-noticeable in the current version of the chain.
However, upgrading wasmd and wasmVM to the versions that use the 2.0 version makes it clear when running the chain and trying to upload a contract.

The newer version prevents 2 VM instances from running in the same directory(from migration guide, as well as changelog), meaning we are having two instances running, just the older version doesn't prevent us from doing this.

Code snippet to reproduce

  1. Start the chain(after upgrading wasmd and wasmvm).
  2. Try uploading a contract.

Stack trace & error message

panic: Could not lock exclusive.lock. Is a different VM running in the same directory already?

      goroutine 1 [running]:
      github.com/CosmWasm/wasmd/x/wasm/keeper.NewKeeper({_, _}, {_, _}, {_, _}, {_, _}, {0x43071d0, 0xc0001b7bf8}, ...)
        github.com/CosmWasm/[email protected]/x/wasm/keeper/keeper_cgo.go:75 +0xed2
      github.com/sedaprotocol/seda-chain/app.NewApp({0x43070b0, 0x62771a0}, {0x431e280, 0xc0012d9320}, {0x0, 0x0}, 0x1, 0xc0013c7a10, {0xc0013a4558, 0x12}, ...)
        github.com/sedaprotocol/seda-chain/app/app.go:587 +0x38f4
      github.com/sedaprotocol/seda-chain/cmd/sedad/cmd.NewRootCmd()
        github.com/sedaprotocol/seda-chain/cmd/sedad/cmd/root.go:71 +0x60f
      main.main()
        github.com/sedaprotocol/seda-chain/cmd/sedad/main.go:15 +0x17

Expected Behavior

Uploading the contract should not panic cause there should only be one instance of the VM running.

This could be why #385 is not working as well. Maybe wasmer no longer likes/allows 2 instances of a running VM to touch the same place in memory(on specific architectures??). Not sure TBH.

@gluax gluax added the type: bug 🐛 Something isn't working label Oct 23, 2024
@gluax
Copy link
Contributor Author

gluax commented Oct 23, 2024

I did a bandaid test if doing this would fix #385 without upgrading to cosmwasm 2.0, sadly it did not fix that issue :c

@mariocao mariocao added the priority: medium Should be fixed soon label Oct 30, 2024
@hacheigriega
Copy link
Member

I think implementing dependency injection should resolve this issue by obviating the need to call NewApp twice in root.go. However, the implementation is currently blocked by the lack of support from x/wasm. It seems they will add the support after the v0.52 release CosmWasm/wasmd#1286.

The work in progress has been pushed to the branch hy/depinj. It includes dependency injection support for all our custom modules and an attempt at app wiring.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: medium Should be fixed soon type: bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants