EDS Locking Problem?
- Posted by Ted Fines <fines at macalester.edu> Feb 11, 2001
- 444 views
I believe I have found an error in the EDS database locking routine. The problem is that Linux recognizes a Win32 lock on a database, but Win32 ignores a Linux lock. I have two programs running, one on Linux and the other on Win32. They are accessing the same function (they actually include the same db.e file that contains this function) I wrote for db locking which is this (please disregard any comments in the code--they're just there for me): -- returns 0 for lock, something else for no lock. global function dbgetlock(sequence dbname) atom t integer i,attempts attempts=20 -- 20 seconds, actually, not really 20 attempts t=time() while 1 do i=db_open(dbname, DB_LOCK_EXCLUSIVE) if i=DB_LOCK_FAIL then if time()>t+attempts then exit end if elsif i=DB_OK or i=DB_OPEN_FAIL then exit end if sleep(1) -- wait 1 second between attempts end while return i end function I put both of my programs in trace mode, and start the Win32 program. It locks the db. I then step through my Linux program until it tries to lock the DB. It can't. So far so good. I then step through the Win32 program until it releases the db, and return to the Linux program and have it lock the db. The linux program thinks it has it locked, with a DB_OK return value from the above function. But if I step through the Win32 program to when a lock attempt is made on the db, it works! Win32 and Linux then both think they have an exclusive lock. Ideas, anyone? The database in question is on a Novell filesystem. The Linux system has it mounted using ncpmount, and the Win32 system has a drive letter mapped. Thanks, Ted Fines Macalester College