IBM Support

PM97510: Stackoverflow in OpenJPA due to endless recursive calls in 'isLoaded'

Fixes are available

8.5.5.2: WebSphere Application Server V8.5.5 Fix Pack 2
8.0.0.9: WebSphere Application Server V8.0 Fix Pack 9
8.5.5.3: WebSphere Application Server V8.5.5 Fix Pack 3
8.5.5.4: WebSphere Application Server V8.5.5 Fix Pack 4
8.0.0.10: WebSphere Application Server V8.0 Fix Pack 10
8.5.5.5: WebSphere Application Server V8.5.5 Fix Pack 5
8.5.5.6: WebSphere Application Server V8.5.5 Fix Pack 6
8.0.0.11: WebSphere Application Server V8.0 Fix Pack 11
8.5.5.7: WebSphere Application Server V8.5.5 Fix Pack 7
8.5.5.8: WebSphere Application Server V8.5.5 Fix Pack 8
8.0.0.12: WebSphere Application Server V8.0 Fix Pack 12
8.5.5.9: WebSphere Application Server V8.5.5 Fix Pack 9
8.5.5.10: WebSphere Application Server V8.5.5 Fix Pack 10
8.5.5.11: WebSphere Application Server V8.5.5 Fix Pack 11
8.0.0.13: WebSphere Application Server V8.0 Fix Pack 13
8.5.5.12: WebSphere Application Server V8.5.5 Fix Pack 12
8.0.0.14: WebSphere Application Server V8.0 Fix Pack 14
8.5.5.13: WebSphere Application Server V8.5.5 Fix Pack 13
8.0.0.15: WebSphere Application Server V8.0 Fix Pack 15
8.5.5.14: WebSphere Application Server V8.5.5 Fix Pack 14
8.5.5.15: WebSphere Application Server V8.5.5 Fix Pack 15
8.5.5.14: WebSphere Application Server V8.5.5 Fix Pack 14
8.5.5.17: WebSphere Application Server V8.5.5 Fix Pack 17
8.5.5.20: WebSphere Application Server V8.5.5.20
8.5.5.18: WebSphere Application Server V8.5.5 Fix Pack 18
8.5.5.19: WebSphere Application Server V8.5.5 Fix Pack 19
8.5.5.16: WebSphere Application Server V8.5.5 Fix Pack 16
8.5.5.21: WebSphere Application Server V8.5.5.21

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • https://issues.apache.org/jira/browse/OPENJPA-2330 issue seen
    in WebSphere Application Server V8.5.0.2.
    

Local fix

  • no work around at this time.
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED:  All users of IBM WebSphere Application      *
    *                  Server V8.0.0, V8.5.0, and V8.5.5.          *
    ****************************************************************
    * PROBLEM DESCRIPTION: Stackoverflow in OpenJPA due to         *
    *                      endless recursive calls in 'isLoaded'.  *
    ****************************************************************
    * RECOMMENDATION:                                              *
    ****************************************************************
    Take the following entities:
    public class EntityA implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long id;
    @OneToMany(fetch = FetchType.EAGER, mappedBy = "center",
    orphanRemoval = true, cascade = CascadeType.ALL)
    @OrderColumn
    private Set<EntityB> services = new
    LinkedHashSet<EntityB>();
    .........
    public class EntityB {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long id;
    @ManyToOne(cascade = { CascadeType.DETACH,
    CascadeType.MERGE, CascadeType.PERSIST })
    private EntityA center;
    @OneToMany(fetch = FetchType.EAGER, mappedBy = "service",
    cascade = CascadeType.ALL, orphanRemoval = true)
    @OrderColumn
    private Set<EntityC> linacs;
    .........
    @Entity(name="oaopeEntityC")
    public class EntityC {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    protected long id;
    @ManyToOne(cascade = { CascadeType.DETACH,
    CascadeType.MERGE, CascadeType.PERSIST })
    private EntityB service;
    .........
    With these entites, take the following test case:
    EntityManager em = emf.createEntityManager();
    EntityA a = new EntityA();
    EntityB b = new EntityB(a);
    // set back pointer
    a.getBs().add(b);
    EntityC c = new EntityC(b);
    // set back pointer
    b.getCs().add(c);
    em.persist(a);
    em.persist(b);
    em.persist(c);
    assertEquals(LoadState.LOADED,
    OpenJPAPersistenceUtil.isLoaded(b, "center"));
    The 'isLoaded' method may cause the following exception:
    Exception in thread "AWT-EventQueue-0"
    java.lang.StackOverflowError
    at
    java.util.LinkedHashMap$KeyIterator.<init>(LinkedHashMap.java:38
    3)
    at
    java.util.LinkedHashMap$KeyIterator.<init>(LinkedHashMap.java:38
    3)
    at
    java.util.LinkedHashMap.newKeyIterator(LinkedHashMap.java:396)
    at java.util.HashMap$KeySet.iterator(HashMap.java:874)
    at java.util.HashSet.iterator(HashSet.java:153)
    at
    org.apache.openjpa.util.java$util$LinkedHashSet$proxy.iterator(U
    nknown Source)
    at
    java.util.AbstractCollection.toArray(AbstractCollection.java:120
    )
    at
    org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoadedCo
    llection(OpenJPAPersistenceUtil.java:240)
    at
    org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoadedFi
    eld(OpenJPAPersistenceUtil.java:212)
    at
    org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoaded(O
    penJPAPersistenceUtil.java:161)
    at
    org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoadedAr
    ray(OpenJPAPersistenceUtil.java:265)
    at
    org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoadedCo
    llection(OpenJPAPersistenceUtil.java:242)
    at
    org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoadedFi
    eld(OpenJPAPersistenceUtil.java:212)
    at
    org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoaded(O
    penJPAPersistenceUtil.java:161)
    at
    org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoadedFi
    eld(OpenJPAPersistenceUtil.java:223)
    at
    org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoaded(O
    penJPAPersistenceUtil.java:161)
    at
    org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoadedFi
    eld(OpenJPAPersistenceUtil.java:223)
    at
    org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoaded(O
    penJPAPersistenceUtil.java:161)
    at
    org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoadedAr
    ray(OpenJPAPersistenceUtil.java:265)
    at
    org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoadedCo
    llection(OpenJPAPersistenceUtil.java:242)
    at
    org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoadedFi
    eld(OpenJPAPersistenceUtil.java:212)
    at
    org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoaded(O
    penJPAPersistenceUtil.java:161)
    at
    org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoadedFi
    eld(OpenJPAPersistenceUtil.java:223)
    at
    org.apache.openjpa.persistence.OpenJPAPersistenceUtil.isLoaded(O
    penJPAPersistenceUtil.java:161)
    [...]
    

Problem conclusion

  • With this fix, code has been added to OpenJPA to avoid a
    java.lang.StackOverflowError in the 'isLoaded' method.
    
    The fix for this APAR is currently targeted for
    inclusion in Service Levels (Fix Packs) 8.0.0.9 and
    8.5.5.2 of WebSphere Application Server versions 8.0.0 and
    8.5.5.
    
    Please refer to the recommended updates page for delivery
    information:
    http://www.ibm.com/support/docview.wss?rs=180&uid=swg27004980
    

Temporary fix

Comments

APAR Information

  • APAR number

    PM97510

  • Reported component name

    WEBSPHERE APP S

  • Reported component ID

    5724J0800

  • Reported release

    850

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2013-09-20

  • Closed date

    2014-01-03

  • Last modified date

    2014-01-03

  • APAR is sysrouted FROM one or more of the following:

  • APAR is sysrouted TO one or more of the following:

Fix information

  • Fixed component name

    WEBSPHERE APP S

  • Fixed component ID

    5724J0800

Applicable component levels

  • R800 PSY

       UP

  • R850 PSY

       UP

[{"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"8.5","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
28 April 2022