grouper-dev - RE: [grouper-dev] Strange error while creating groups
Subject: Grouper Developers Forum
List archive
- From: Chris Hyzer <>
- To: "" <>, Grouper Dev <>
- Subject: RE: [grouper-dev] Strange error while creating groups
- Date: Tue, 11 Aug 2009 17:25:37 -0400
- Accept-language: en-US
- Acceptlanguage: en-US
I went ahead and made these fixed in 1.4 (synchronize the delete, and delete
the cache when GrouperSession stop()). Can you do three things? :
################################
1. Get the latest Grouper 1.4 branch API (if you aren't on 1.4.2, see the
change log for upgrade instructions):
cvs
-d:pserver::/home/cvs/i2mi
login
cvs
-d:pserver::/home/cvs/i2mi
export -r GROUPER_1_4_BRANCH grouper
cd grouper
export ANT_HOME=/home/appadmin/software/apache-ant-1.7.0
/home/appadmin/software/apache-ant-1.7.0/bin/ant dist
###############################
2. Make sure to stop any GrouperSessions you use, in finally blocks
FROM:
public void resetGroupMembers(final DynamicGroupDefinition definition) {
try {
final GrouperSession session = GrouperSession.start(
SubjectFinder.findRootSubject(), false);
GrouperSession.callbackGrouperSession(session,
new ResetGroupMembersCallback(this, definition.getGroupUUID()));
} catch (SessionException e) {
LOGGER.error(e, e);
}
}
TO:
public void resetGroupMembers(final DynamicGroupDefinition definition) {
GrouperSession session = null;
try {
session = GrouperSession.start(SubjectFinder.findRootSubject(), false);
GrouperSession.callbackGrouperSession(session,
new ResetGroupMembersCallback(this, definition.getGroupUUID()));
} catch (SessionException e) {
LOGGER.error(e, e);
} finally {
GrouperSession.stopQuietly(session);
}
}
############################################
3. Try again and let me know how it goes...
Thanks!
Chris
> -----Original Message-----
> From: Chris Hyzer
> Sent: Tuesday, August 11, 2009 12:16 PM
> To:
> '';
> Grouper Dev
> Subject: RE: [grouper-dev] Strange error while creating groups
>
> One problem is in ehcache:
>
> for (int i = 0; i < ALL_CACHE_MANAGERS.size(); i++) {
> CacheManager cacheManager = (CacheManager)
> ALL_CACHE_MANAGERS.get(i);
>
> I think if a cache is removed in another thread (GC) between those
> lines, then you can the out of bounds exception... I looked in the
> latest ehcache, and the implementation is a little different as far as
> multi-threaading, but this bug still is there.
>
> I opened a bug report with ehcache:
> http://sourceforge.net/tracker/?func=detail&aid=2835670&group_id=93232&
> atid=603559
> Either way, we should upgrade to the latest soon.
>
> I noticed that GrouperSession does not close caches on "stop()", but
> only on finalize() (during garbage collection). So the caches will
> bulk up until garbage collection... so I think a medium term solution
> is to close caches on GrouperSession.stop(). If there aren't 200 cache
> managers, this is less likely to happen...
>
> An easy solution that might help is to synchronize the cache creation
> on the same resource that the cache remove in ehcache is
> synchronized...
>
> Can you confirm you are on the 1.4 branch, and I can try to implement
> something there that should fix this?
>
> Another solution which shouldn't be necessary is to have a static root
> grouper session (but still do the callbacks)....
>
> In other words, something like this
>
> FROM:
>
> /**
> * Creates a group if it does not exist, removes all its members
> otherwise .
> * @param definition The definition of the group.
> * @see
> org.esco.dynamicgroups.dao.grouper.IGroupsDAOService#resetGroupMembers(
> DynamicGroupDefinition)
> */
> public void resetGroupMembers(final DynamicGroupDefinition
> definition) {
> try {
> final GrouperSession session =
> GrouperSession.start(SubjectFinder.findRootSubject(), false);
> GrouperSession.callbackGrouperSession(session,
> new ResetGroupMembersCallback(this,
> definition.getGroupUUID()));
> } catch (SessionException e) {
> LOGGER.error(e, e);
> }
> }
>
> TO:
>
> private final static GrouperSession rootSession = null;
>
> private static GrouperSession rootSession() {
> if (rootSession == null) {
> try {
> rootSession =
> GrouperSession.start(SubjectFinder.findRootSubject(), false);
> } catch (SessionException e) {
> LOGGER.error(e, e);
> }
> }
> return rootSession;
> }
>
> /**
> * Creates a group if it does not exist, removes all its members
> otherwise .
> * @param definition The definition of the group.
> * @see
> org.esco.dynamicgroups.dao.grouper.IGroupsDAOService#resetGroupMembers(
> DynamicGroupDefinition)
> */
> public void resetGroupMembers(final DynamicGroupDefinition
> definition) {
> try {
> GrouperSession.callbackGrouperSession(rootSession(),
> new ResetGroupMembersCallback(this,
> definition.getGroupUUID()));
> } catch (SessionException e) {
> LOGGER.error(e, e);
> }
> }
>
> > -----Original Message-----
> > From: Arnaud Deman
> > [mailto:]
> > Sent: Tuesday, August 11, 2009 10:34 AM
> > To: Grouper Dev
> > Subject: [grouper-dev] Strange error while creating groups
> >
> > Hello,
> >
> > I am trying to stress test an extension of grouper that I have
> written
> > and of course ... it crashes :-( .
> >
> > It is no deterministic : this time it occurred after creating more
> than
> > 4500 groups but sometime it happens after 300 group creations.
> > Initially I thought it was because of a bad use of the grouper
> > sessions but I have corrected everything to use the callback
> > mechanism.
> >
> > I have joined the stack and the instruction which generates the
> > exception is :
> >
> > (in the method resetGroupMembersInternal)
> >
> > @SuppressWarnings("unchecked")
> > final Set<Member> members = group.getImmediateMembers();
> >
> > If someone has an idea of a direction to investigate, I would really
> > appreciate because I am not very inspired...
> >
> >
> >
> > Thanks,
> > Arnaud.
> >
> >
> > --
> >
> > Arnaud Deman
> > GIP RECIA
> > Parc d'activités les Aulnaies
> > 151 rue de la Juine - 45160 OLIVET
> > Tel : 02 38 42 14 69
> >
- Strange error while creating groups, Arnaud Deman, 08/11/2009
- RE: [grouper-dev] Strange error while creating groups, Chris Hyzer, 08/11/2009
- RE: [grouper-dev] Strange error while creating groups, Chris Hyzer, 08/11/2009
- Re: [grouper-dev] Strange error while creating groups, Arnaud Deman, 08/12/2009
- Re: [grouper-dev] Strange error while creating groups, Arnaud Deman, 08/18/2009
- Re: [grouper-dev] Strange error while creating groups, Arnaud Deman, 08/12/2009
Archive powered by MHonArc 2.6.16.