cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hunsberger, Peter" <>
Subject RE: Are flowscript functions reentrant?
Date Tue, 03 Feb 2004 21:42:01 GMT
Hunsberger, Peter wrote:
> I've traced this down to a single generator that is not 
> behaving in a reentrant fashion.  The generator simply calls 
> an EJB then walks a resulting collection to spit out a (long) 
> linear list of results. The request data is different going 
> into the generator but the EJB data is the same coming back. 
> A cursory inspection shows no obvious reason why; the code 
> sets a couple of instance variables and then goes off and 
> calls the EJB. 
> Anyone know if it is possible that when a generator is pulled 
> from a pool that the one passed back to handle the generate 
> method might not be the same one as called for the setup 
> method?  So far there seems like a vague possibility that 
> could introduce this behavior though, if so, it's a little convoluted?

Just to close this off, it's our bug after all.  Hidden deep under many
layers of code one of our classes was stashing the request parameters in
another data class that was cached internally in a static HashMap.  The
window of opportunity was small, but it was possible for two generators
to hit the same single instance of this cached data; this pipeline had
many generators being aggregated in it, by the time all the setup's got
called for the second pass through the pipeline the first passes
generate methods could be at a point where it got clobbered:

    setup       generate
A -----------> ---------->
       B ---------> ----------->  

If the setup sequence in B overlapped the generate sequence of A we got
our reentrancy problem.

I'm off to write a couple of clone methods.....

View raw message