You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Christopher Oliver <re...@verizon.net> on 2003/07/02 06:21:41 UTC

Re: [Flow] Serious problem with cocoon.getComponent(id)

I can't reproduce this. Are you sure you don't have an old version of rhino
in your classpath? I fixed a problem with setting up dynamic scopes 
recently.

Regards,

Chris

Reinhard Pötz wrote:

>>From: Christopher Oliver [mailto:coliver@SeeBeyond.com] 
>>
>>
>>You need to describe how to recreate the problem in more 
>>detail 
>>    
>>
>
>ok, here some more details:
>
>As you can see I implemented cocoon.getComponent(id). If I call
>this method from the flow and do a lot of refreshes at once
>(pushing the F5 key at IE) this error occurs.
>
>If I include a debug statement writing the ComponentManager to 
>System.out I sometimes get null and not the manager.
>
>IIRC last week a problem with the petstore examples and the
>database connections was reported altough the "old" implementation
>exposed the ComponentManager itself.
>
>If you need more information please let me know!
>
>Reinhard
>
>
>  
>
>>for me to help you. The component manager will only 
>>become null when the FOM_Cocoon object is invalidated. Your 
>>scripts should not be executing in this state. If they are 
>>that that indicates a bug and we need to find it.
>>
>>
>>Regards,
>>
>>Chris
>>
>>-----Original Message-----
>>From: Reinhard Pötz [mailto:reinhard_poetz@gmx.net] 
>>Sent: Monday, June 30, 2003 12:57 PM
>>To: cocoon-dev@xml.apache.org
>>Subject: [Flow] Serious problem with cocoon.getComponent(id)
>>Importance: High
>>
>>I think we have I serious problem with the lookup of 
>>components within flow scripts. Under load the component 
>>manager can become null!!!
>>
>>Could somebody with more knowledge about this part of Cocoon 
>>have a look at it?
>>
>>TIA!
>>
>>Cheers,
>>Reinhard
>>
>>    
>>
>>>-----Original Message-----
>>>From: reinhard@apache.org [mailto:reinhard@apache.org]
>>>Sent: Monday, June 30, 2003 9:11 PM
>>>To: cocoon-2.1-cvs@apache.org
>>>Subject: cvs commit: 
>>>cocoon-2.1/src/scratchpad/src/org/apache/cocoon/components/flo
>>>w/javascript/fom FOM_Cocoon.java
>>>
>>>
>>>reinhard    2003/06/30 12:11:10
>>>
>>>  Modified:    
>>>src/scratchpad/src/org/apache/cocoon/components/flow/javascript/fom
>>>                        FOM_Cocoon.java
>>>      
>>>
>><snip/>
>>
>>    
>>
>>>  +    public Object jsFunction_getComponent( String id ) { 
>>>  +        Object o = null;
>>>  +        try {
>>>  +		  o = this.componentManager.lookup( id );
>>>  +		} catch (ComponentException e) {
>>>  +          o = null; 
>>>  +		}
>>>  +        return o;
>>>  +    }
>>>      
>>>
>
>
>  
>




Bug in XMLFormTransformation

Posted by Mark Miller <mm...@moondance.com>.
If the first tag encountered in the form file is an <xf:repeat> in an  
<xf:group> the 'value_' is null and causes an exception. I think the  
form has to be new as well.

Original Exception: java.util.EmptyStackException
	at java.util.Stack.peek(Stack.java:79)
	at  
org.apache.cocoon.transformation.XMLFormTransformer.unrollRepeatTag(XMLF 
ormTransformer.java:1027)
	at  
org.apache.cocoon.transformation.XMLFormTransformer.endTransformingEleme 
nt(XMLFormTransformer.java:922)
	at  
org.apache.cocoon.transformation.AbstractSAXTransformer.endElement(Abstr 
actSAXTransformer.java:355)
	at  
org.apache.cocoon.components.sax.XMLTeePipe.endElement(XMLTeePipe.java:1 
24)
	at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown  
Source)
	at  
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown  
Source)
	at  
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDis 
patcher.dispatch(Unknown Source)
	at  
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unkno 
wn Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	

I made this happen with the following changes to start.xml, but it  
happens in my own forms as well.

<?xml version="1.0" ?>

<document xmlns:xf="http://apache.org/cocoon/xmlform/1.0">
   <section>
     <title>Welcome !</title>

     <p align="center">
       This wizard will collect feedback information
       for the <a href="http://cocoon.apache.org/">Apache Cocoon</a>
       project.
     </p>
     <xf:group ref="/" id="favorites_group">
       <xf:caption>Favorite web sites</xf:caption>
       <xf:repeat nodeset="/" id="favorites">
         <xf:output ref="." class="info">
           <xf:caption>URL: </xf:caption>
         </xf:output>
       </xf:repeat>
     </xf:group>

     <p align="center">
       See <a href="overview.html">overview</a> documentation.
     </p>

     <p align="center">
       <a href="wizard?cocoon-action-start=true">
         Start!
       </a>
     </p>
   </section>
</document>

Re: [Flow] Serious problem with cocoon.getComponent(id)

Posted by Christopher Oliver <re...@verizon.net>.
Sorry, but the fix suggested in that thread is not correct. The problem 
is that the "cocoon" object with the null component manager is an 
invalidated reference to another user's instance. This is clearly a bug 
in the flow implementation. By storing the componentManager itself in a 
global variable you are merely working around the bug.

When looking up global variables normally Rhino looks in the "lexical" 
scope of a function (i.e. it uses the global variables present when the 
function was compiled). Rhino has an option however to compile with 
"dynamic" scopes. This means that global variables are looked up in the 
context of the function's caller instead of the lexical scope. This is 
what we use in Cocoon, in order to support multiple users. Each user 
thread has its own dynamic scope (and its own instance of the "cocoon" 
object). In between calls to your script the "cocoon" object is 
invalidated (among other things its component manager is set to null).

I recently fixed a problem where the dynamic scope was not being set up 
properly when a script was executed. Can you please verify that 
rhino1.5r4-continuations-20030605.jar is in your classpath and 
rhino1.5r4-continuations-20030323.jar is not.

Of course, it's possible that there is an additional problem here that 
needs to be debugged.

Regards,

Chris

Frank Taffelt wrote:

>>I can't reproduce this. Are you sure you don't have an old version of
>>    
>>
>rhino
>  
>
>>in your classpath? I fixed a problem with setting up dynamic scopes
>>recently.
>>    
>>
>
>were your changes before 2.1M2 ? I had the same problems, see
>http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=105540495810202&w=2 for
>details.
>
>After applying the suggested change, the problems never occured again. For
>me, the new  Database.js doesn't really change something, but nevertheless -
>the null componentmanager problem never raised again.
>
>Maybe the suggested change in database.js gives you a idea where to look for
>?
>
>Frank
>
>
>  
>



Re: [Flow] Serious problem with cocoon.getComponent(id)

Posted by Frank Taffelt <fr...@interface-business.de>.
> I can't reproduce this. Are you sure you don't have an old version of
rhino
> in your classpath? I fixed a problem with setting up dynamic scopes
> recently.

were your changes before 2.1M2 ? I had the same problems, see
http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=105540495810202&w=2 for
details.

After applying the suggested change, the problems never occured again. For
me, the new  Database.js doesn't really change something, but nevertheless -
the null componentmanager problem never raised again.

Maybe the suggested change in database.js gives you a idea where to look for
?

Frank


RE: [Flow] Serious problem with cocoon.getComponent(id)

Posted by Reinhard Pötz <re...@gmx.net>.
From: Corey O'Donovan 

> 
> >>Reinhard Pötz wrote:
> >>
> >>I'm intrigued about how you get JMeter to work with Flow 
> enabled apps. 
> >>How do you get a JMeter HTTP Request sample to use the continuation 
> >>id?
> > 
> > 
> > Good question, I don't know. I only tested non-continuation based 
> > flows with it.

http://wiki.cocoondev.org/Wiki.jsp?page=LoadTestingFlowWithJMeter

Thank you!

Cheers,
Reinhard


Re: [Flow] Serious problem with cocoon.getComponent(id)

Posted by Corey O'Donovan <od...@feersumendjinns.com>.

>>Reinhard Pötz wrote:
>>
>>I'm intrigued about how you get JMeter to work with Flow enabled apps.
>>How do you get a JMeter HTTP Request sample to use the continuation id?
> 
> 
> Good question, I don't know. I only tested non-continuation based flows with
> it.

http://wiki.cocoondev.org/Wiki.jsp?page=LoadTestingFlowWithJMeter

> 
> Reinhard


Re: [Flow] Serious problem with cocoon.getComponent(id)

Posted by re...@gmx.net.
> Reinhard Pötz wrote:
> > Hi Chris,
> > 
> > thank you very much, your changes solved the problems perfectly!
> > 
> > The only issue that remains is the 
> > 
> > "uncaught JavaScript exception: TypeError: calculator is not a
> > function."
> > 
> > This error only occurs if I use JMeter to test it. If I change the flow
> > interpreter to "JavaScript" (old version) everything works fine. I can't
> > find any differences in the logs or the response headers.
> 
> I'm intrigued about how you get JMeter to work with Flow enabled apps.
> How do you get a JMeter HTTP Request sample to use the continuation id?

Good question, I don't know. I only tested non-continuation based flows with
it.

Reinhard

> 
> > 
> > Do you have any idea?
> > 
> > Reinhard
> 

-- 
+++ GMX - Mail, Messaging & more  http://www.gmx.net +++

Jetzt ein- oder umsteigen und USB-Speicheruhr als Prämie sichern!


Re: [Flow] Serious problem with cocoon.getComponent(id)

Posted by Corey O'Donovan <od...@feersumendjinns.com>.
Reinhard Pötz wrote:
> Hi Chris,
> 
> thank you very much, your changes solved the problems perfectly!
> 
> The only issue that remains is the 
> 
> "uncaught JavaScript exception: TypeError: calculator is not a
> function."
> 
> This error only occurs if I use JMeter to test it. If I change the flow
> interpreter to "JavaScript" (old version) everything works fine. I can't
> find any differences in the logs or the response headers.

I'm intrigued about how you get JMeter to work with Flow enabled apps.
How do you get a JMeter HTTP Request sample to use the continuation id?

> 
> Do you have any idea?
> 
> Reinhard


RE: [Flow] Serious problem with cocoon.getComponent(id)

Posted by Reinhard Pötz <re...@gmx.net>.
Hi Chris,

thank you very much, your changes solved the problems perfectly!

The only issue that remains is the 

"uncaught JavaScript exception: TypeError: calculator is not a
function."

This error only occurs if I use JMeter to test it. If I change the flow
interpreter to "JavaScript" (old version) everything works fine. I can't
find any differences in the logs or the response headers. 

Do you have any idea?

Reinhard


> From: Christopher Oliver [mailto:res1cf5x@verizon.net]
> 
> Ok, I looked into this further and it seems to be simply a matter of 
> FOM_JavaScriptInterpreter not being thread-safe. I was under the
> (incorrect) impression that thread synchronization was
> occuring outside 
> of the flow intepreter. That seems to not be the case. I just 
> checked in 
> code to synchronize on the thread's JS global object. Let me know if 
> this fixes the problem.
> 
> Regards,
> 
> Chris


Re: [Flow] Serious problem with cocoon.getComponent(id)

Posted by Christopher Oliver <re...@verizon.net>.
Ok, I looked into this further and it seems to be simply a matter of 
FOM_JavaScriptInterpreter not being thread-safe. I was under the 
(incorrect) impression that thread synchronization was occuring outside 
of the flow intepreter. That seems to not be the case. I just checked in 
code to synchronize on the thread's JS global object. Let me know if 
this fixes the problem.

Regards,

Chris

Reinhard Pötz wrote:

>>From: Christopher Oliver [mailto:res1cf5x@verizon.net]
>>
>>I can't reproduce this. Are you sure you don't have an old
>>version of rhino in your classpath? I fixed a problem with 
>>setting up dynamic scopes 
>>recently.
>>    
>>
>
>I'm sure. I use the latest Cocoon CVS snapshot.
>
>- Strange things happen if I use JMeter to test it (e.g. 1 thread, 10
>requests). The first request works but for all other requests I get a
>Status 500 as response and at the console I find "uncaught JavaScript
>exception: TypeError: calculator is not a function." Maybe this has
>something to do with the internal redirects of the flow when sendPage is
>called. Contact me if the JMeter testscript would help you.
>
>- Another issue: Sometimes I get strange response if I push the F5
>button in Mozilla. See 
>http://www.poetz.cc/strangeresults.gif. I could reproduce this error in
>IE too.
>
>- Sometimes get null when I call cocoon.getComponent(id) (push F5 in
>Mozilla --> it is much faster than IE and therefore this error happens
>here more often than when using IE).
>
>Sorry that the reported issues are desribed very vague ... :-(
>
>Regards,
>Reinhard
>
>  
>
>>Regards,
>>
>>Chris
>>
>>Reinhard Pötz wrote:
>>
>>    
>>
>>>>From: Christopher Oliver [mailto:coliver@SeeBeyond.com]
>>>>
>>>>
>>>>You need to describe how to recreate the problem in more detail
>>>>   
>>>>
>>>>        
>>>>
>>>ok, here some more details:
>>>
>>>As you can see I implemented cocoon.getComponent(id). If I call this 
>>>method from the flow and do a lot of refreshes at once 
>>>      
>>>
>>(pushing the F5 
>>    
>>
>>>key at IE) this error occurs.
>>>
>>>If I include a debug statement writing the ComponentManager to
>>>System.out I sometimes get null and not the manager.
>>>
>>>IIRC last week a problem with the petstore examples and the database 
>>>connections was reported altough the "old" implementation 
>>>      
>>>
>>exposed the 
>>    
>>
>>>ComponentManager itself.
>>>
>>>If you need more information please let me know!
>>>
>>>Reinhard
>>>
>>>
>>> 
>>>
>>>      
>>>
>>>>for me to help you. The component manager will only
>>>>become null when the FOM_Cocoon object is invalidated. Your 
>>>>scripts should not be executing in this state. If they are 
>>>>that that indicates a bug and we need to find it.
>>>>
>>>>
>>>>Regards,
>>>>
>>>>Chris
>>>>
>>>>-----Original Message-----
>>>>From: Reinhard Pötz [mailto:reinhard_poetz@gmx.net]
>>>>Sent: Monday, June 30, 2003 12:57 PM
>>>>To: cocoon-dev@xml.apache.org
>>>>Subject: [Flow] Serious problem with cocoon.getComponent(id)
>>>>Importance: High
>>>>
>>>>I think we have I serious problem with the lookup of
>>>>components within flow scripts. Under load the component 
>>>>manager can become null!!!
>>>>
>>>>Could somebody with more knowledge about this part of Cocoon
>>>>have a look at it?
>>>>
>>>>TIA!
>>>>
>>>>Cheers,
>>>>Reinhard
>>>>
>>>>   
>>>>
>>>>        
>>>>
>>>>>-----Original Message-----
>>>>>From: reinhard@apache.org [mailto:reinhard@apache.org]
>>>>>Sent: Monday, June 30, 2003 9:11 PM
>>>>>To: cocoon-2.1-cvs@apache.org
>>>>>Subject: cvs commit:
>>>>>cocoon-2.1/src/scratchpad/src/org/apache/cocoon/components/flo
>>>>>w/javascript/fom FOM_Cocoon.java
>>>>>
>>>>>
>>>>>reinhard    2003/06/30 12:11:10
>>>>>
>>>>> Modified:    
>>>>>src/scratchpad/src/org/apache/cocoon/components/flow/javascript/fom
>>>>>                       FOM_Cocoon.java
>>>>>     
>>>>>
>>>>>          
>>>>>
>>>><snip/>
>>>>
>>>>   
>>>>
>>>>        
>>>>
>>>>> +    public Object jsFunction_getComponent( String id ) { 
>>>>> +        Object o = null;
>>>>> +        try {
>>>>> +		  o = this.componentManager.lookup( id );
>>>>> +		} catch (ComponentException e) {
>>>>> +          o = null; 
>>>>> +		}
>>>>> +        return o;
>>>>> +    }
>>>>>     
>>>>>
>>>>>          
>>>>>
>>> 
>>>
>>>      
>>>
>>
>>    
>>
>
>
>  
>



RE: [Flow] Serious problem with cocoon.getComponent(id)

Posted by Reinhard Pötz <re...@gmx.net>.
> From: Christopher Oliver [mailto:res1cf5x@verizon.net]
>
> I can't reproduce this. Are you sure you don't have an old
> version of rhino in your classpath? I fixed a problem with 
> setting up dynamic scopes 
> recently.

I'm sure. I use the latest Cocoon CVS snapshot.

- Strange things happen if I use JMeter to test it (e.g. 1 thread, 10
requests). The first request works but for all other requests I get a
Status 500 as response and at the console I find "uncaught JavaScript
exception: TypeError: calculator is not a function." Maybe this has
something to do with the internal redirects of the flow when sendPage is
called. Contact me if the JMeter testscript would help you.

- Another issue: Sometimes I get strange response if I push the F5
button in Mozilla. See 
http://www.poetz.cc/strangeresults.gif. I could reproduce this error in
IE too.

- Sometimes get null when I call cocoon.getComponent(id) (push F5 in
Mozilla --> it is much faster than IE and therefore this error happens
here more often than when using IE).

Sorry that the reported issues are desribed very vague ... :-(

Regards,
Reinhard

> 
> Regards,
> 
> Chris
> 
> Reinhard Pötz wrote:
> 
> >>From: Christopher Oliver [mailto:coliver@SeeBeyond.com]
> >>
> >>
> >>You need to describe how to recreate the problem in more detail
> >>    
> >>
> >
> >ok, here some more details:
> >
> >As you can see I implemented cocoon.getComponent(id). If I call this 
> >method from the flow and do a lot of refreshes at once 
> (pushing the F5 
> >key at IE) this error occurs.
> >
> >If I include a debug statement writing the ComponentManager to
> >System.out I sometimes get null and not the manager.
> >
> >IIRC last week a problem with the petstore examples and the database 
> >connections was reported altough the "old" implementation 
> exposed the 
> >ComponentManager itself.
> >
> >If you need more information please let me know!
> >
> >Reinhard
> >
> >
> >  
> >
> >>for me to help you. The component manager will only
> >>become null when the FOM_Cocoon object is invalidated. Your 
> >>scripts should not be executing in this state. If they are 
> >>that that indicates a bug and we need to find it.
> >>
> >>
> >>Regards,
> >>
> >>Chris
> >>
> >>-----Original Message-----
> >>From: Reinhard Pötz [mailto:reinhard_poetz@gmx.net]
> >>Sent: Monday, June 30, 2003 12:57 PM
> >>To: cocoon-dev@xml.apache.org
> >>Subject: [Flow] Serious problem with cocoon.getComponent(id)
> >>Importance: High
> >>
> >>I think we have I serious problem with the lookup of
> >>components within flow scripts. Under load the component 
> >>manager can become null!!!
> >>
> >>Could somebody with more knowledge about this part of Cocoon
> >>have a look at it?
> >>
> >>TIA!
> >>
> >>Cheers,
> >>Reinhard
> >>
> >>    
> >>
> >>>-----Original Message-----
> >>>From: reinhard@apache.org [mailto:reinhard@apache.org]
> >>>Sent: Monday, June 30, 2003 9:11 PM
> >>>To: cocoon-2.1-cvs@apache.org
> >>>Subject: cvs commit:
> >>>cocoon-2.1/src/scratchpad/src/org/apache/cocoon/components/flo
> >>>w/javascript/fom FOM_Cocoon.java
> >>>
> >>>
> >>>reinhard    2003/06/30 12:11:10
> >>>
> >>>  Modified:    
> >>>src/scratchpad/src/org/apache/cocoon/components/flow/javascript/fom
> >>>                        FOM_Cocoon.java
> >>>      
> >>>
> >><snip/>
> >>
> >>    
> >>
> >>>  +    public Object jsFunction_getComponent( String id ) { 
> >>>  +        Object o = null;
> >>>  +        try {
> >>>  +		  o = this.componentManager.lookup( id );
> >>>  +		} catch (ComponentException e) {
> >>>  +          o = null; 
> >>>  +		}
> >>>  +        return o;
> >>>  +    }
> >>>      
> >>>
> >
> >
> >  
> >
> 
> 
>