473,466 Members | 1,658 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Multi Threading Problem with Python + Django + PostgreSQL.

3 New Member
Hello every body. I am new to this forum and also in Python.
Read many things about multi threading in python. But still having problem.

I am using Django Framework with Python having PostgreSQL as backend database with Linux OS. My applications are long running. I am using threading.
The problem I am facing is that the connections that are being created for database(postgres) update are not getting closed even though my threads had returned and updated database successfully. It is not like that the connections are not being reused. They r being reused but after sometime new one is created. Like this it creates too many connections and hence exceeding MAX_CONNECTION limit of postgres conf.

** I am using psycopg2 as adaptor for python to postgres connection. which itself handles the connections(open/close)

Now the problem is with Django / Python / psycopg2 or any thing else??

HELP ME OUT!!!!!
Mar 26 '08 #1
3 2173
micmast
144 New Member
Do you close the connection when the thread terminates?
Doesn't the connection timeout from the postgres side?
Mar 27 '08 #2
pradipbhosale
3 New Member
Actualy the django itself manages connections through that pcycopg (correct me if i am wrong). I am not explicitly opening any database connection. The statements are like below in django . Suppose 'my_table' is name of table.

obj_table = my_table.objects.get(Name = 'David Beckham');

print obj_table.Name
>> David Beckham

So we never explicitly create any connection. So no question about closing it explicitly.
Mar 31 '08 #3
micmast
144 New Member
if you don't have anything to say about wether or not a connection has to be closed, maybe try to close it from the postgres side with a timeout value or something. if possible
Mar 31 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Garry Hodgson | last post by:
a colleague of mine has seen an odd problem in some code of ours. we initially noticed it on webware, but in distilling a test case it seems to be strictly a python issue. in the real system, it...
37
by: ajikoe | last post by:
Hello, Is anyone has experiance in running python code to run multi thread parallel in multi processor. Is it possible ? Can python manage which cpu shoud do every thread? Sincerely Yours,...
1
by: Carl Waldbieser | last post by:
I have been considering using Python and the Reportlab library for generating PDF reports for the back-end of a web based application. The application runs most of its background tasks on a...
48
by: northband | last post by:
Hi, I am interested in re-writing my website in Python vs PHP but have a few questions. Here are my specs, please advise as to which configuration would be best: 1.Dell Poweredge Server, w/IIS,...
113
by: John Nagle | last post by:
The major complaint I have about Python is that the packages which connect it to other software components all seem to have serious problems. As long as you don't need to talk to anything outside...
2
by: Ben | last post by:
I'm looking for a web application framework with a good interface to PostgreSQL. The app I'm developing is relatively simple, but I'm new to coding, so it needs to be easy. What I'm making is...
14
by: Akihiro KAYAMA | last post by:
Hi all. I found cooperative multi-threading(only one thread runs at once, explicit thread switching) is useful for writing some simulators. With it, I'm able to be free from annoying mutual...
1
by: Pradip | last post by:
Hello every body. I am new to this forum and also in Python. Read many things about multi threading in python. But still having problem. I am using Django Framework with Python having PostgreSQL...
6
by: idev | last post by:
Hi all, Please help me with my stuff. I downloaded python 2.5.1 package from http://blastwave.org it was compiled using Sun Studio 11 for Solaris 8 sparc. My system is Solaris 10 sparc and I...
1
by: Bruce Frederiksen | last post by:
I wanted to make everybody aware that I've posted a (rather long and involved) PEP proposal for adding micro-threading to Python on python-ideas for feedback and review. In a nutshell, this...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.