[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xml-cocoon-dev
Subject:    IncludeTransformer bug when including external URL in parallel ?
From:       "Christophe Fondacci" <christophefondacci () nextep-softwares ! com>
Date:       2009-06-11 12:54:05
Message-ID: 69FFE9E14BA04433B7039C5E6E7EFB38 () neXtep
[Download RAW message or body]

Ce message est composi et au format MIME.


Hello all,

I work with Cocoon release 2.1.11.
I got a working test XSP with 4 includes.
The include transformer is defined to process inclusions in parallel.

It works fine when i reference the inclusions through the sitemap via "cocoon:/" \
URIs, I can see 4 threads processing the inclusions in parallel. When I switch this \
to external URLs (via "http://"), everything works, but inclusions are now serially \
processed.

I digged and stepped into the Cocoon source and I can see that the problem is located \
in the org.apache.cocoon.transformation.IncludeTransformer line 563 (Cocoon 2.1.11) : \


synchronized (validity) {
    validity.addSource(source);
}
Each "external" inclusion after the first one is waiting for synch on the addSource \
method call.

When working with sitemap inclusions (cocoon://), the source.getValidity() performed \
by the validity.addSource(...) method returns immediately without really generating \
the element. There is no synchronization issue here. The generation is done outside \
of this synchronized block.

When working with external URL inclusions (http://), the source.getValidity(...) \
effectively PERFORMS the remote call and waits for the element to be generated, thus \
creating synchronization issues preventing the use of parallel inclusion of external \
URL. Each inclusion will wait on the synchronize until the previous external call \
returns.

I am working on ways to overload the MutliSourceValidity class to avoid making the \
getValidity call under specific circumstances.

Some questions now :

- Is it a bug ?

- Is there any workaround for this ?

- Is it safe to extend the MutliSourceValidity class to avoid performing the remote \
call in the addSource method ?



Thank you very much for your time. I would be glad to give you some details, should \
you need to.

Christophe.


[Attachment #3 (text/html)]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content=text/html;charset=iso-8859-1>
<META content="MSHTML 6.00.6001.18226" name=GENERATOR></HEAD>
<BODY id=MailContainerBody 
style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; PADDING-TOP: 15px" 
bgColor=#ffffff leftMargin=0 topMargin=0 CanvasTabStop="true" 
name="Compose message area">
<DIV><FONT face=Arial size=2>Hello all,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>I work with Cocoon release 2.1.11.</FONT></DIV>
<DIV><FONT face=Arial size=2>I got a working test XSP with 4 
includes.</FONT></DIV>
<DIV><FONT face=Arial size=2>The include transformer is defined to process 
inclusions in parallel.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>It works fine when i reference the inclusions 
through the sitemap via "cocoon:/" URIs, I can see 4 threads processing the 
inclusions in parallel.</FONT></DIV>
<DIV><FONT face=Arial size=2>When I switch this to external URLs (via 
"http://"), everything works, but inclusions are now serially 
processed.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>I digged and stepped into the Cocoon source and I 
can see that the problem is located in the 
org.apache.cocoon.transformation.IncludeTransformer line 563 (Cocoon 2.1.11) : 
<DIV><B><FONT color=#7f0055 size=2><FONT color=#7f0055 
size=2></FONT></FONT></B>&nbsp;</DIV>
<DIV><B><FONT color=#7f0055 size=2><FONT color=#7f0055 
size=2>synchronized</B></FONT></FONT><FONT size=2> (</FONT><FONT color=#0000c0 
size=2><FONT color=#0000c0 size=2>validity</FONT></FONT><FONT size=2>) 
{<BR></FONT><FONT color=#0000c0 size=2><FONT color=#0000c0 
size=2>&nbsp;&nbsp;&nbsp;&nbsp;validity</FONT></FONT><FONT 
size=2>.addSource(source);<BR>}</FONT></DIV>
<P align=left><FONT size=2><FONT face=Arial>Each&nbsp;"external" inclusion after 
the first one is waiting for synch on the addSource method 
call.</FONT></FONT></P>
<P align=left><FONT face=Arial size=2>When working with sitemap inclusions 
(cocoon://), the source.getValidity() performed by the validity.addSource(...) 
method returns immediately without really generating the element. There is no 
synchronization issue here. The generation is done outside of this synchronized 
block.</FONT></P>
<P align=left><FONT face=Arial size=2>When working with external URL inclusions 
(http://), the source.getValidity(...) effectively&nbsp;PERFORMS the remote call 
and waits for the element to be generated, thus creating synchronization issues 
preventing the use of parallel inclusion of external URL. Each inclusion will 
wait on the synchronize until the previous external call returns.</FONT></P>
<P align=left>I am working on ways to overload the MutliSourceValidity class to 
avoid making the getValidity call under specific circumstances.</P>
<P align=left>Some questions now :</P>
<P align=left>- Is it a bug ?</P>
<P align=left>- Is there any workaround for this ?</P>
<P align=left>- Is it safe to extend the MutliSourceValidity class to avoid 
performing the remote call in the addSource method ?</P>
<P align=left>&nbsp;</P>
<P align=left>Thank you very much for your time. I would be glad to give you 
some details, should you need to.</P>
<P align=left>Christophe.</P></FONT></DIV></BODY></HTML>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic