Return-Path: Delivered-To: apmail-jackrabbit-dev-archive@www.apache.org Received: (qmail 62873 invoked from network); 29 Jun 2006 10:35:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 29 Jun 2006 10:35:03 -0000 Received: (qmail 92411 invoked by uid 500); 29 Jun 2006 10:35:02 -0000 Delivered-To: apmail-jackrabbit-dev-archive@jackrabbit.apache.org Received: (qmail 92385 invoked by uid 500); 29 Jun 2006 10:35:02 -0000 Mailing-List: contact dev-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list dev@jackrabbit.apache.org Received: (qmail 92376 invoked by uid 99); 29 Jun 2006 10:35:02 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Jun 2006 03:35:02 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=MSGID_FROM_MTA_HEADER X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [216.133.69.8] (HELO g2.mailwallremote.com) (216.133.69.8) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Jun 2006 03:35:00 -0700 Received: from mail pickup service by g2.mailwallremote.com with Microsoft SMTPSVC; Thu, 29 Jun 2006 11:33:30 +0100 Message-ID: <44A3AC2C.9010507@grahamtechnology.com> X-Apparently-To: dev@jackrabbit.apache.org x-mailwall-from: Rod.Mackenzie@grahamtechnology.com x-mailwall-procid: 16513219 Received: from mailhost.grahamtech.co.uk ([62.253.177.169]) by g2.mailwallremote.com with Microsoft SMTPSVC(5.0.2195.6713); Thu, 29 Jun 2006 11:32:23 +0100 Received: from atlantis.inchinnan.grahamtech.co.uk (atlantis.inchinnan.grahamtech.co.uk [10.77.62.1]) by mailhost.grahamtech.co.uk (Postfix) with ESMTP id 7B45B44710 for ; Thu, 29 Jun 2006 11:57:27 +0100 (BST) Received: from [10.77.40.158] (dhcp158.dev_test_pub.inchinnan.grahamtech.co.uk [10.77.40.158]) by atlantis.inchinnan.grahamtech.co.uk (Postfix) with ESMTP id 11057107DE for ; Thu, 29 Jun 2006 11:32:22 +0100 (BST) Date: Thu, 29 Jun 2006 11:32:12 +0100 From: "Rod Mackenzie" X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1807 User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) MIME-Version: 1.0 To: Subject: Re: Node locked LockException References: <66c10f230606290044w281b8ca0w2762943a8d5e56dc@mail.gmail.com> In-Reply-To: <66c10f230606290044w281b8ca0w2762943a8d5e56dc@mail.gmail.com> Content-Type: text/plain; format=flowed; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 29 Jun 2006 10:32:23.0890 (UTC) FILETIME=[4F2CA320:01C69B67] X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hi, I came across this problem a few weeks ago and submitted a JIRA issue 441. I would suggest removing the lock tokens on a logout would be better than throwing an exception when trying to modify the node. There is still a LockInfo object with a reference to the old session and as far as I can tell no way to remove it except with a restart. regards, Rod Dominique Pfister wrote: > Hi David, > > the JCR 1.0 specification is not explicit about the behaviour of > open-scoped locks when the session currently holding the lock logs > out. Jackrabbit clears the lock holder for the first, owning session, > if it hasn't been changed, but not for other sessions that receive the > lock token, which is definitely strange behaviour. So your test case > should either throw when session2 sets the property (because the lock > token has not been explicitely removed from session1) or never > (because the lock token will always be silently removed from a session > logging out). Please submit a JIRA issue. > > Kind Regards > Dominique > > On 6/29/06, David Kennedy wrote: >> I believe there is a bug in the LockManagerImpl class with regard to >> LockToken management. The problem is that the LockInfo listener of the >> Session is lost. I believe the LockManagerImpl::lockTokenAdded method >> sets the lockHolder to the session, but doesn't add the LockInfo as a >> listener of the session to clear out the lockHolder when the session is >> logging out. >> >> if (info.getLockHolder() == null) { >> info.setLockHolder(session); >> } else { >> >> should be >> >> if (info.getLockHolder() == null) { >> session.addListener(info); //info must be a >> LockInfo, not an AbstraceLockInfo >> info.setLockHolder(session); >> } else { >> >> similarly for LockManagerImpl::lockTokenRemoved....it should remove the >> LockInfo from the session listener list. >> >> Normally the listener is added in LockManagerImpl::internalLock, however >> when the lock token is added to another session, the internalLock method >> is not invoked. >> >> Here is a testcase that should evoke the exception....the exception >> should >> occur on the setProperty in session3. >> >> try { >> //Register the repository in JNDI >> Hashtable env = new Hashtable(); >> env.put(Context.INITIAL_CONTEXT_FACTORY, >> "org.apache.jackrabbit.core.jndi.provider.DummyInitialContextFactory"); >> env.put(Context.PROVIDER_URL, "localhost"); >> InitialContext ctx = new InitialContext(env); >> RegistryHelper.registerRepository(ctx, "localRep", >> "repository.xml", >> ".", false); >> Repository rep = (Repository)ctx.lookup("localRep"); >> >> String userid = "user"; >> String password = "password"; >> String nodeName = "testLockTokens"; >> >> Session session1 = rep.login(new SimpleCredentials(userid, >> password.toCharArray())); >> Node root = session1.getRootNode(); >> Node testNode = root.addNode(nodeName, "nt:unstructured"); >> testNode.addMixin("mix:lockable"); >> testNode.setProperty("foo", "session1"); >> session1.save(); >> Lock lock = testNode.lock(false, false); >> String token = lock.getLockToken(); >> session1.logout(); >> >> Session session2 = rep.login(new SimpleCredentials(userid, >> password.toCharArray())); >> session2.addLockToken(token); >> root = session2.getRootNode(); >> testNode = root.getNode(nodeName); >> testNode.setProperty("foo", "session2"); >> session2.save(); >> session2.logout(); >> >> Session session3 = rep.login(new SimpleCredentials(userid, >> password.toCharArray())); >> session3.addLockToken(token); >> root = session3.getRootNode(); >> testNode = root.getNode(nodeName); >> testNode.setProperty("foo", "session3"); >> session3.save(); >> session3.logout(); >> >> Session session4 = rep.login(new SimpleCredentials(userid, >> password.toCharArray())); >> root = session4.getRootNode(); >> testNode = root.getNode(nodeName); >> testNode.remove(); >> session4.save(); >> } catch (Exception e){ >> e.printStackTrace(); >> } >> >> >> David >> > > ________________________________________________________________________________ This email (and any attachments) is private and confidential, and is intended solely for the addressee. If you have received this communication in error please remove it and inform us via telephone or email. Although we take all possible steps to ensure mail and attachments are free from malicious content, malware and viruses, we cannot accept any responsibility whatsoever for any changes to content outwith our administrative bounds. The views represented within this mail are solely the view of the author and do not reflect the views of the organisation as a whole. ________________________________________________________________________________ Graham Technology plc http://www.grahamtechnology.com ________________________________________________________________________________