sedaprotocol / seda-chain

SEDA chain network
GNU General Public License v3.0
18 stars 10 forks source link

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

Open gluax opened 1 month ago

gluax commented 1 month ago

🐛 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/wasmd@v0.53.0/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 commented 1 month ago

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