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

DBreeze.Exceptions.DBreezeException: Creation of the database folder failed! ---> DBreeze.Exceptions.DBreezeException: Database is not operable, please find out the problem and restart the engine! FSR INIT FAILED #59

Closed
AbdisamadMoh opened this issue Sep 23, 2019 · 5 comments

Comments

@AbdisamadMoh
Copy link

AbdisamadMoh commented Sep 23, 2019

DBreeze.Exceptions.DBreezeException: Creation of the database folder failed! ---> DBreeze.Exceptions.DBreezeException: Database is not operable, please find out the problem and restart the engine! FSR INIT FAILED: C:\Users\user\Documents\Visual Studio 2015\Projects\chat\chat\App_Data/D12345/Message/MessageID/Abdi\_DBreezeSchema ---> System.IO.IOException: The process cannot access the file 'C:\Users\user\Documents\Visual Studio 2015\Projects\chatchat\App_Data\D12345\Message\MessageID\Abdi\_DBreezeSchema' because it is being used by another process.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
   at DBreeze.Storage.FSR.InitFiles()
   --- End of inner exception stack trace ---
   at DBreeze.Storage.FSR.InitFiles()
   at DBreeze.Storage.FSR..ctor(String fileName, TrieSettings trieSettings, DBreezeConfiguration configuration)
   at DBreeze.Storage.StorageLayer..ctor(String fileName, TrieSettings trieSettings, DBreezeConfiguration configuration)
   at DBreeze.Scheme.OpenSchema()
   at DBreeze.Scheme..ctor(DBreezeEngine DBreezeEngine)
   at DBreeze.DBreezeEngine.InitDb()
   --- End of inner exception stack trace ---
   at DBreeze.DBreezeEngine.InitDb()
   at DBreeze.DBreezeEngine..ctor(String DBreezeDataFolderName)
   at Chat.Main.Main.SendMessage(String _Id, String _msg, String _from, String _to) in C:\Users\user\Documents\Visual Studio 2015\Projects\chat\chat\Main\Main.cs:line 60

Am getting that error and its seems with file inaccessibility. It happens when i try to concurrently write or read database file from different Threads(From different Instant of DBreezeEngine). Im using ASP.NET Webforms and every request will have different Instant of DBreezeEngine.

I tried to use DBIsoperable but the error happens before it.

Is there away to concurrently read/write db file from different DBreezeEngine instant?

@hhblaze
Copy link
Owner

hhblaze commented Sep 23, 2019

Clear, the problem is that DBEngine should be a static variable and must be instantiated only once somewhere in static class. Then you can use this static engine on each page while its rendering. Rule: engine must be instantiated only once and used within the whole program life cycle from different threads.

@hhblaze hhblaze closed this as completed Sep 23, 2019
@AbdisamadMoh
Copy link
Author

That worked well. Thank you very much

@shapuday
Copy link

how do i put DBEngine to static variable?

@hhblaze
Copy link
Owner

hhblaze commented May 30, 2024

how do i put DBEngine to static variable?

Initialize once and access this DBEngine type variable from the whole software - that is all you need.

@shapuday
Copy link

how do i put DBEngine to static variable?

Initialize once and access this DBEngine type variable from the whole software - that is all you need.

idunno how to do that i just want to work my ds3 controller on my pc

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

No branches or pull requests

3 participants