grouper-dev - RE: [grouper-dev] 2.1.2 hook writer not writing?
Subject: Grouper Developers Forum
List archive
- From: Jim Fox <>
- To: Chris Hyzer <>
- Cc: Grouper Dev <>
- Subject: RE: [grouper-dev] 2.1.2 hook writer not writing?
- Date: Thu, 13 Dec 2012 12:59:35 -0800 (PST)
Here's the trouble.
There is new code in the HibernateSession constructor:
//if we arent using nested transactions, then just use parent if there is
one...
if (!GrouperConfig.getPropertyBoolean("ddlutils.use.nestedTransactions", true)
&& parentHibernateSession != null) {
grouperTransactionType =
parentHibernateSession.getGrouperTransactionType();
//we dont want new transactions... not sure what happens if none... hmm
if (grouperTransactionType.isNewAutonomous()) {
if (grouperTransactionType == GrouperTransactionType.READ_WRITE_NEW) {
grouperTransactionType =
GrouperTransactionType.READ_WRITE_OR_USE_EXISTING;
} else if (grouperTransactionType ==
GrouperTransactionType.READONLY_NEW) {
grouperTransactionType =
GrouperTransactionType.READONLY_OR_USE_EXISTING;
}
}
LOG.debug("Not using nested transactions, converting transaction type to:
" + parentHibernateSession.getGrouperTransactionType());
}
That's causing the sessions obtained by the hook loop to be reused parents,
instead of new. The parent's session appears to be already committed.
If I set "ddlutils.use.nestedTransactions = true", to bypass the new code
then I get new sessions and the hooks automatically complete.
Don't know the reason for the new code, but it might need another check
somewhere to see if the parent should really be reused.
Jim
On Thu, 13 Dec 2012, Jim Fox wrote:
Date: Thu, 13 Dec 2012 11:54:18 -0800
From: Jim Fox
<>
To: Chris Hyzer
<>
Cc: Grouper Dev
<>
Subject: RE: [grouper-dev] 2.1.2 hook writer not writing?
And some more:
If I use HibernateSession's toString,
With 2.1.2 (and postgres version 9) I see,
(right after the transaction is created and just before executing the hook)
HibernateSession hibernateSession = hibernateHandlerBean.getHibernateSession();
log of hibernateSession.toString() shows: isNew: false
But with 2.0.0 (postgres 8) I see in the same place
HibernateSession hibernateSession = hibernateHandlerBean.getHibernateSession();
log of hibernateSession.toString() shows: isNew: true
So, for some reason the session created in that hook loop
is no longer a new session.
Jim
On Wed, 12 Dec 2012, Jim Fox wrote:
Date: Wed, 12 Dec 2012 13:38:42 -0800
From: Jim Fox
<>
To: Chris Hyzer
<>
Cc: Grouper Dev
<>
Subject: RE: [grouper-dev] 2.1.2 hook writer not writing?
Also, in that same code, right after
HibernateSession hibernateSession = hibernateHandlerBean.getHibernateSession();
hibernateSession.isTransactionActive() is false
and after executeHook it is still false.
I've tried this with my web service and also with gsh.
--------------------------------
root=GrouperSession.startRootSession()
g=GroupFinder.findByName(root, "u:fox:browser6")
mset=g.getMembers(); marr=mset.toArray()
g.deleteMember(marr[0])
--------------------------------
Same result either way.
Jim
I added some logging and a try/catch around the executeHook and commit statements.
Jim
I will look when I get home (where I had it running), though in the meantime, when I look at 2.1.2 source (attached), I don't see log lines on the line numbers listed. E.g. GrouperHooksUtils 498 and 504... any ideas why? :)
Thanks,
Chris
-----Original Message-----
From: Jim Fox
[mailto:]
Sent: Wednesday, December 12, 2012 3:35 PM
To: Chris Hyzer
Cc: Grouper Dev
Subject: RE: [grouper-dev] 2.1.2 hook writer not writing?
Here's what I'm seeing.
In GrouperHooksUtils.schedulePostCommitHooksIfRegistered
There is the call to execute the hook
executeHook(method, hook, finalHooksBean, hooksContext, null, asychronous);
followed by a call to commit
hibernateSession.commit(GrouperCommitType.COMMIT_NOW);
[ I put an exception catch around the commit. ]
The first statement executes fine, debug log shows:
GrouperHooksUtils.executeHook(498) - START: Hook UWMembershipHooks.membershipPostCommitAddMember id: RKW6SJT1
HibernateSession.<init>(151) - Not using nested transactions, converting transaction type to: READ_WRITE_NEW
GrouperHooksUtils.executeHook(504) - END (normal): Hook UWMembershipHooks.membershipPostCommitAddMember id: RKW6SJT1 (9ms)
and the spy log shows:
1ms, statement: Method.java.invoke() line 601, GrouperUtil.java.invokeMethod() line 3896,
GrouperHooksUtils.java.executeHook() line 502, GrouperHooksUtils.java.access$100() line 56,
GrouperHooksUtils.java.callback() line 437, GrouperHooksUtils.java.afterCompletion() line 427,
Group.java.internal_addMember() line 1115, Group.java.addMember() line 942, Group.java.addMember() line 861
insert into uw_activity (time, action, group_id, data, actors) values (1355343520114, 'pm', 'a1681c3fcba3f54f759e6c9432004381', 'uwpds imf', 'fox|fox')
Then the commit statement fails:
GrouperHooksUtils$1$1$1.callback(444) - commit: org.hibernate.TransactionException: Transaction not successfully started
So the commit fails and the next thing spy shows is a rollback.
If I do the commit manually, in the hook, with
HibernateSession.bySqlStatic().executeSql( "commit");
That works.
Jim
- RE: [grouper-dev] 2.1.2 hook writer not writing?, (continued)
- RE: [grouper-dev] 2.1.2 hook writer not writing?, Chris Hyzer, 12/11/2012
- RE: [grouper-dev] 2.1.2 hook writer not writing?, Jim Fox, 12/11/2012
- Message not available
- RE: [grouper-dev] 2.1.2 hook writer not writing?, Jim Fox, 12/11/2012
- RE: [grouper-dev] 2.1.2 hook writer not writing?, Chris Hyzer, 12/11/2012
- Message not available
- RE: [grouper-dev] 2.1.2 hook writer not writing?, Chris Hyzer, 12/12/2012
- RE: [grouper-dev] 2.1.2 hook writer not writing?, Jim Fox, 12/12/2012
- RE: [grouper-dev] 2.1.2 hook writer not writing?, Chris Hyzer, 12/12/2012
- RE: [grouper-dev] 2.1.2 hook writer not writing?, Jim Fox, 12/12/2012
- RE: [grouper-dev] 2.1.2 hook writer not writing?, Jim Fox, 12/12/2012
- RE: [grouper-dev] 2.1.2 hook writer not writing?, Jim Fox, 12/13/2012
- Message not available
- RE: [grouper-dev] 2.1.2 hook writer not writing?, Jim Fox, 12/13/2012
- RE: [grouper-dev] 2.1.2 hook writer not writing?, Chris Hyzer, 12/15/2012
- Re: [grouper-dev] 2.1.2 hook writer not writing?, Jim Fox, 12/15/2012
- RE: [grouper-dev] 2.1.2 hook writer not writing?, Chris Hyzer, 12/16/2012
- RE: [grouper-dev] 2.1.2 hook writer not writing?, Chris Hyzer, 12/12/2012
- Message not available
- RE: [grouper-dev] 2.1.2 hook writer not writing?, Chris Hyzer, 12/11/2012
- RE: [grouper-dev] 2.1.2 hook writer not writing?, Jim Fox, 12/11/2012
- RE: [grouper-dev] 2.1.2 hook writer not writing?, Chris Hyzer, 12/11/2012
Archive powered by MHonArc 2.6.16.