Re: [sqlalchemy] SQLAlchemy Memory Leak

2020-02-26 Thread João Miguel Neves
Hi, When you go through the objects, do you remove them from the session with session.expire(obj)? Hope this helps, João On Wed, 26 Feb 2020 at 17:09, Ahmed Cheikh wrote: > Hello Everybody, > > I used SQLAlchemy in one of my projects. And in this project, I loop over > many objects. I use for

Re: [sqlalchemy] Re: Help with configuring connect_timeout setting for when we a high available postgres database drops

2020-02-26 Thread Karim Gillani
Any suggestions on how to do that? I believe that SQLAlchemy is using the psycopg2-binaries so we can add debugging to the library. Can we override what it uses easily? At this point I am stuck and my dev's don't know how to proceed :( Do you know of a way to display what is being sent to th

Re: [sqlalchemy] Re: Help with configuring connect_timeout setting for when we a high available postgres database drops

2020-02-26 Thread Jonathan Vanasco
I would also throw a few debug lines into psycopg2 and ensure that library is creating a connection with the params you intend. On Wednesday, February 26, 2020 at 11:19:28 AM UTC-5, Karim Gillani wrote: > > Thanks. I don't believe this is a Red Hat issue as much as a > configuration issue. T

[sqlalchemy] Re: SQLAlchemy Memory Leak

2020-02-26 Thread Jonathan Vanasco
Memory leaks caused by SqlAlchemy are extremely rare. The code is in heavy production with tens of thousands of users. If there is a memory leak, it is likely caused by another library, or your code in how you are using SqlAlchemy. Your next step should be creating a "Short, Self Contained, Cor

[sqlalchemy] SQLAlchemy Memory Leak

2020-02-26 Thread Ahmed Cheikh
Hello Everybody, I used SQLAlchemy in one of my projects. And in this project, I loop over many objects. I use for each object the same engine and session object to query from my database. What I noticed is that for each loop, there is an increase in the memory usage. I checked all the other

Re: [sqlalchemy] Re: Help with configuring connect_timeout setting for when we a high available postgres database drops

2020-02-26 Thread Karim Gillani
Thanks. I don't believe this is a Red Hat issue as much as a configuration issue. This is because I can replicate the issue using PSQL and using the connect_timeout argument in PSQL, I can fix it. With the complexity of using flask-sqlalchemy which uses sqlalchemy to pass arguments to psycopg2 t

Re: [sqlalchemy] Re: Help with configuring connect_timeout setting for when we a high available postgres database drops

2020-02-26 Thread Mike Bayer
This would be a psycopg2 level setting which are documented at https://www.psycopg.org/docs/module.html#psycopg2.connect and the available values are ultimately at https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PARAMKEYWORDS . On the SQLAlchemy side you pass these to create_en