-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Intermittent exceptions - shared references or timing issue?
PostPosted: Wed Sep 16, 2009 6:16 am 
Newbie

Joined: Wed Sep 16, 2009 6:09 am
Posts: 1
Hi.

Our application is suffering several intermittent hibernate exceptions, mainly these:
- Collection processed twice by flush
- Found shared references to a collection
- Flush during cascade is dangerous

It happens only if you are working with a slow server and you load a lot of entities to the memory.
To make thing worse, problem is not easy to reproduce. Sometimes the system can survive 30 selenium tests, sometimes it fails just after a few requests.
It always happens on flush (usually invoked by JPA query). We use Jboss 4.2.2, Seam 2.1.1 with Extended Persistence and EJB3.

One of the main suspects is a circular reference in entities schema. Studying hibernate code shows that these exceptions are thrown mainly when a collection is processed twice.
Could you please have a look on the part of class schema and make a judgement: can it be a reason for having intermittent hibernate exceptions?
Image
All relations are unidirectional OneToMany or ManyToOne.

The typical example of stacktrace can be:
Code:
Caused by: org.hibernate.HibernateException: Found shared references to a collection: D.Es
   at org.hibernate.engine.Collections.processReachableCollection(Collections.java:163)
   at org.hibernate.event.def.FlushVisitor.processCollection(FlushVisitor.java:37)
   at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:101)
   at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:61)
   at org.hibernate.event.def.AbstractVisitor.processEntityPropertyValues(AbstractVisitor.java:55)
   at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:138)
   at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:196)
   at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:76)
   at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
   at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
   at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
   at org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:516)

It also happens for C.Fs and many others.

Another suspect is any timing or multi-threading issue.
Can anybody put some light on it? Is there any technique of solving such a problem?

Thanks in advance,
Jan


Top
 Profile  
 
 Post subject: Re: Intermittent exceptions - shared references or timing issue?
PostPosted: Wed Jan 11, 2012 4:38 pm 
Newbie

Joined: Wed Jan 11, 2012 4:29 pm
Posts: 1
I know this is an old topic but we are having this exact same issue.

Did you ever resolve this issue?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.