Hi folks. I'm new to the mailing list. I'm really enjoying looking at the
code base. "Nice work!" to all contributors.

The Servlet Spec version 2.4 section SRV.6.2.1 states "Only one instance per
<filter> declaration in the deployment descriptor is instantiated per Java
Virtual Machine (JVMTM) of the container.".  That confirms that Filters
aren't thread safe. Since the "initialize" boolean is not synchronized, it
appears that there is a thread-safety issue.

Let me throw something out a possible solution.

If its blocked in the "if" statement in the doFilter, then we'll pay for
synch'ing on every request. That's not too good.

If we synchronize the method, or entry to the method, then all we've done is
blocked multiple requests from entering at the same time. They'll still
enter, but one at a time. This means that multiple request will still enter
the method until the requests queued up are cleared. That's because it went
into the method with "initialized" to false, but it was true by the time it
had a chance to execute. Therefore, the first thing it should do is check
the value of "initialized", if its true then return, otherwise let it
continue on its merry way.

~~George


----- Original Message ----- 
From: "Malzahn Volker , Köln" <[EMAIL PROTECTED]>
To: <acegisecurity-developer@lists.sourceforge.net>
Sent: Friday, June 03, 2005 5:35 AM
Subject: [Acegisecurity-developer] Bug in FilterToBeanProxy?


> Hello,
>
> I am using Acegi Security 0.7 with Weblogic 8.1 SP2. I initialize Spring
> with SpringContextLoaderListener.
>
> When using the FilterToBeanProxy in the Acegi Filters (like HTTP session
> integration filter) I have to set the init-param "init" to "lazy". Then I
> get a NullPointerException in FilterToBeanProxy line 107
> (delegate.doFilter(...)), when I submit to concurrent requests. The reason
> is, that the first request isn't ready with performing doInit(), but has
> already set initialized to true. So the second request doesn't run into
> doInit(), but delegate is null until the first request ends.
>
> Shouldn't the synchronized state and FiltertoBeanProxy.doInit() be
> synchronized to handle this problem?
>
> Regards
> Volker
>
> _________________________
>
> Volker Malzahn
> FJA Feilmeier & Junker GmbH
> Ein Unternehmen der FJH Gruppe
> Sachsenring 83
> 50677 Köln
> Tel.: 0221 / 33 80 - 271
> Fax: 0221 / 9 32 17 30
> Email:  [EMAIL PROTECTED]
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by Yahoo.
> Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
> Search APIs Find out how you can build Yahoo! directly into your own
> Applications - visit
http://developer.yahoo.net/?fr_______________________________________________
> Home: http://acegisecurity.sourceforge.net
> Acegisecurity-developer mailing list
> Acegisecurity-developer@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/acegisecurity-developer
>




-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
Home: http://acegisecurity.sourceforge.net
Acegisecurity-developer mailing list
Acegisecurity-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/acegisecurity-developer

Reply via email to