{"action":"closed","issue":{"url":"https://api.github.com/repos/saxix/django-concurrency/issues/47","labels_url":"https://api.github.com/repos/saxix/django-concurrency/issues/47/labels{/name}","comments_url":"https://api.github.com/repos/saxix/django-concurrency/issues/47/comments","events_url":"https://api.github.com/repos/saxix/django-concurrency/issues/47/events","html_url":"https://github.com/saxix/django-concurrency/issues/47","id":50057296,"number":47,"title":"TransactionManagementError during save.","user":{"login":"iank-","id":4088366,"avatar_url":"https://avatars.githubusercontent.com/u/4088366?v=3","gravatar_id":"","url":"https://api.github.com/users/iank-","html_url":"https://github.com/iank-","followers_url":"https://api.github.com/users/iank-/followers","following_url":"https://api.github.com/users/iank-/following{/other_user}","gists_url":"https://api.github.com/users/iank-/gists{/gist_id}","starred_url":"https://api.github.com/users/iank-/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iank-/subscriptions","organizations_url":"https://api.github.com/users/iank-/orgs","repos_url":"https://api.github.com/users/iank-/repos","events_url":"https://api.github.com/users/iank-/events{/privacy}","received_events_url":"https://api.github.com/users/iank-/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2014-11-25T17:18:12Z","updated_at":"2015-04-05T20:34:43Z","closed_at":"2015-04-05T20:34:43Z","body":"Hi there,\r\n\r\nVersions: Django 1.6.8 and django-concurrency 0.8.1, with MySQL 5.5.40.\r\n\r\nI'm developing on a Ubuntu VM. On a clone of this VM, I have added django-concurrency to an object called Configuration on my admin page. After doing so, whenever I use this VM and add more than about 3 new 1-to-many relationships to this Configuration object, I get a TransactionManagementError. This does not happen on the old VM with identical code, and without django-concurrency.\r\n\r\nThe MySQL logs just show that after a couple of the INSERTs, a rollback command was issued. The database has no exceptions or other information. Here is the exception from Django:\r\n\r\n```python\r\n#some INSERTS\r\nInternal Server Error: /test/common/configuration/6/\r\nTraceback (most recent call last):\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py\", line 112, in get_response\r\n    response = wrapped_callback(request, *callback_args, **callback_kwargs)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/contrib/admin/options.py\", line 466, in wrapper\r\n    return self.admin_site.admin_view(view)(*args, **kwargs)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py\", line 99, in _wrapped_view\r\n    response = view_func(request, *args, **kwargs)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/views/decorators/cache.py\", line 52, in _wrapped_view_func\r\n    response = view_func(request, *args, **kwargs)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/contrib/admin/sites.py\", line 198, in inner\r\n    return view(request, *args, **kwargs)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py\", line 29, in _wrapper\r\n    return bound_func(*args, **kwargs)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py\", line 99, in _wrapped_view\r\n    response = view_func(request, *args, **kwargs)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py\", line 25, in bound_func\r\n    return func(self, *args2, **kwargs2)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/db/transaction.py\", line 371, in inner\r\n    return func(*args, **kwargs)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/contrib/admin/options.py\", line 1267, in change_view\r\n    self.log_change(request, new_object, change_message)\r\n  File \"/usr/local/lib/python2.7/dist-packages/concurrency/admin.py\", line 205, in log_change\r\n    super(ConcurrencyListEditableMixin, self).log_change(request, object, message)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/contrib/admin/options.py\", line 650, in log_change\r\n    change_message=message\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/contrib/admin/models.py\", line 20, in log_action\r\n    e.save()\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/db/models/base.py\", line 545, in save\r\n    force_update=force_update, update_fields=update_fields)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/db/models/base.py\", line 573, in save_base\r\n    updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/db/models/base.py\", line 654, in _save_table\r\n    result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/db/models/base.py\", line 687, in _do_insert\r\n    using=using, raw=raw)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py\", line 232, in _insert\r\n    return insert_query(self.model, objs, fields, **kwargs)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/db/models/query.py\", line 1514, in insert_query\r\n    return query.get_compiler(using=using).execute_sql(return_id)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py\", line 903, in execute_sql\r\n    cursor.execute(sql, params)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/db/backends/util.py\", line 69, in execute\r\n    return super(CursorDebugWrapper, self).execute(sql, params)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/db/backends/util.py\", line 47, in execute\r\n    self.db.validate_no_broken_transaction()\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py\", line 372, in validate_no_broken_transaction\r\n    \"An error occurred in the current transaction. You can't \"\r\nTransactionManagementError: An error occurred in the current transaction. You can't execute queries until the end of the 'atomic' block.\r\nInternal Server Error: /test/common/configuration/6/\r\nTraceback (most recent call last):\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py\", line 112, in get_response\r\n    response = wrapped_callback(request, *callback_args, **callback_kwargs)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/contrib/admin/options.py\", line 466, in wrapper\r\n    return self.admin_site.admin_view(view)(*args, **kwargs)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py\", line 99, in _wrapped_view\r\n    response = view_func(request, *args, **kwargs)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/views/decorators/cache.py\", line 52, in _wrapped_view_func\r\n    response = view_func(request, *args, **kwargs)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/contrib/admin/sites.py\", line 198, in inner\r\n    return view(request, *args, **kwargs)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py\", line 29, in _wrapper\r\n    return bound_func(*args, **kwargs)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py\", line 99, in _wrapped_view\r\n    response = view_func(request, *args, **kwargs)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py\", line 25, in bound_func\r\n    return func(self, *args2, **kwargs2)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/db/transaction.py\", line 371, in inner\r\n    return func(*args, **kwargs)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/contrib/admin/options.py\", line 1267, in change_view\r\n    self.log_change(request, new_object, change_message)\r\n  File \"/usr/local/lib/python2.7/dist-packages/concurrency/admin.py\", line 205, in log_change\r\n    super(ConcurrencyListEditableMixin, self).log_change(request, object, message)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/contrib/admin/options.py\", line 650, in log_change\r\n    change_message=message\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/contrib/admin/models.py\", line 20, in log_action\r\n    e.save()\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/db/models/base.py\", line 545, in save\r\n    force_update=force_update, update_fields=update_fields)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/db/models/base.py\", line 573, in save_base\r\n    updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/db/models/base.py\", line 654, in _save_table\r\n    result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/db/models/base.py\", line 687, in _do_insert\r\n    using=using, raw=raw)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py\", line 232, in _insert\r\n    return insert_query(self.model, objs, fields, **kwargs)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/db/models/query.py\", line 1514, in insert_query\r\n    return query.get_compiler(using=using).execute_sql(return_id)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py\", line 903, in execute_sql\r\n    cursor.execute(sql, params)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/db/backends/util.py\", line 69, in execute\r\n    return super(CursorDebugWrapper, self).execute(sql, params)\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/db/backends/util.py\", line 47, in execute\r\n    self.db.validate_no_broken_transaction()\r\n  File \"/usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py\", line 372, in validate_no_broken_transaction\r\n    \"An error occurred in the current transaction. You can't \"\r\nTransactionManagementError: An error occurred in the current transaction. You can't execute queries until the end of the 'atomic' block.\r\n[25/Nov/2014 16:33:57] \"POST /test/common/configuration/6/ HTTP/1.1\" 500 307743\r\n```\r\n\r\nI've added this code to the project so far:\r\n\r\n```python\r\nfrom concurrency.admin import ConcurrentModelAdmin\r\n...\r\nclass ConfigurationAdmin(ConcurrentModelAdmin):\r\n\r\n    form = forms.ConfigurationForm\r\n    change_list_template = 'admin/configuration/change_list.html'\r\n...\r\n```\r\n\r\n```python\r\nfrom concurrency.fields import AutoIncVersionField\r\nclass Configuration(models.Model):\r\n    \"\"\"\r\n    Database Model for attaching :class:`Resource` objects to\r\n    :class:`Product` objects.\r\n    \"\"\"\r\n    objects = ConfigurationManager()\r\n    version = AutoIncVersionField()\r\n    #version = models.CharField(max_length=128, verbose_name='config version')\r\n...\r\n```\r\n\r\n```html\r\n    {% for obj in queryset %}\r\n    <input type=\"hidden\" name=\"{{ action_checkbox_name }}\" value=\"{{ obj|identity }}\" />\r\n    {% endfor %}\r\n```\r\n\r\nNot sure what the problem could be. Any help would be greatly appreciated. Thanks!"}}