Return-Path: X-Original-To: apmail-openjpa-dev-archive@www.apache.org Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2E5D0E38F for ; Fri, 8 Feb 2013 11:09:15 +0000 (UTC) Received: (qmail 77589 invoked by uid 500); 8 Feb 2013 11:09:15 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 77406 invoked by uid 500); 8 Feb 2013 11:09:14 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 77291 invoked by uid 99); 8 Feb 2013 11:09:12 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Feb 2013 11:09:12 +0000 Date: Fri, 8 Feb 2013 11:09:12 +0000 (UTC) From: "Guillaume Chauvet (JIRA)" To: dev@openjpa.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (OPENJPA-2330) Stackoverflow due to endless recursive calls MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/OPENJPA-2330?page=3Dcom.atlassi= an.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D13= 574395#comment-13574395 ]=20 Guillaume Chauvet commented on OPENJPA-2330: -------------------------------------------- Hello, So sorry I was not able to provide you with more detailed information from = the start, but unfortunately I didn't have the time yesterday as we are app= roaching deadline for release of new software. I am working on creating a unit test, however I will not be able to provide= it straight away as I haven't been able to reproduce the bug, even though = our software crashes systematically. So I think I will first create a patch for our version of OpenJPA to rectif= y the problem, then generate the unit test(s), as with the last bug report = I made. The environment we use is OpenJPA 2.2.1 in a thick client Swing (JRE 1.6_39= 64 bits). We operate an Apache Derby 10.8.2.2 database in client/server mo= de. Belowlisted the scenario in which the problematic memory overflow occurs in= our application: =20 Prerequisites: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D - 3 classes of entities "EntityA", "EntityB", "EntityC" - bidirectional navigation between classes: - Cardinality OneToMany between EntityA and EntityB with th= e following parameters: fetch =3D FetchType.EAGER, mappedBy =3D "entitya", = orphanRemoval =3D true, cascade =3D CascadeType.ALL - Cardinality OneToMany between EntityB and EntityC with th= e following parameters: fetch =3D FetchType.EAGER, mappedBy =3D "entityb", = orphanRemoval =3D true, cascade =3D CascadeType.ALL - EntityC is associated with alot of other tables, which I = won't list for now. =20 =20 Parameterization of OpenJPA: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Representation of the entity linking=20 A1 -> [B1 -> [C1, C2]] A2 -> [B2 -> [C3]] =20 =20 Scenario: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 1) 2 new instances of EntityC "C4" & "C5" type occurrences are inserted int= o entity B2: * State of the graph following insertion: A1 -> [B1 -> [C1, C2]] A2 -> [B2 -> [C3, C4, C5]] =20 2) Only entities A1 & A2 are persisted in two consecutive transactions.=20 =3D> First persist on entity A1 * State of the graph following commit: A1 -> [B1 -> [C1, C2]] A2 -> [B2 -> []] =3D> C3 was deleted during= the first persist (new problem which we hadn't remarked yesterday). =20 =3D> Second persist on entity A2 * State of the graph following insertion: A1 -> [B1 -> [C1, C2]] A2 -> [B2 -> [C4, C5]] =3D> Memory overf= low, causing loss of entities C4, C5. Urgent solution =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D We are going to create a homemade corrective patch in order to mark the rel= ations crossed between entities in the =C2=ABOpenJPAPersistenceUtil =C2=BB= class in order to avoid all looping. =20 > Stackoverflow due to endless recursive calls > -------------------------------------------- > > Key: OPENJPA-2330 > URL: https://issues.apache.org/jira/browse/OPENJPA-2330 > Project: OpenJPA > Issue Type: Bug > Affects Versions: 2.2.0, 2.2.1 > Reporter: Guillaume Chauvet > Priority: Critical > > We wish to report another bug that generates a memory overflow resulting = in an infinite recursive loop. Here are two stacktraces apparently from the= same bug: > First stacktrace sample : > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > Exception in thread "AWT-EventQueue-0" java.lang.StackOverflowError > =09at java.util.LinkedHashMap$KeyIterator.(LinkedHashMap.java:383) > =09at java.util.LinkedHashMap$KeyIterator.(LinkedHashMap.java:383) > =09at java.util.LinkedHashMap.newKeyIterator(LinkedHashMap.java:396) > =09at java.util.HashMap$KeySet.iterator(HashMap.java:874) > =09at java.util.HashSet.iterator(HashSet.java:153) > =09at org.apache.openjpa.util.java$util$LinkedHashSet$proxy.iterator(Unkn= own Source) > =09at java.util.AbstractCollection.toArray(AbstractCollection.java:120) > =09at org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoadedColle= ction(OpenJPAPersistenceUtil.java:240) > =09at org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoadedField= (OpenJPAPersistenceUtil.java:212) > =09at org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoaded(Open= JPAPersistenceUtil.java:161) > =09at org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoadedArray= (OpenJPAPersistenceUtil.java:265) > =09at org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoadedColle= ction(OpenJPAPersistenceUtil.java:242) > =09at org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoadedField= (OpenJPAPersistenceUtil.java:212) > =09at org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoaded(Open= JPAPersistenceUtil.java:161) > =09at org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoadedField= (OpenJPAPersistenceUtil.java:223) > =09at org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoaded(Open= JPAPersistenceUtil.java:161) > =09at org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoadedField= (OpenJPAPersistenceUtil.java:223) > =09at org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoaded(Open= JPAPersistenceUtil.java:161) > =09at org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoadedArray= (OpenJPAPersistenceUtil.java:265) > =09at org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoadedColle= ction(OpenJPAPersistenceUtil.java:242) > =09at org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoadedField= (OpenJPAPersistenceUtil.java:212) > =09at org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoaded(Open= JPAPersistenceUtil.java:161) > =09at org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoadedField= (OpenJPAPersistenceUtil.java:223) > =09at org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoaded(Open= JPAPersistenceUtil.java:161) > [...] > Second stacktrace sample : > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > Exception in thread "AWT-EventQueue-0" java.lang.StackOverflowError > =09at java.util.HashMap$EntrySet.size(HashMap.java:963) > =09at org.apache.openjpa.util.ProxyMaps$ProxyEntrySetImpl.size(ProxyMaps.= java:255) > =09at java.util.AbstractCollection.toArray(AbstractCollection.java:119) > =09at org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoadedMap(O= penJPAPersistenceUtil.java:288) > =09at org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoadedField= (OpenJPAPersistenceUtil.java:215) > =09at org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoaded(Open= JPAPersistenceUtil.java:161) > =09at org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoadedArray= (OpenJPAPersistenceUtil.java:265) > =09at org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoadedColle= ction(OpenJPAPersistenceUtil.java:242) > =09at org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoadedField= (OpenJPAPersistenceUtil.java:212) > =09at org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoaded(Open= JPAPersistenceUtil.java:161) > =09at org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoadedArray= (OpenJPAPersistenceUtil.java:265) > =09at org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoadedColle= ction(OpenJPAPersistenceUtil.java:242) > =09at org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoadedField= (OpenJPAPersistenceUtil.java:212) > =09at org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoaded(Open= JPAPersistenceUtil.java:161) > =09at org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoadedField= (OpenJPAPersistenceUtil.java:223) > =09at org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoaded(Open= JPAPersistenceUtil.java:161) > =09at org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoadedField= (OpenJPAPersistenceUtil.java:223) > =09at org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoaded(Open= JPAPersistenceUtil.java:161) > [...] -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrato= rs For more information on JIRA, see: http://www.atlassian.com/software/jira