You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@roller.apache.org by Jeff Blattman <Je...@Sun.COM> on 2006/02/18 00:06:06 UTC

cleaning up page / user / session cache

this is in regard to the AAPP addition i am working on, that allows 
users and weblogs to be removed via HTTP deletes ...

i am experiencing some strange behavior from the roller web app after 
deleting users and weblogs. after deleting a user (though AAPP), i get 
an exception if i try to login again:

java.lang.NullPointerException
	org.roller.presentation.filters.MainPageCacheFilter.doFilter(MainPageCacheFilter.java:156)
	org.roller.presentation.filters.PersistenceSessionFilter.doFilter(PersistenceSessionFilter.java:43)


after this exception, the server is dead and any request gives me the 
above exception. if i manually remove my cookie for web container, 
everything clears up.

also, after removing a weblog, i still see the weblog and entries for 
that weblog on the front page. clicking on them gives me an error page 
... but it would be nice to have them disappear immediately.

i assume this is because i need to clear out some caches somewhere. any 
pointers on the correct way to do this?

thanks.

Re: cleaning up page / user / session cache

Posted by Matt Raible <mr...@gmail.com>.
On 2/17/06, Allen Gilliland <Al...@sun.com> wrote:
> On Fri, 2006-02-17 at 15:06, Jeff Blattman wrote:
> > this is in regard to the AAPP addition i am working on, that allows
> > users and weblogs to be removed via HTTP deletes ...
> >
> > i am experiencing some strange behavior from the roller web app after
> > deleting users and weblogs. after deleting a user (though AAPP), i get
> > an exception if i try to login again:
> >
> > java.lang.NullPointerException
> >       org.roller.presentation.filters.MainPageCacheFilter.doFilter(MainPageCacheFilter.java:156)
> >       org.roller.presentation.filters.PersistenceSessionFilter.doFilter(PersistenceSessionFilter.java:43)
> >
> >
> > after this exception, the server is dead and any request gives me the
> > above exception. if i manually remove my cookie for web container,
> > everything clears up.
>
> this is an Acegi bug of some sort.  something gets saved in your session and Acegi apparently tries to use it without checking if it's null.  i'm not sure what the proper resolution to this would be, maybe somehow trigger a logout after delete a user?

Not so much a bug, but more of a feature. ;-)  Acegi has a "userCache"
that keeps the user cached.  We need to update (or expire) this when a
user's record is updated.  In AppFuse, we do this with an AOP
interceptor after the saveUser() method executes.

http://fisheye5.cenqua.com/viewrep/~raw,r=1.6/appfuse/src/service/org/appfuse/service/UserSecurityAdvice.java

http://tinyurl.com/bfdf9

Removing the "userCache" from the daoAuthenticationProvider bean is
another solution.

    <bean id="daoAuthenticationProvider"
class="net.sf.acegisecurity.providers.dao.DaoAuthenticationProvider">
         <property name="authenticationDao" ref="jdbcAuthenticationDao"/>
         <!--property name="userCache" ref="userCache"/-->
    </bean>

Matt

>
> >
> > also, after removing a weblog, i still see the weblog and entries for
> > that weblog on the front page. clicking on them gives me an error page
> > ... but it would be nice to have them disappear immediately.
>
> yep, that would be important.
>
> >
> > i assume this is because i need to clear out some caches somewhere. any
> > pointers on the correct way to do this?
>
> it's pretty simple actually.  there are a variety of invalidate() methods that are part of the CacheManager class which controls the presentation level cache.  when you have an object that has been changed and you want to notify the caches then simply call CacheManager.invalidate(object).
>
> it's fine to pass in an object you just deleted, this is how things work when an entry, category, etc, is deleted.
>
> -- Allen
>
> >
> > thanks.
>
>

Re: cleaning up page / user / session cache

Posted by Allen Gilliland <Al...@Sun.COM>.
On Fri, 2006-02-17 at 15:06, Jeff Blattman wrote:
> this is in regard to the AAPP addition i am working on, that allows 
> users and weblogs to be removed via HTTP deletes ...
> 
> i am experiencing some strange behavior from the roller web app after 
> deleting users and weblogs. after deleting a user (though AAPP), i get 
> an exception if i try to login again:
> 
> java.lang.NullPointerException
> 	org.roller.presentation.filters.MainPageCacheFilter.doFilter(MainPageCacheFilter.java:156)
> 	org.roller.presentation.filters.PersistenceSessionFilter.doFilter(PersistenceSessionFilter.java:43)
> 
> 
> after this exception, the server is dead and any request gives me the 
> above exception. if i manually remove my cookie for web container, 
> everything clears up.

this is an Acegi bug of some sort.  something gets saved in your session and Acegi apparently tries to use it without checking if it's null.  i'm not sure what the proper resolution to this would be, maybe somehow trigger a logout after delete a user?

> 
> also, after removing a weblog, i still see the weblog and entries for 
> that weblog on the front page. clicking on them gives me an error page 
> ... but it would be nice to have them disappear immediately.

yep, that would be important.

> 
> i assume this is because i need to clear out some caches somewhere. any 
> pointers on the correct way to do this?

it's pretty simple actually.  there are a variety of invalidate() methods that are part of the CacheManager class which controls the presentation level cache.  when you have an object that has been changed and you want to notify the caches then simply call CacheManager.invalidate(object).

it's fine to pass in an object you just deleted, this is how things work when an entry, category, etc, is deleted.

-- Allen

> 
> thanks.


Re: cleaning up page / user / session cache

Posted by Allen Gilliland <Al...@Sun.COM>.
i think the reason the stack trace lists the page cache filter is because when you are logged in the page cache filter will build a user specific key, so it will try and figure out your username.  that's what's generating the exception.

the bug is in Acegi though.

-- Allen


On Fri, 2006-02-17 at 15:13, Jeff Blattman wrote:
> obviously, this only happens if i've logged in from my browser as the 
> user i just deleted.
> 
> Jeff Blattman wrote:
> >
> > after this exception, the server is dead and any request gives me the 
> > above exception. if i manually remove my cookie for web container, 
> > everything clears up.
> >


Re: cleaning up page / user / session cache

Posted by Jeff Blattman <Je...@Sun.COM>.
obviously, this only happens if i've logged in from my browser as the 
user i just deleted.

Jeff Blattman wrote:
>
> after this exception, the server is dead and any request gives me the 
> above exception. if i manually remove my cookie for web container, 
> everything clears up.
>