assuming youre using postgres, when it hangs you should take a look at the pg_locks table:


and also you should install the threadframe module:


and create an additional page in your application that when accessed will produce a dump of all current callstacks.  that will provide a lot of insight into what concurrent operations are going on.

just an example of how you can deadlock even in a single thread, say youre using two connections A and B.  A opens a transaction and accesses table X.  B opens a transaction and accesses table Y.  then you try to access table Y within A - deadlock !  since B has a lock on Y...all within one thread.

if youre using SQLAlchemy's ORM, it *should* only be using one connection per thread at a time (although if so, it would be nice to see those stack traces to see where it might be tripping up), and when connections are returned it calls a rollback() to release any locks held by that connection.  if youre doing your own SQL using engine.connect(), then you have the possibility of the situation above.

its in SA's interests to have this issue resolved so feel free to send along whatever additional information you can gather.

On Jun 23, 2006, at 1:58 AM, Dennis Muhlestein wrote:

Ok, so I've upgraded mydrawings.com to use SQLAlchemy 0.2.3 a few days ago w/ the hopes that any database locking up problems on 0.1.x were alleviated.  I'm still having lockups though.

I installed httprepl into cherrypy
(See this thread for details: http://groups.google.com/group/turbogears/browse_thread/thread/05f1ebee0c5eda24/ )

I happened to catch the server tonight in the process of locking up.  Before it completely locked up, I switched that server out of the pool.  I've left the server in a state where some threads are locked up but the server will still service requests.

I installed a filter that shows which requests are currently being serviced.  Sure enough, threads that tried to access the database in any way are locking at the database access.  I confirmed this by typing a simple query command into the httprepl screen.  As soon as I entered execute().. that request then locked up too.  The requests never timeout or error out.  They simply stay hung until all threads in the server are locked up and the server serves no requests.

So.. the question is, any suggestions on how to figure out what the heck is going on?  I'm not using the threadlocal import for 0.1.x compatibility.  I updated all object mappings to use the session/query api.  I'm still using select in a lot of places w/ out a session object though.

Thanks
Dennis
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
_______________________________________________
Sqlalchemy-users mailing list

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to