onflow/flow-emulator

Cannot use --persist flag when running emulator

Closed this issue · 18 comments

Instructions

When using the flow emulator with the persist flag the emulator crashes on launch on windows 10.

Problem

Whenever i specify the --persist flag when running the emulator i get the error: "Failed to configure storage" error="failed to initialize Badger store: entry not found"

Steps to Reproduce

Simply running the command:

flow emulator --persist

Causes the issue

Context

Currently working on building a dapp for my thesis, and would like to use the emulator to validate my contracts before trying the testnet. Current workaround is to use flow playground.

Looks like this is a Windows-specific issue. We will test it out and try to provide the fix. Thank you for the report.

@heyitslamer can you try with flow emulator --persist --dbpath .flowdb

Error continues @bluesign

imagem

Will add that the folder itself (flowdb) is created but i keep getting the error every time i use the persist flag.

@heyitslamer did you try to remove the folder between restarts? What is the content of the db folder?

I tried just now removing the folder and running again, the error continues @sideninja

The folder holds 3 files has shown
imagem

I think this is due to it expecting your flowdb folder to be in a git repository I think. If I understand it correctly, before starting badger it tries to do a git commit on that folder and if that fails, it bails. I just have newCommit return nil immediately and it works for me.

In storage/badger/store.go edit new commit to be:

func (s *Store) newCommit(message string) error {
return nil
}

@Niosop the folder is inside a git repository

@heyitslamer is this problem still persisting?

tried on v0.38.1 and the error still persists

I'm also running into this. Any idea what needs to be done here?

@spacepluk do you also run this on windows?

I think we should disable snapshot for windows, I debugged this little bit recently. First badger on windows is creating a huge binary file, also if project is under source control ( with git ) , git is failing somehow. Not sure if big size or the git is the responsible for the failure though.

@sideninja maybe we can separate snapshot support and persist ?

Yes, I think separating that feature might be a nice idea.

@spacepluk do you also run this on windows?

Yeah! we make games and most of the team is running windows. Right now I'm disabling --persist when running our devscripts on windows but it makes testing the game a lot harder because you have to start over every time and there's some data in a database that has to be in sync with the blockchain state.

Happy to assist with any testing that might be needed.

@bluesign are you willing to tackle this or should I?

I can tackle this in the weekend for sure @sideninja

Closed with #190

We can close this issue