Mailing List Archive

Bug: Locks does not seem to be release after timeout
On Sun, 2010-03-28 at 22:55 +0200, Michael Rasmussen wrote:
> Hi Andrew,
>
> Seems there are still problems regarding locks since active locks are
> never flushed after timeout.
>
> davical=# select current_timestamp, locks.* from locks;
> now |
> dav_name | opaquelocktoken
> | type | scope | depth | owner | timeout | start
> -------------------------------+----------------------------------------------------------+--------------------------------------+-------+-----------+-------+-------+----------+----------------------------
> 2010-03-28 22:54:17.234297+02
> | /mir/home/libcaldav-5081183482b5b610c7c8c4ffe84e0f72.ics |
> c2666286-cdba-ca44-e555-c91e56af34f6 | write | exclusive | 9999
> | | 00:05:00 | 2010-03-28 21:12:30.129625 (1 row)

Good catch.

Looking at the code it appears that the expiry is not even being
checked. Are you using locks in your application?

Cheers,
Andrew.

------------------------------------------------------------------------
andrew (AT) morphoss (DOT) com +64(272)DEBIAN
You have a deep appreciation of the arts and music.
------------------------------------------------------------------------

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.morphoss.com/pipermail/davical-users/attachments/20100329/f20d8ae9/attachment.pgp>
-------------- next part --------------
Bug: Locks does not seem to be release after timeout [ In reply to ]
On Mon, 29 Mar 2010 12:26:21 +1300
Andrew McMillan <andrew at morphoss.com> wrote:

>
> Looking at the code it appears that the expiry is not even being
> checked. Are you using locks in your application?
>
My application libcaldav uses locking if the server announces support
for locking - OPTIONS.

The basic functionality is present
- LOCK is returning a LOCK-TOKEN provided the resource is not already
locked and creates a row in the lock table
- UNLOCK releases the resource and removes the lock from the lock table

Was is missing is an automatically removable of the lock when it has
expired. A solution:

Create a pre-insert trigger when the following functionality
When a request is made for at lock check if a lock is already active
for the resource. If start + timeout < now update the row and return
the new LOCK-TOKEN otherwise throw an exception.

--
Hilsen/Regards
Michael Rasmussen

Get my public GnuPG keys:
michael <at> rasmussen <dot> cc
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xD3C9A00E
mir <at> datanom <dot> net
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xE501F51C
mir <at> miras <dot> org
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xE3E80917
--------------------------------------------------------------
You will be audited by the Internal Revenue Service.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.morphoss.com/pipermail/davical-users/attachments/20100329/305d4429/attachment.pgp>
-------------- next part --------------