Changeset [6fc8150]: Fixed #36027 -- Made error response rendering thread-sensitive. Error ...
![Changeset [6fc8150]: Fixed #36027 -- Made error response rendering thread-sensitive. Error ...](default-image.png)
Fixed #36027 -- Made error response rendering thread-sensitive. Error response handling frequently makes use of the database, and so must use the request specific connection sensitive worker thread. Previously response_for_exception was dispatched on the event loop's default executor. This potentially leads to pool exhaustion, and deadlock, when using database pooling option, or a large number of permanently held open database connections when not using pooling. Connections held open were not subject to cleanup. If closed server side, the reported "connection is closed" would be seen until application restart. Moving error response rendering to the request specific connection sensitive worker thread resolves both of these issues. The thread_sensitive=False was set in e17ee4468875077b90b70bb6a589ebad7493f757 to maintain the prior behaviour when asgiref switched the thread_sensitive default to True. There was no specific reason for the non-tread-sensitive behaviour beyond that. (With hindsight it was always incorrect for the reasons here.)
Take Your Experience to the Next Level
NewDownload our mobile app for a faster and better experience.
Comments
0U
Join the discussion
Sign in to leave a comment