2 connections can be opened simultaneously during some DataCache work inside 
single query.getResultList()
---------------------------------------------------------------------------------------------------------

                 Key: OPENJPA-2019
                 URL: https://issues.apache.org/jira/browse/OPENJPA-2019
             Project: OpenJPA
          Issue Type: Bug
          Components: datacache, kernel, query
    Affects Versions: 2.0.0
         Environment: WinXP SP3, JDK 1.6.0_21, Postgres 
            Reporter: Oleg Lyalikov


Test configuration:

@Entity
public class Document { ... }

@Entity
public class Person {
    ...
    @JoinTable(name="person_document", joinColumns = 
{@JoinColumn(name="person_id", referencedColumnName="ID")}, inverseJoinColumns 
= {@JoinColumn(name="documents_id", referencedColumnName="ID")})
    @OneToMany(fetch = FetchType.EAGER)
    private List<Document> documents;
    ...
}

Test case:
0. Set DataCache to: true(CacheSize=40, SoftReferenceSize=0), and limit 
connection pool size by 1 connection
1. Create 20 objects of Person entity (+ 3 documents per each Person): 80 
objects total (only half of objects can be located in data cache)
2. Clear entity manager and run query "SELECT p FROM Person p WHERE p.id IN 
(?1, ?2, ... , ?20)"
Openjpa tries to open second connection at some time and fails.

Attached test project and stack trace of getting second connection.

The problem is significant for me because I have lots of threads executing 
queries like in 2. point and I have hard limits on connection pool size. I 
cannot have connection_pool_size > possible_threads_count. So at some time I 
get connection pool exhausted and application stops working.

It seems that the problem is related to DataCache work and L1 cache work (I 
didn't reproduce the problem with big sized or small sized DataCache - to 
reproduce it's better to assign DataCache size = 1/2 of total query objects 
count. Also I didn't reproduce it with Ehcache and openjpa-2.2.0 with Lru=true).

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to