Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#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 Mariusz Felisiak, 2 years ago

Resolution: duplicate
Status: newclosed
Summary: close_old_connections unconditionally closes connections inside atomic blocks if default autocommit = 1close_old_connections() unconditionally closes connections inside atomic blocks if default autocommit = 1

Duplicate of #30448.

There is no need to create duplicates. Feel-free to submit a new patch for #30448 (with a regression test).

comment:2 by Didier Frick, 2 years ago

OK then, is there a way to bump #30448 which has been open for 2 years and affects production code ?

in reply to:  2 comment:3 by Mariusz Felisiak, 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).

Note: See TracTickets for help on using tickets.
Back to Top