Hi,

Returning to this old message.

On 2014-11-25, 10:38 AM, "OC" wrote:

Chuck,

thanks a very big lot!

On 25. 11. 2014, at 19:11, Chuck Hill 
<[email protected]<mailto:[email protected]>> wrote:

There are no simple solutions.  You need to be aware of where this can happen 
in your app and code for it.

A thorough refactoring is exactly what I would very much like to do :)

Alas, most of the current code is pretty old, written years ago with a firm 
intention to run single-instance (and even without  
WOAllowsConcurrentRequestHandling), and before I get the time to re-write the 
guts and do it right, I must make the current thing at least _somewhat_ stable 
and useable.

When I get the "condition 379. Optimistic locking: multiple transaction 
conflict detected" I do essentially nothing -- I just wait a random couple of 
tenths of second, and retry.
I have seen that, but very rarely.  If all of the connections to the data base 
use "/isolation=read_committed/locking=optimistic" you should not get this.  I 
have caused this by using FrontBase Manager or some other tool to look at the 
database as it used a different isolation level and / or (don't recall) locking

I might be wrong, but I believe it happens whenever two separate instances 
happen to update both before they commit, e.g., A: update, B: update (same 
row), A: commit, B: commit.

Depends on the application logic how probable this is, but I believe in 
principle it can always happen, and I believe if it does, in this scenario -- 
with the "TRANSACTION ISOLATION LEVEL read committed, LOCKING optimistic" 
setting in both sessions -- the latter commit consistently yields "Exception 
379. Optimistic locking: multiple transaction conflict detected".

It happens to me occassionally; far as I can say, the isolation level is all 
right. Of course, I may be wrong, as always.

No, you are correct.  That is a transient failure causing by a commit race 
exactly as you noticed.  Thank you for making me go back and look at that.  I 
have now added code to my frameworks to detect this (so far just for FrontBase 
as I have no examples from other database), and retry the save.  I do that in a 
loop and give up after N attempts.  The retried save either succeeds normally, 
or fails with a standard optimistic locking exception that my other code 
already handles.  Nice!

Thanks!

Chuck



By the way, leads me to another question -- is there a way to send SQL and read 
the result string? I actually wanted to send "show transaction;" and put the 
result to my application log, to be sure the setting works on the production 
server (where I can't check through FBManager). I have found I should be able 
to use ERXEOAccessUtilities.evaluateSQLWithEntity(Named) to send the SQL, but I 
can't see how to obtain the results?

Thanks a lot again,
OC


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to