cayenne-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: query cloneViaSerialization
Date Wed, 11 May 2011 05:35:44 GMT
I just committed a removal of a synchronization on the ByteArrayOutputStream method inside
cloneViaSerialization, which was unneeded. However I think it is not the cause of your lockup.
Instead it is a synchronized block inside ObjectStreamClass. So that's a JVM class that we
can't control. 

I guess that makes 'cloneViaSerialization' unusable for Cayenne stack classes. Specifically
we should rewrite BaseQueryMetadata.setPrefetchTree(..) to clone PrefetchTreeNode manually,
which should be pretty trivial.

Andrus

On May 11, 2011, at 12:08 AM, halset@pvv.ntnu.no wrote:

> One more thing. In this single jstack output, there are 15 threads/stacks
> doing Util.cloneViaSerialization like the stack below!
> 
> - Tore.
> 
>> Hello.
>> 
>> In the jstack-output I am looking at now, there are several threads doing
>> a Util.cloneViaSerialization on some basic prefetching for a SelectQuery.
>> Down the java.io.ObjectOutputStream road there is some locking going on.
>> Is Util.cloneViaSerialization really needed here? This is with 3.1M2.
>> 
>> Regards,
>> - Tore.
>> 
>> "qtp1661944297-498" prio=10 tid=0x00007f48d0189000 nid=0x51ec in
>> Object.wait() [0x00007f48c37f4000]
>>  java.lang.Thread.State: WAITING (on object monitor)
>> 	at java.lang.Object.wait(Native Method)
>> 	- waiting on <0x00007f49bb212090> (a
>> java.io.ObjectStreamClass$EntryFuture)
>> 	at java.lang.Object.wait(Object.java:485)
>> 	at java.io.ObjectStreamClass$EntryFuture.get(ObjectStreamClass.java:371)
>> 	- locked <0x00007f49bb212090> (a java.io.ObjectStreamClass$EntryFuture)
>> 	at java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:305)
>> 	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1114)
>> 	at
>> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518)
>> 	at
>> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1483)
>> 	at
>> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
>> 	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
>> 	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:330)
>> 	at org.apache.cayenne.util.Util.cloneViaSerialization(Util.java:346)
>> 	at
>> org.apache.cayenne.query.BaseQueryMetadata.setPrefetchTree(BaseQueryMetadata.java:332)
>> 	at
>> org.apache.cayenne.query.SelectQuery.setPrefetchTree(SelectQuery.java:416)
>> 	at
>> org.apache.cayenne.query.SelectQueryPrefetchRouterAction.startDisjointPrefetch(SelectQueryPrefetchRouterAction.java:116)
>> 	at
>> org.apache.cayenne.query.SelectQueryPrefetchRouterAction.startUnknownPrefetch(SelectQueryPrefetchRouterAction.java:135)
>> 	at
>> org.apache.cayenne.query.PrefetchTreeNode.traverse(PrefetchTreeNode.java:173)
>> 	at
>> org.apache.cayenne.query.PrefetchTreeNode.traverse(PrefetchTreeNode.java:179)
>> 	at
>> org.apache.cayenne.query.SelectQueryPrefetchRouterAction.route(SelectQueryPrefetchRouterAction.java:54)
>> 	at
>> org.apache.cayenne.query.SelectQuery.routePrefetches(SelectQuery.java:179)
>> 	at org.apache.cayenne.query.SelectQuery.route(SelectQuery.java:169)
>> 	at
>> org.apache.cayenne.access.DataDomainQueryAction.runQuery(DataDomainQueryAction.java:414)
>> 	at
>> org.apache.cayenne.access.DataDomainQueryAction.access$000(DataDomainQueryAction.java:69)
>> 	at
>> org.apache.cayenne.access.DataDomainQueryAction$2.transform(DataDomainQueryAction.java:395)
>> 	at
>> org.apache.cayenne.access.DataDomain.runInTransaction(DataDomain.java:824)
>> 	at
>> org.apache.cayenne.access.DataDomainQueryAction.runQueryInTransaction(DataDomainQueryAction.java:392)
>> 	at
>> org.apache.cayenne.access.DataDomainQueryAction.execute(DataDomainQueryAction.java:121)
>> 	at
>> org.apache.cayenne.access.DataDomain.onQueryNoFilters(DataDomain.java:706)
>> 	at
>> org.apache.cayenne.access.DataDomain$DataDomainQueryFilterChain.onQuery(DataDomain.java:944)
>> 	at org.apache.cayenne.access.DataDomain.onQuery(DataDomain.java:696)
>> 	at
>> org.apache.cayenne.util.ObjectContextQueryAction.runQuery(ObjectContextQueryAction.java:336)
>> 	at
>> org.apache.cayenne.util.ObjectContextQueryAction.executePostCache(ObjectContextQueryAction.java:104)
>> 	at
>> org.apache.cayenne.util.ObjectContextQueryAction.execute(ObjectContextQueryAction.java:91)
>> 	at org.apache.cayenne.access.DataContext.onQuery(DataContext.java:983)
>> 	at
>> org.apache.cayenne.access.DataContext.performQuery(DataContext.java:972)
>> 
>> 
>> 
>> 
> 
> 
> 


Mime
View raw message