cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vadim Gritsenko <va...@reverycodes.com>
Subject Re: NullPointerException in AbstractWidgetDefinitionBuilder
Date Thu, 17 Jan 2008 15:47:13 GMT
On Jan 17, 2008, at 8:12 AM, Joerg Heinicke wrote:

> On 17.01.2008 05:45, Harald Entner wrote:
>
>> In normal mode everything runs fine. But when running a jmeter test  
>> with 40 concurrent users, the AbstractWidgetDefinitionBuilder  
>> throws a NullPointerException. see the full stacktrace at (1)
>> java.lang.NullPointerException
>>   at  
>> org 
>> .apache 
>> .cocoon 
>> .forms 
>> .formmodel 
>> .AbstractWidgetDefinitionBuilder 
>> .setupDefinition(AbstractWidgetDefinitionBuilder.java:109) (... see  
>> 1)
>> Probably the reason for this error is that the function
>> public WidgetDefinition buildWidgetDefinition(Element  
>> widgetElement, WidgetDefinitionBuilderContext context)
>>   throws Exception {
>>  it is not thread-save.
>> I tried the same test with a little modification  
>> (buildWidgetDefinition is synchronized)
>> public synchronized WidgetDefinition buildWidgetDefinition(Element  
>> widgetElement, WidgetDefinitionBuilderContext context)
>>   throws Exception {
>> The error (1) doesn't occur anymore, but another one: (see 2) It  
>> seems that the cause for this is very similar to the one above.
>> Has one of you seen this error when running a stress test? What  
>> could i do to avoid that problem? (i could go on and modify this  
>> function to synchronized as well, but hopefully there is a better  
>> solution for this. )
>
> Hmm, this does not look good but like a major flaw in Cocoon Forms.  
> Following the Javadoc of WidgetDefinitionBuilder implementations of  
> this interface have to be thread-safe

Hmm, apparently intent does not match implementation.

> - which they are not because of the context field. There is one  
> quick fix you can do: Make the context a ThreadLocal variable.

It has been fixed in trunk in r604025, but I did not notice that  
javadoc snippet you pointed to.

Vadim

Mime
View raw message