Skip to Content.
Sympa Menu

grouper-users - Re: [grouper-users] Exceptions caused by threading ?

Subject: Grouper Users - Open Discussion List

List archive

Re: [grouper-users] Exceptions caused by threading ?


Chronological Thread 
  • From: Tom Barton <>
  • To: "GW Brown, Information Systems and Computing" <>
  • Cc: Tom Zeller <>,
  • Subject: Re: [grouper-users] Exceptions caused by threading ?
  • Date: Wed, 10 Oct 2007 09:35:04 -0500

This seems worthy of a Jira issue. TomZ, would you mind doing the honors?

GW Brown, Information Systems and Computing wrote:
Tom,

It isn't 'reasonable' that you get the error, but it is understandable.

MemberFinder.findBySubject(s, SubjectFinder.findById("foo"));

Internally, Grouper checks to see if a record exists. If not it will attempt to create one. If two threads do the same check at the same time, or within a very short space of time, one will succeed in creating a grouper_members record, but the other will fail.

In principle MemberFinder could catch the exception and attempt a new lookup, but that would require a code change.

Gary


--On 10 October 2007 08:00 -0500 Tom Zeller
<>
wrote:

Greetings,

Is it reasonable that multiple threads executing :

MemberFinder.findBySubject(s, SubjectFinder.findById("foo"));

may result in :

Exception in thread "Thread-17"
edu.internet2.middleware.grouper.internal.dao.GrouperDAOException: Could
not execute JDBC batch update at
edu.internet2.middleware.grouper.internal.dao.hibernate.HibernateMemberD
AO.create(HibernateMemberDAO.java:76)
at
edu.internet2.middleware.grouper.MemberFinder.internal_findOrCreateBySub
ject(MemberFinder.java:139)
at
edu.internet2.middleware.grouper.MemberFinder.internal_findBySubject
(MemberFinder.java:123)
at edu.internet2.middleware.grouper.MemberFinder.findBySubject
(MemberFinder.java:53)
...
Caused by: net.sf.hibernate.exception.ConstraintViolationException:
Could not execute JDBC batch update
...
Caused by: java.sql.BatchUpdateException: Batch entry 0 insert into
grouper_members (member_uuid, subject_id, subject_source, subject_type,
id) values (5add0097-84b4-4c79-9e41-2588c622bd52, foo, umrsa, person,
0d61f1c2158669ff01158726d47a0013) was aborted. Call getNextException to
see the cause.
...
JDBCExceptionReporter:58 - ERROR: duplicate key violates unique
constraint "grouper_members_subject_id_key"
...
SessionImpl:2400 - Could not synchronize database state with session

?

I welcome advice regarding threads and Grouper.

Thank you,
Tom



----------------------
GW Brown, Information Systems and Computing




Archive powered by MHonArc 2.6.16.

Top of Page