[samigo-team] Issue with deadlock retry code

David Horwitz david.horwitz at uct.ac.za
Fri Mar 15 03:15:54 PDT 2013


Hi All,

I believe there is a problem with the deadlock retry code in the DOA layer that may result in hard to track down issues.

The code looks like this (several instances of the same pattern):


public void saveOrUpdate(AssessmentFacade assessment) {
AssessmentData data = (AssessmentData) assessment.getData();
data.setLastModifiedBy(AgentFacade.getAgentString());
data.setLastModifiedDate(new Date());
int retryCount = PersistenceService.getInstance().getPersistenceHelper().getRetryCount()
.intValue();
while (retryCount > 0) {
try {
getHibernateTemplate().saveOrUpdate(data);
retryCount = 0;
} catch (Exception e) {
log.warn("problem save new settings: " + e.getMessage());
retryCount = PersistenceService.getInstance().getPersistenceHelper().retryDeadlock(e,
retryCount);
}
}
}



There are 2 issues I've observed with this:

1) It retries errors that are fatal and can never succeed (minor issue eg. SAM-1167)
2) If it fails the error is logged but not swallowed, so the calling code assumes that the call succeeded and carries on (Critical).

Now in the second case it would seem there are 2 possibilities:

1) re throw the error appended to a run time error. This would not be intrusive and at least we would get an error report but would mean that users who encountered this would get an error report.

2) Change the method to throw an exception that calling code would have to handle. This would would require more extensive change but would  allow of better error handling for the user ("There was an error saving your response please try again")

What are the groups thoughts?

Regards

David
________________________________
UNIVERSITY OF CAPE TOWN

This e-mail is subject to the UCT ICT policies and e-mail disclaimer published on our website at http://www.uct.ac.za/about/policies/emaildisclaimer/ or obtainable from +27 21 650 9111. This e-mail is intended only for the person(s) to whom it is addressed. If the e-mail has reached you in error, please notify the author. If you are not the intended recipient of the e-mail you may not use, disclose, copy, redirect or print the content. If this e-mail is not related to the business of UCT it is sent by the sender in the sender's individual capacity.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/samigo-team/attachments/20130315/3212ab81/attachment.html 


More information about the samigo-team mailing list