Getting hung threads in Eclipselink 2.6.4 [message #1771626] |
Mon, 28 August 2017 14:50  |
Eclipse User |
|
|
|
We migrated our code from using Toplink 9.0. to Eclipselink 2.6.4 thats running on Websphere App Server 8.5.5 and Java 7. We are using a Eclipselink project configuration xml which has all the mappings and we have the
corresponding Java objects for the mappings as well. We are not using EclipseLink JPA because migrating to JPA was a lot of rework with a ton of objects that we had. We changed the toplink-config.xml to eclipselink-config.xml maintaining the same mapping and making necessary modifications for the new eclipselink XSD.
After migrating the code, the application was tested in lower environments and all seemed okay, but in Production we keep getting transaction timeouts followed by several hung threads. One major issue here is we cannot reproduce it at will on another environment.
This eventually takes up all CPU and restarting the JVM is what we end up doing to restore normal operation. We did not have this issue with Toplink 9.0
I notice this happening while accessing a one-to-many relationship object.
AccessoryListType has a one-many relationship with AccessoryListTypeAccessoryLinks. If you look at AccessoryListType.java below, the second line in the getAccessories() method is where we get the AccessoryListTypeAccessoryLinks objects and results in the timeout/exception.
I am assuming we are doing a Lazy Fetch since ValueHolderInterface indirection is used. I am also attaching the eclipse-config.xml snippet which has the mapping for the objects.
ERROR :
[7/26/17 11:02:15:532 CDT] 00000072 TimeoutManage I WTRN0124I: When the timeout occurred the thread with which the transaction is, or was most recently,
associated was Thread[ORB.thread.p
ool : 3,5,main]. The stack trace of this thread when the timeout occurred was:
java.util.HashMap.getEntry(HashMap.java:477)
java.util.HashMap.get(HashMap.java:429)
org.eclipse.persistence.internal.identitymaps.FullIdentityMap.getCacheKey(FullIdentityMap.java:100)
org.eclipse.persistence.internal.identitymaps.IdentityMapManager.getFromIdentityMap(IdentityMapManager.java:817)
org.eclipse.persistence.internal.sessions.IdentityMapAccessor.getFromIdentityMap(IdentityMapAccessor.java:428)
org.eclipse.persistence.internal.sessions.UnitOfWorkIdentityMapAccessor.getFromIdentityMap(UnitOfWorkIdentityMapAccessor.java:131)
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.registerExistingObject(UnitOfWorkImpl.java:3940)
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.registerExistingObject(UnitOfWorkImpl.java:3894)
org.eclipse.persistence.mappings.CollectionMapping.buildElementUnitOfWorkClone(CollectionMapping.java:308)
org.eclipse.persistence.mappings.CollectionMapping.buildElementClone(CollectionMapping.java:321)
org.eclipse.persistence.internal.queries.ContainerPolicy.addNextValueFromIteratorInto(ContainerPolicy.java:215)
org.eclipse.persistence.mappings.CollectionMapping.buildCloneForPartObject(CollectionMapping.java:223)
org.eclipse.persistence.internal.indirection.UnitOfWorkQueryValueHolder.buildCloneFor(UnitOfWorkQueryValueHolder.java:60)
org.eclipse.persistence.internal.indirection.UnitOfWorkValueHolder.instantiateImpl(UnitOfWorkValueHolder.java:173)
org.eclipse.persistence.internal.indirection.UnitOfWorkValueHolder.instantiate(UnitOfWorkValueHolder.java:234)
org.eclipse.persistence.internal.indirection.DatabaseValueHolder.getValue(DatabaseValueHolder.java:89)
com.harland.checks.server.businessobjects.product.AccessoryListType.getAccessoryListTypeAccessoryLinks(AccessoryListType.java:180)
com.harland.checks.server.businessobjects.product.AccessoryListType.getAccessories(AccessoryListType.java:260)
com.harland.checks.server.businessobjects.product.AccessoryList.getAccessoriesByType(AccessoryList.java:429)
AccessoryListType.java
---------------------------
public class AccessoryListType
{
private int uid;
private String accessoryListType = "";
private ValueHolderInterface accessoryListHolder = null;
private ValueHolderInterface accessoryListTypeAccessoryLinkHolder = null;
public AccessoryListType()
{
accessoryListTypeAccessoryLinkHolder = new ValueHolder(new Vector());
accessoryListHolder = new ValueHolder();
}
public void setUid(int id)
{
uid = id;
}
public int getUid()
{
return uid;
}
public String toString()
{
return getAccessoryListType();
}
public void setAccessoryListType(String type)
{
accessoryListType = type;
}
public String getAccessoryListType()
{
return accessoryListType;
}
public void setAccessoryListHolder(ValueHolderInterface holder)
{
accessoryListHolder = holder;
}
public ValueHolderInterface getAccessoryListHolder()
{
return accessoryListHolder;
}
public void setAccessoryList(AccessoryList al)
{
getAccessoryListHolder().setValue(al);
}
public AccessoryList getAccessoryList()
{
return (AccessoryList)getAccessoryListHolder().getValue();
}
public void setAccessoryListTypeAccessoryLinkHolder(
ValueHolderInterface holder)
{
accessoryListTypeAccessoryLinkHolder = holder;
}
public ValueHolderInterface getAccessoryListTypeAccessoryLinkHolder()
{
return accessoryListTypeAccessoryLinkHolder;
}
public void setAccessoryListTypeAccessoryLinks(Vector links)
{
getAccessoryListTypeAccessoryLinkHolder().setValue(links);
}
public Vector getAccessoryListTypeAccessoryLinks()
{
return (Vector)getAccessoryListTypeAccessoryLinkHolder().getValue();
}
public void addAccessoryListTypeLink(AccessoryListTypeAccLink altl)
{
getAccessoryListTypeAccessoryLinks().addElement(altl);
}
public void removeAccessoryListTypeLink(AccessoryListTypeAccLink altl)
{
getAccessoryListTypeAccessoryLinks().removeElement(altl);
}
public void addAccessory(Accessory accessory)
{
AccessoryListTypeAccLink link = new AccessoryListTypeAccLink();
link.setAccessory(accessory);
link.setAccessoryListType(this);
this.addAccessoryListTypeLink(link);
}
public void addAccessory(Accessory accessory, AccessoryListTypeAccLink link)
{
link.setAccessory(accessory);
link.setAccessoryListType(this);
this.addAccessoryListTypeLink(link);
}
public void removeAccessory(Accessory accessory)
{
Vector links = getAccessoryListTypeAccessoryLinks();
for (int loop = 0; loop < links.size(); loop++)
{
AccessoryListTypeAccLink link =
(AccessoryListTypeAccLink)links.elementAt(loop);
if (link.getAccessory().equals(accessory))
{
removeAccessoryListTypeLink(link);
break;
}
}
}
public Vector getAccessories()
{
Vector accessories = new Vector();
Vector links = this.getAccessoryListTypeAccessoryLinks(); ----/////// this is where we get the error
int size = links.size();
for (int i = 0; i < size; i++)
{
accessories.addElement(
((AccessoryListTypeAccLink)links.elementAt(i)).getAccessory());
}
return accessories;
}
}
AccessoryListTypeAccLink.java
----------------------------------
public class AccessoryListTypeAccLink
{
private int uid;
private ValueHolderInterface accessoryHolder = null;
private ValueHolderInterface accessoryListTypeHolder = null;
public AccessoryListTypeAccLink()
{
accessoryHolder = new ValueHolder();
accessoryListTypeHolder = new ValueHolder();
}
public void setUid(int id)
{
uid = id;
}
public int getUid()
{
return uid;
}
public void setAccessoryHolder(ValueHolderInterface holder)
{
accessoryHolder = holder;
}
public ValueHolderInterface getAccessoryHolder()
{
return accessoryHolder;
}
public void setAccessory(Accessory accessory)
{
getAccessoryHolder().setValue(accessory);
}
public Accessory getAccessory()
{
return (Accessory)getAccessoryHolder().getValue();
}
public void setAccessoryListTypeHolder(ValueHolderInterface holder)
{
accessoryListTypeHolder = holder;
}
public ValueHolderInterface getAccessoryListTypeHolder()
{
return accessoryListTypeHolder;
}
public void setAccessoryListType(AccessoryListType accessoryListType)
{
getAccessoryListTypeHolder().setValue(accessoryListType);
}
public AccessoryListType getAccessoryListType()
{
return (AccessoryListType)getAccessoryListTypeHolder().getValue();
}
}
eclipselink-config.xml (snippet)
----------------------------
<class-mapping-descriptor xsi:type="relational-class-mapping-descriptor">
<class>com.harland.checks.server.businessobjects.product.AccessoryListType</class>
<alias>AccessoryListType</alias>
<primary-key>
<field table="accessorylisttype" name="uid" xsi:type="column"/>
</primary-key>
<events xsi:type="event-policy"/>
<querying xsi:type="query-policy"/>
<attribute-mappings>
<attribute-mapping xsi:type="one-to-one-mapping">
<attribute-name>accessoryListHolder</attribute-name>
<get-method>getAccessoryListHolder</get-method>
<set-method>setAccessoryListHolder</set-method>
<reference-class>com.harland.checks.server.businessobjects.product.AccessoryList</reference-class>
<foreign-key>
<field-reference>
<source-field table="accessorylisttype" name="acclist_uid" xsi:type="column"/>
<target-field table="p_accessory_list" name="accessory_list_id" xsi:type="column"/>
</field-reference>
</foreign-key>
<foreign-key-fields>
<field table="accessorylisttype" name="acclist_uid" xsi:type="column"/>
</foreign-key-fields>
<indirection xsi:type="value-holder-indirection-policy"/>
<selection-query xsi:type="read-object-query"/>
</attribute-mapping>
<attribute-mapping xsi:type="direct-mapping">
<attribute-name>accessoryListType</attribute-name>
<get-method>getAccessoryListType</get-method>
<set-method>setAccessoryListType</set-method>
<field table="accessorylisttype" name="accessory_type" xsi:type="column"/>
</attribute-mapping>
<attribute-mapping xsi:type="one-to-many-mapping">
<attribute-name>accessoryListTypeAccessoryLinkHolder</attribute-name>
<get-method>getAccessoryListTypeAccessoryLinkHolder</get-method>
<set-method>setAccessoryListTypeAccessoryLinkHolder</set-method>
<reference-class>com.harland.checks.server.businessobjects.product.AccessoryListTypeAccLink</reference-class>
<private-owned>true</private-owned>
<target-foreign-key>
<field-reference>
<source-field table="acclisttypeacc_lk" name="acc_list_type_uid" xsi:type="column"/>
<target-field table="accessorylisttype" name="uid" xsi:type="column"/>
</field-reference>
</target-foreign-key>
<container xsi:type="list-container-policy">
<collection-type>java.util.Vector</collection-type>
</container>
<indirection xsi:type="value-holder-indirection-policy"/>
<selection-query xsi:type="read-all-query">
<container xsi:type="list-container-policy">
<collection-type>java.util.Vector</collection-type>
</container>
</selection-query>
</attribute-mapping>
<attribute-mapping xsi:type="direct-mapping">
<attribute-name>uid</attribute-name>
<get-method>getUid</get-method>
<set-method>setUid</set-method>
<field table="accessorylisttype" name="uid" xsi:type="column"/>
</attribute-mapping>
</attribute-mappings>
<descriptor-type>independent</descriptor-type>
<sequencing>
<sequence-name>accessorylisttype</sequence-name>
<sequence-field table="accessorylisttype" name="uid" xsi:type="column"/>
</sequencing>
<instantiation/>
<copying xsi:type="instantiation-copy-policy"/>
<change-policy xsi:type="deferred-detection-change-policy"/>
<tables>
<table name="accessorylisttype"/>
</tables>
</class-mapping-descriptor>
<class-mapping-descriptor xsi:type="relational-class-mapping-descriptor">
<class>com.harland.checks.server.businessobjects.product.AccessoryListTypeAccLink</class>
<alias>AccessoryListTypeAccLink</alias>
<primary-key>
<field table="acclisttypeacc_lk" name="uid" xsi:type="column"/>
</primary-key>
<events xsi:type="event-policy"/>
<querying xsi:type="query-policy"/>
<attribute-mappings>
<attribute-mapping xsi:type="one-to-one-mapping">
<attribute-name>accessoryHolder</attribute-name>
<get-method>getAccessoryHolder</get-method>
<set-method>setAccessoryHolder</set-method>
<reference-class>com.harland.checks.server.businessobjects.product.Accessory</reference-class>
<foreign-key>
<field-reference>
<source-field table="acclisttypeacc_lk" name="acc_uid" xsi:type="column"/>
<target-field table="p_accessory" name="accessory_id" xsi:type="column"/>
</field-reference>
</foreign-key>
<foreign-key-fields>
<field table="acclisttypeacc_lk" name="acc_uid" xsi:type="column"/>
</foreign-key-fields>
<indirection xsi:type="value-holder-indirection-policy"/>
<selection-query xsi:type="read-object-query"/>
</attribute-mapping>
<attribute-mapping xsi:type="one-to-one-mapping">
<attribute-name>accessoryListTypeHolder</attribute-name>
<get-method>getAccessoryListTypeHolder</get-method>
<set-method>setAccessoryListTypeHolder</set-method>
<reference-class>com.harland.checks.server.businessobjects.product.AccessoryListType</reference-class>
<foreign-key>
<field-reference>
<source-field table="acclisttypeacc_lk" name="acc_list_type_uid" xsi:type="column"/>
<target-field table="accessorylisttype" name="uid" xsi:type="column"/>
</field-reference>
</foreign-key>
<foreign-key-fields>
<field table="acclisttypeacc_lk" name="acc_list_type_uid" xsi:type="column"/>
</foreign-key-fields>
<indirection xsi:type="value-holder-indirection-policy"/>
<selection-query xsi:type="read-object-query"/>
</attribute-mapping>
<attribute-mapping xsi:type="direct-mapping">
<attribute-name>uid</attribute-name>
<get-method>getUid</get-method>
<set-method>setUid</set-method>
<field table="acclisttypeacc_lk" name="uid" xsi:type="column"/>
</attribute-mapping>
</attribute-mappings>
<descriptor-type>independent</descriptor-type>
<sequencing>
<sequence-name>acclisttypeacc_lk</sequence-name>
<sequence-field table="acclisttypeacc_lk" name="uid" xsi:type="column"/>
</sequencing>
<instantiation/>
<copying xsi:type="instantiation-copy-policy"/>
<change-policy xsi:type="deferred-detection-change-policy"/>
<tables>
<table name="acclisttypeacc_lk"/>
</tables>
</class-mapping-descriptor>
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05317 seconds