Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread Problem with table locking
Tue, Apr 3 2007 7:14 AMPermanent Link

adam
Dear All,

DBISAM V4.24 + Delphi 6 / Win32.

I have a weird one, I am sure its my problem ... but I'd like to know the source of it.

Occasionally my program crashes directly after an insert is called on a table (this is
just random, not because of the insert, it is an unrelated problem).

This leaves an "open" session on the DBServer, which seems to hold a lock on the table.

This lock stops anyone else from inserting records into the table. Further, this lock
persists even after I open the DBAdmin utility & forceably disconnnect the "trailing" open
session from the crashed program. The only way round is a total re-boot ... which is
pretty unprofessional (;-0.

--

I am cool with everything up to the point at which the table is still locked, even though
the session has been disconnected. At this point even though there is no session
registered on DBAdmin I still can't either insert a record into the table or (rather
critically) repair it. I get a "table or backup file is locked" error message. Surely
after DBAdmin has forceably disconnected the trailing open session the table ought to be
unlocked?? Or at least made available enough for a repair to function?

Of course I am looking to improve my coding to remove the insert / crash problem in the
first place, but I would also like to know how to unlock a table which is in this state.

Adam




Tue, Apr 3 2007 9:13 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Adam,

Inserts don't acquire locks until the Post phase, which is completely
handled at the server and always completes.  Therefore, it is impossible for
an Insert to cause any locking.  Only Edits with pessmistic locking obtain
locks that can persist after a client has disconnected and not Posted the
Edit.

<< This lock stops anyone else from inserting records into the table.
Further, this lock persists even after I open the DBAdmin utility &
forceably disconnnect the "trailing" open session from the crashed program.
The only way round is a total re-boot ... which is pretty unprofessional
(;-0. >>

Are you completely removing the session, or simply disconnecting it ?
Disconnecting it will not remove record locks obtained through an Edit, only
removing the session will do so.

--
Tim Young
Elevate Software
www.elevatesoft.com

Tue, Apr 3 2007 2:57 PMPermanent Link

adam
hum, the code I am using is a bit complicated, it is possible that a POST is called after
the insert to ensure the Auto-inc ID field is populated. So that would explain the locking.

The lock is definitely persisting after I "completely remove" the session from the DBAdmin
server, I first disconnect, then remove the session, so there is not any user visible in
the "users" list in DBAdmin. Despite this I cannot either insert a new record into the
table in DBSys, or Repair the table.

Shall I try to generate the behaviour & then email you the table??

Wed, Apr 4 2007 5:39 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Adam,

<< hum, the code I am using is a bit complicated, it is possible that a POST
is called after the insert to ensure the Auto-inc ID field is populated. So
that would explain the locking. >>

Yep, an Insert/Post/Edit would be why the record lock is hanging around.

<< The lock is definitely persisting after I "completely remove" the session
from the DBAdmin server, I first disconnect, then remove the session, so
there is not any user visible in the "users" list in DBAdmin. Despite this I
cannot either insert a new record into the table in DBSys, or Repair the
table. >>

Outstanding record locks wouldn't block any new inserts into a table.  Are
there any transactions in effect ?

Also, what is the exact error message that you're getting with the error
code ?

--
Tim Young
Elevate Software
www.elevatesoft.com

Image