-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
iQIcBAEBCAAGBQJXOrGWAAoJEC0ft5FqUuEhpgwP/RAaL9oOZGk8UrFl3Hscyxg0
53yMNjLfc67CqM7JkzuMEfgKLdZdykqs25jpmGmrQBJOrfUS/kl0P2AHP0frpFQ7
pItagVIewP6lwLnDNmGfimWnUspEYaMannBmcLGCxqmThjq4UmW2H5tVtNsEmG26
JuDFhOqCAJmjiytRxfvomOVUrBsI6qD7zs5RCY7N5swVxJIsKVIQsEe+SG4Ffqfm
3os/w5HA4KGIJ8l5sz5mdeuzJg5WPYvkBnLWUaLmuIbceCkwaTjP6WSgBQrBdzyv
sSFrftqug0kNS41u/NUuvdM0McLA25O8+lD1e9crUf0w817uG7zFs16NClEUYGGc
gge2x7HzTGq4Doi0qsAbIc8ZWTwDLmvjzKobwqDARnw0sV0ciPB8TgqYVmJRDQfa
WW1gsfgGc/gSjy8PaJvMQ0NM2Zmnc391DvhQl3PXLQL2A6UXB18XOAC5YnKJngE9
aeRFZIN9/cXfjurjiVVqnUZuM2bb00kWFDbxAtJFIZPRHW5Z19AnStwt1rEQAOMH
3rZt8LPmpDF/u6MBlpPBTt3cok4YnoKHsqc+oItHd4jkWzlaZMs2sX83H6UOGb6D
qqHbMIjS6knQrcWyZUwXp4lFH2rJ9F33UIhb0j0LSxJDXt+kk5RBx99Q+qdtsGkQ
m4+WyohS2WQzsPVKCRh1
=gw5S
-----END PGP SIGNATURE-----
Hi Bart,
On 05/16/2016 02:10 PM, barthelemy@infobart.com wrote:
> I believe that I encountered a bug or at least a serious limitation with
> transaction.on_commit in Django 1.9.x. Essentially, the on_commit hooks
> seem to be tied to the database connection instead of the transaction.
> This means that unrelated transactions may trigger on_commit hooks,
> which results in undesired execution order.
[...]
> I wanted to know if someone encountered this issue or if I am
> misunderstanding on_commit before opening a ticket.
I am the author of on_commit, and I think the behavior you have
encountered is a bug that should be fixed. Doing additional database
work in `on_commit` callbacks wasn't really a use case I had in mind in
the design; I made sure it basically worked, but clearly didn't explore
it sufficiently in cases of multiple registered hooks.
Storing the on_commit state on the connection is not really optional,
since that's where _all_ transaction-related state is stored, but I
think it should still be possible to fix this. Perhaps by having
`run_and_clear_commit_hooks` copy the list of hooks into a local
variable and immediately clear the state on the connection before it
calls any of the hooks? Not entirely sure, need to add a failing test
and play with it a bit.
Thanks for catching and reporting this. If you'd be willing to file a
ticket in Trac, that'd be great.
Carl
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/573AB193.5020807%40oddbird.net.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment