SnappyDB icon indicating copy to clipboard operation
SnappyDB copied to clipboard

Failed to open/create database: IO error: lock

Open winsonlim opened this issue 10 years ago • 6 comments

Hi,

I'm facing some concurrency issue whereby my threads are accessing the dB concurrently. Is there a snapshot created everytime the dB is opened?

com.snappydb.SnappydbException: Failed to open/create database: IO error: lock LOCK: already held by process

winsonlim avatar Aug 20 '14 10:08 winsonlim

Hi @winsonlim

usually the thread that opens the database will lock it. you can not open it again from another Thread until you close it. but nothing prevent you from sharing the same DB instance across multiple threads (or through a Singleton)

It'd be cool, if you can share some code that reproduce this though, I'll take a look

Cheers

nhachicha avatar Aug 21 '14 12:08 nhachicha

This just bit me. I am trying to open the DB in another process for reading. I don't need to write or anything, just read some stuff that is being written in the main process. Is there a workaround?

thedumbtechguy avatar Oct 23 '14 13:10 thedumbtechguy

How performant is the open close process? I'd like to open when needed and close when done so I can use in my service process. I perform a lot of operations especially read, would this be impact performance?

thedumbtechguy avatar Oct 24 '14 08:10 thedumbtechguy

I met the same problem ~I am trying to open the DB in another process for reading. I don't need to write or anything, just read some stuff that is being written in the main process~

Failed to open/create database: IO error lock LOCK:

EvilsoulM avatar Oct 29 '14 09:10 EvilsoulM

@frostymarvelous what was your resolve on this issue?

sirvon avatar Jan 22 '15 11:01 sirvon

I moved my service code into the same process.

thedumbtechguy avatar Jan 22 '15 17:01 thedumbtechguy