Thread locking issue

Bug #488928 reported by Mindtilt on 2009-11-26
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
PySQLPool
Fix Released
Critical
Nikoleta Verbeck

Bug Description

Whe i use this method the program stuck and got a locked mysql connection
No stack trace show, have to manually kill the program and the mysql connection.

code:

import PySQLPool,datetime

class Connections(object):

    __pool= None
    __connection=None

    def __init__(self,host='localhost',username='ploonorkut',password='19780327',schema='postx'):

       self.__connection = PySQLPool.getNewConnection(host, username, password, schema)
       PySQLPool.PySQLConnection.connection_timeout = datetime.timedelta(86400)
       self.__pool = PySQLPool.getNewPool()
       self.__pool.GetConnection(self.__connection)#line producing error
       self.__pool.maxActiveConnections=5
       self.__pool.maxActivePerConnection=1

    def returnQuery(self):

        query= PySQLPool.getNewQuery(self.__connection,True)

        return query

Nikoleta Verbeck (nerdynick) wrote :

So the actual problem is the use of you Connections class(). PySQLPool manages all this for you. The only thing you may wish to keep track off to reduce code is the PySQLConnection object returned from PySQLPool.getNewConnection().

Each thread will want to call PySQLPool.getNewQuery(PySQLConnection *). As this is what allows the thread safe locking and opening of multiple connections to happen.

Sorry for this problem. I really need to get some documentation up.

Changed in pysqlpool:
milestone: none → 0.3.6
assignee: nobody → Nick Verbeck (nerdynick)
importance: Undecided → Critical
status: New → In Progress
Nikoleta Verbeck (nerdynick) wrote :

I've have started working on the Sphinx Generated Documentation to help out a bit. You can view the current build in the repo at http://code.google.com/p/pysqlpool/source/browse/#svn/branches/0.3.6/doc/_build/html or via checkout at http://pysqlpool.googlecode.com/svn/branches/0.3.6/doc/_build/html

Current the index page and a getting started page are in there. I have added a few example and what not to the getting started that should get you rolling on what you need to do. I will be continuing to push out more docs as the day/weekend continues. Hopefully I should have a enough there to help figure out how this thing works.

If you run into anything confusing in the docs please let me know. So that I can fix it for everyone else, and make it a little clearer.

summary: - Version 0.3.5 ,python 2.5 ,PySQLPool.GetConnection(connObj)
+ Thread locking issue
Changed in pysqlpool:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers