Return-Path: Delivered-To: apmail-jackrabbit-dev-archive@www.apache.org Received: (qmail 53158 invoked from network); 7 Mar 2008 14:37:19 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 Mar 2008 14:37:19 -0000 Received: (qmail 92725 invoked by uid 500); 7 Mar 2008 14:37:16 -0000 Delivered-To: apmail-jackrabbit-dev-archive@jackrabbit.apache.org Received: (qmail 92354 invoked by uid 500); 7 Mar 2008 14:37:15 -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 92345 invoked by uid 99); 7 Mar 2008 14:37:15 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Mar 2008 06:37:15 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Mar 2008 14:36:23 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 186BD234C0A3 for ; Fri, 7 Mar 2008 06:35:47 -0800 (PST) Message-ID: <1749541203.1204900547099.JavaMail.jira@brutus> Date: Fri, 7 Mar 2008 06:35:47 -0800 (PST) From: "Stefan Guggisberg (JIRA)" To: dev@jackrabbit.apache.org Subject: [jira] Resolved: (JCR-1359) Adding nodes from concurrently running sessions cause exceptions In-Reply-To: <18819407.1201882750304.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/JCR-1359?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Stefan Guggisberg resolved JCR-1359. ------------------------------------ Resolution: Fixed fixed in r634681 > Adding nodes from concurrently running sessions cause exceptions > ---------------------------------------------------------------- > > Key: JCR-1359 > URL: https://issues.apache.org/jira/browse/JCR-1359 > Project: Jackrabbit > Issue Type: Bug > Components: jackrabbit-core > Affects Versions: 1.3.3, 1.4, core 1.4.1 > Reporter: Alexander Nesterov > Assignee: Stefan Guggisberg > Priority: Critical > Fix For: core 1.4.2 > > > Exceptions are thrown when trying to add child nodes to one parent node from different sessions running concurrently. One of the following exceptions is always thrown: > * Exception in thread "Thread-8" java.lang.RuntimeException: javax.jcr.nodetype.ConstraintViolationException: /A/7 needs to be saved as well. > * Exception in thread "Thread-8" java.lang.RuntimeException: javax.jcr.RepositoryException: /A: unable to update item.: Unable to > resolve path for item: 016b885a-64aa-45b9-a990-05cbabb4586f/{http://www.jcp.org/jcr/1.0}primaryType: Unable to resolve path for item: 016b885a-64aa-45b9-a990-05cbabb4586f/{http://www.jcp.org/jcr/1.0}primaryType > According to JCR-584 "Improve handling of concurrent node modifications" the following scenario "session 1 adds or removes child node 'x', session 2 adds or removes child node 'y'" should run gracefully, but the following test constantly fails: > public void testSync() throws Exception > { > Node rootNode = getSession ().getRootNode (); > rootNode.addNode ("A"); > rootNode.save(); > final Session session1 = getRepository().login (new SimpleCredentials ("userName", "password".toCharArray())); > final Session session2 = getRepository().login (new SimpleCredentials ("userName", "password".toCharArray())); > Thread thread1 = new Thread (new Runnable() > { > public void run() > { > try > { > addNodes ("A", session1, 0); > } > catch (RepositoryException ex) > { > throw new RuntimeException (ex); > } > } > }); > Thread thread2 = new Thread (new Runnable() > { > public void run() > { > try > { > addNodes ("A", session2, 1001); > } > catch (RepositoryException ex) > { > throw new RuntimeException (ex); > } > } > }); > thread1.start(); > thread2.start(); > thread1.join(); > thread2.join(); > } > private void addNodes (String parentName, Session session, int startIndex) > throws RepositoryException > { > Node parentNode = session.getRootNode().getNode (parentName); > for (int i = startIndex; i < startIndex + 100; i++) > { > String name = Integer.toString (i); > parentNode.addNode (name); > parentNode.save(); > } > } > BTW: exceptions were also thrown when I tried to add nodes from one thread and remove some of them from another one. Each thread used it's own session, each node had unique name. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.