FAQ
hi andrus,

i know that this issue sucks, but we are forced to solve it.

we did some further investigation of our live-environment and noticed that these idle connections appear only while our application is plugged into our loadbalancer. first we thought that this could be an concurrency or load issue, but regarding our logs, the load is close to zero...

i wondered if there is a way to get the current postgres-connection from cayenne. i dont know how jdbc-connections are wrapped bye cayenne and i dont want to search through the code, even though i might learn something ;-)

currently i am wondering about why the transaction is not properly closed and i think that the postgres people said, that this issue had been fixed decades ago, so i guess thats right. is there a way that the connection is not properly returned to the connection-pool after a request and because of that the transaction will not put to commit?

kind regards
peter


-----Ursprüngliche Nachricht-----
Von: Andrus Adamchik
Gesendet: Donnerstag, 26. April 2007 13:47
An: user@cayenne.apache.org
Betreff: Re: AW: AW: postgres, idle in transaction

On Apr 26, 2007, at 1:14 PM, Oilid Adsi wrote:

Or maybe by adding an explicit "COMMIT" after every SELECT-
Statement when the connection will be returned to the pool? Can
this implemented as an optional function to the Cayenne framework?
Per your comment the patch doing "rollback" didn't help, why do you
think "commit" should help? Commit and rollback both terminate a
transaction.

http://objectstyle.org/cayenne/lists/cayenne-user/2007/04/0159.html

But if you want to explore various scenarios, Cayenne allows you to
plug a custom implementation of DataSource via the DataSourceFactory
mechanism. So you don't need to patch Cayenne, but instead you can
write a custom DataSource (based on Cayenne or DBCP library, or do it
from scratch) to do any pre- or post- processing of connections
checked in or out of the pool.

If you get to the cause of it, please share. Unfortunately I am out
of ideas regarding this issue.

Andrus

Search Discussions

  • Tore Halset at Apr 27, 2007 at 6:53 am
    Hello.

    Creating your own DataSource (wrapper) as suggested by Andrus should
    give you good control over things that are happening and perhaps what
    to do/fix.

    I had a problem in some non-cayenne based code that did not close the
    jdbc Connection and it was hard to know where the problem was until I
    started store a "new Exception()" and a timestamp every time I
    created a new Connection. I then had the possibility to log
    stacktraces to places where the code created Connections that was not
    closed. Perhaps you could do something like that to track things in
    your DataSource wrapper?

    - Tore.
    On Apr 27, 2007, at 8:31 , Peter Schröder wrote:

    hi andrus,

    i know that this issue sucks, but we are forced to solve it.

    we did some further investigation of our live-environment and
    noticed that these idle connections appear only while our
    application is plugged into our loadbalancer. first we thought that
    this could be an concurrency or load issue, but regarding our logs,
    the load is close to zero...

    i wondered if there is a way to get the current postgres-connection
    from cayenne. i dont know how jdbc-connections are wrapped bye
    cayenne and i dont want to search through the code, even though i
    might learn something ;-)

    currently i am wondering about why the transaction is not properly
    closed and i think that the postgres people said, that this issue
    had been fixed decades ago, so i guess thats right. is there a way
    that the connection is not properly returned to the connection-pool
    after a request and because of that the transaction will not put to
    commit?

    kind regards
    peter


    -----Ursprüngliche Nachricht-----
    Von: Andrus Adamchik
    Gesendet: Donnerstag, 26. April 2007 13:47
    An: user@cayenne.apache.org
    Betreff: Re: AW: AW: postgres, idle in transaction

    On Apr 26, 2007, at 1:14 PM, Oilid Adsi wrote:

    Or maybe by adding an explicit "COMMIT" after every SELECT-
    Statement when the connection will be returned to the pool? Can
    this implemented as an optional function to the Cayenne framework?
    Per your comment the patch doing "rollback" didn't help, why do you
    think "commit" should help? Commit and rollback both terminate a
    transaction.

    http://objectstyle.org/cayenne/lists/cayenne-user/2007/04/0159.html

    But if you want to explore various scenarios, Cayenne allows you to
    plug a custom implementation of DataSource via the DataSourceFactory
    mechanism. So you don't need to patch Cayenne, but instead you can
    write a custom DataSource (based on Cayenne or DBCP library, or do it
    from scratch) to do any pre- or post- processing of connections
    checked in or out of the pool.

    If you get to the cause of it, please share. Unfortunately I am out
    of ideas regarding this issue.

    Andrus

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriescayenne
postedApr 27, '07 at 6:32a
activeApr 27, '07 at 6:53a
posts2
users2
websitecayenne.apache.org

2 users in discussion

Tore Halset: 1 post Peter Schröder: 1 post

People

Translate

site design / logo © 2022 Grokbase