cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrus Adamchik (JIRA)" <>
Subject [jira] [Commented] (CAY-1782) Deadlock when performing many concurrent inserts
Date Wed, 19 Dec 2012 08:51:12 GMT


Andrus Adamchik commented on CAY-1782:

Aside from the discussion of a better implementation... 

1. Should we synchronize on 'pks' here instead of 'pkCache'  ?

synchronized (pkCache) {
  value = pks.first();

2.  while (!pkCache.replace(entity.getName(), pks, nextPks))

I suggest we add some last resort exit condition in case our thread never gets a chance to
set its PK. Maybe a for loop from 0 to 999, and then throw an exception?
> Deadlock when performing many concurrent inserts
> ------------------------------------------------
>                 Key: CAY-1782
>                 URL:
>             Project: Cayenne
>          Issue Type: Bug
>          Components: Core Library
>    Affects Versions: 3.0, 3.1 (final), 3.2M1
>            Reporter: John Huss
>            Assignee: John Huss
>             Fix For: 3.2M1
> I've encountered a deadlock issue in production in an app performing many INSERTs.  The
deadlock was between the PK generator and the PoolManager (getting a DB connection).  It is
very bad.  I added a unit test demonstrating the problem and a fix for it.
> The fix is possibly not ideal because it requires a larger data structure for holding
the cached primary keys, but it is far better than the previous behavior.
> If this fix is acceptable this should be back-ported to 3.1 as well.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message