Accessing dead thread objects while using SQLAlchemy with Pylons Paste HTTP Server

Issue #754 resolved
Former user created an issue

While using SQLAlchemy 0.4.0beta4 with Paste HTTP Server (threaded) in high load conditions (such as testing server performance with Apache Bench), I'm getting an error:

'sqlalchemy/pool.py', line 158 in connect return self._threadconnsthread.get_ident()().checkout() AttributeError: 'NoneType' object has no attribute 'checkout'

(full traceback in attached file)

When I'm using SQLAlchemy 0.4beta3 all seems fine.

To setup my application I closely followed 'SQLAlchemy 0.4 for people in a hurry' tutorial http://wiki.pylonshq.com/display/pylonscookbook/SQLAlchemy+0.4+for+people+in+a+hurry

Unfortunately I can't attach a complete test case, because of the nature of this problem (threading).

Comments (3)

  1. Mike Bayer repo owner

    OK, im glad this came up. I'd very much like you to try e755e90681b4059c2636e34a4d4f0ace1f4ef387, where I've restored the usage of a WeakValueDictionary there instead of a regular dict of weakrefs. While i could also have tried a conditional check here, i dont like the idea of the dict growing with dead weakrefs. Whats still different versus beta3 is that the connection pool is using the "threadlocal" setting internally, for connections that are used by "connectionless" executions only. So if your high load app runs fine with it (which it should), then we know we're getting pretty stable.

    Im hoping to put out beta4 today as well...but I really want to see at least how well 3406 runs. if still issues, reopen the ticket and maybe we'll have to reconsider the "threadlocal" setting totally.

  2. Log in to comment