[patch]thread safety connection pool for all backend
|Reported by:||junzhang.jn@…||Owned by:||adrian|
|Component:||Database layer (models, ORM)||Version:|
|Severity:||normal||Keywords:||connection pool db|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Django uses the same connection for all threads. It breaks any database when using transaction or in multithread web server.
this patch is implemented to avoid it.
like ticket  but for all.
- use AutoReleaseCursor return connection object to pool when cursor deleted.
- use connections dict protect threaded active connection.
- db backend must implement a get_check_sql function to provide a sql which can check a connection's health.
def get_check_sql(): return "select top 1 1 from sysfiles"
def get_check_sql(): return "select 1 from dual";
sorry for my very very poor english.
Change History (10)
comment:2 Changed 10 years ago by eugene@…
- Resolution set to duplicate
- Status changed from new to closed