Deadlock?
Keith F Weatherhead
keithw at ddltd.com
Fri Nov 30 10:11:04 PST 2007
On Fri, November 30, 2007 12:05, Del wrote:
> Anybody have an idea how I could get a deadlock situation?
> Two different operators running two different pgms both tried to
> lock the
> same record at the same time (lookup with -p flag).
> They BOTH got the 'waiting for record to be unlocked' message.
> Both sessions hung until I killed one, then the other took off.
> The first one in should get the record, the second should get the
> 'waiting'
> message.
> Is there some stupid thing I am doing that could cause this?
> It seems to me that there is no way I should be able to cause this,
> no matter what I did.
>
> Seeking illumination.
>
> Del
Del,
There are a number of ways to get yourself into a deadlock situation.
The reason can both be because you did not get all of the records
you needed before proceeding -OR- you released some (allowing the
next application to get in there) and then you try to get them back
again.
The problem gets sticky if in order for the 2nd appl to get to the
place where the 1st appl is... the 1st appl would have to release
some "other" record it is currently holding, but it needs to get
access to "what it had previously let go of", in order to complete.
That resource is now being held by the 2nd appl., which cannot go
any farther and the 1st appl is held on the what the 2nd grabbed and
cannot complete.
There they will sit waiting on each other unless the 2nd appl was
structured to give up after a certain period in time allowing the
1st appl to get its needed resource and complete.
1st and 2nd appl in the above can be the same exact process or other
processes following the same path for different reasons. The issue
is determining what records to "get and hold" UNTIL you are done
with them. Otherwise, you are better to release and then re-acquire
again so that if something passes thru, it is free to get in and out
without locking anything up.
This totally depends upon what your process is doing and can data be
corrupted if something could possibly gain access in between steps
of your processing.
Keith
> _______________________________________________
> Filepro-list mailing list
> Filepro-list at lists.celestial.com
> http://mailman.celestial.com/mailman/listinfo/filepro-list
>
--
More information about the Filepro-list
mailing list