#34006 closed Bug (duplicate)
close_old_connections() unconditionally closes connections inside atomic blocks if default autocommit = 1
Reported by: | Didier Frick | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
This problem has already been reported in https://code.djangoproject.com/ticket/30448 and the fix is in https://github.com/django/django/pull/11769 but somehow never made it to the repo.
Currently, without this patch, IIUC, if default autocommit is on, then close_old_connections will yank the connection from underneath any code that happens to be running inside an atomic block at the time (because atomic blocks set autocommit to 0, which is different from the default).
The fix is to merge https://github.com/django/django/pull/11769
Change History (3)
comment:1 by , 2 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Summary: | close_old_connections unconditionally closes connections inside atomic blocks if default autocommit = 1 → close_old_connections() unconditionally closes connections inside atomic blocks if default autocommit = 1 |
follow-up: 3 comment:2 by , 2 years ago
OK then, is there a way to bump #30448 which has been open for 2 years and affects production code ?
comment:3 by , 2 years ago
Replying to Didier Frick:
OK then, is there a way to bump #30448 which has been open for 2 years and affects production code ?
Yes, someone need to submit an updated patch with a regression test (see my comment).
Duplicate of #30448.
There is no need to create duplicates. Feel-free to submit a new patch for #30448 (with a regression test).