You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Oleg Lyalikov (JIRA)" <ji...@apache.org> on 2011/06/20 15:43:47 UTC

[jira] [Created] (OPENJPA-2019) 2 connections can be opened simultaneously during some DataCache work inside single query.getResultList()

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

        

[jira] [Updated] (OPENJPA-2019) 2 connections can be opened simultaneously during some DataCache work inside single query.getResultList()

Posted by "Oleg Lyalikov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-2019?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Lyalikov updated OPENJPA-2019:
-----------------------------------

    Attachment: jpa_datacache_stack_trace.txt
                jpa-data-cache.zip

> 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
>         Attachments: jpa-data-cache.zip, jpa_datacache_stack_trace.txt
>
>
> 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

        

[jira] [Updated] (OPENJPA-2019) 2 connections can be opened simultaneously during some DataCache work inside single query.getResultList()

Posted by "Oleg Lyalikov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-2019?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Lyalikov updated OPENJPA-2019:
-----------------------------------

    Description: 
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.

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).

Attached test project and stack trace of getting second connection.

Sometimes test can successfully finish (~5-10% of all runs) - it's hard to make it deterministic.

  was:
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).


> 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
>         Attachments: jpa-data-cache.zip, jpa_datacache_stack_trace.txt
>
>
> 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.
> 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).
> Attached test project and stack trace of getting second connection.
> Sometimes test can successfully finish (~5-10% of all runs) - it's hard to make it deterministic.

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