Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Berkely DB > Re: Release Loc...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 3 Topic 1761 of 1804
Post > Topic >>

Re: Release Locks on Application exit

by rohithravi@[EMAIL PROTECTED] Aug 6, 2007 at 01:01 AM

On Aug 4, 9:15 am, Don Anderson <don.ander...@[EMAIL PROTECTED]
> wrote:
> On Jul 25, 12:05 am, rohithr...@[EMAIL PROTECTED]
 wrote:
>
> > For getting  lock am using the lock_vec method of DbEnv. If one
> > application locks certain objects and it exits without releasing the
> > locks, the Lock remains on those objects. The other application still
> > finds a lock on these objects.
>
> This is true.
>
> > Is there any option to release all the locks when the process exits?
>
> Not exactly, but you can achieve pretty much the same effect using
> DB_ENV->failchk().
> The idea is that each participating process and/or thread has a unique
> id (this is usually
> just the process id and thread id) and registers these ids using
> DB_ENV->set_thread_id().  Then you may have a monitor process (or
> the monitoring can in fact be distributed among several processes or
> threads).
> This monitor would call periodically call DB_ENV->failchk -- failchk
> uses a previously
> established 'isalive' callback to determine if any of the threads or
> processes
> have in fact died.  If so, the locks associated with those threads or
> processes
> are released, and ongoing transactions associated with them are
> aborted.
>
> The monitoring doesn't have to be strictly polling behavior either.
> If you have some way
> to quickly detect a process or thread failure (possibly a parent
> process calling
> UNIX wait()), you can call failchk immediately and effectively release
> the locks
> immediately.
>
> You must explicitly do a small bit of work to set this up, but it
> should completely
> solve the problem of failed processes or threads holding on to locks.
>
> - Don Anderson

Ya, I checked the failchk method. But am worried about the
performance.
In the isalive callback function I uses OpenProcess, OpenThread APIs
for checking the validity of PID and TID.
If the processes and threads using the locks and transactions are
increasing, i think the failchk method may be time consuming.

Also i feel that, when the thread is returned without releasing the
locks, the failchk has no affect on the locks done in that thread.
When i terminated the thread (used TerminateThread API) failchk is
releasing the locks done in that thread.
 




 3 Posts in Topic:
Release Locks on Application exit
rohithravi@[EMAIL PROTECT  2007-07-25 04:05:23 
Re: Release Locks on Application exit
Don Anderson <don.ande  2007-08-03 17:15:17 
Re: Release Locks on Application exit
rohithravi@[EMAIL PROTECT  2007-08-06 01:01:08 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Sep 5 7:19:37 CDT 2008.