django-haystack / django-haystack/celery-haystack
delete operation of model raises exception
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 226
- Forks
- 95
- PR merge metrics
- No merged PRs in 30d
Description
I'm not sure why it happens, but when I disable the CelerySearchIndex then everything works.
obj.delete()
Traceback (most recent call last):
File "", line 1, in
File "/home/me/workspace/my_proj/env/local/lib/python2.7/site-packages/django/db/models/base.py", line 872, in delete
collector.delete()
File "/home/me/workspace/my_proj/env/local/lib/python2.7/site-packages/django/db/models/deletion.py", line 314, in delete
sender=model, instance=obj, using=self.using
File "/home/me/workspace/my_proj/env/local/lib/python2.7/site-packages/djcelery_transactions/transaction_signals.py", line 95, in patched__exit
transaction.signals.post_commit.send(None)
File "/home/me/workspace/my_proj/env/local/lib/python2.7/site-packages/django/dispatch/dispatcher.py", line 201, in send
response = receiver(signal=self, sender=sender, **named)
File "/home/me/workspace/my_proj/env/local/lib/python2.7/site-packages/djcelery_transactions/init.py", line 138, in _send_tasks
tsk.original_apply_async(_args, *_kwargs)
File "/home/me/workspace/my_proj/env/local/lib/python2.7/site-packages/djcelery_transactions/init.py", line 51, in original_apply_async
return super(PostTransactionTask, self).apply_async(_args, *_kwargs)
File "/home/me/workspace/my_proj/env/local/lib/python2.7/site-packages/celery/app/task.py", line 559, in apply_async
*_dict(self._get_exec_options(), *_options)
File "/home/me/workspace/my_proj/env/local/lib/python2.7/site-packages/celery/app/base.py", line 353, in send_task
reply_to=reply_to or self.oid, *_options
File "/home/me/workspace/my_proj/env/local/lib/python2.7/site-packages/celery/app/amqp.py", line 305, in publish_task
*_kwargs
File "/home/me/workspace/my_proj/env/local/lib/python2.7/site-packages/kombu/messaging.py", line 172, in publish
routing_key, mandatory, immediate, exchange, declare)
File "/home/me/workspace/my_proj/env/local/lib/python2.7/site-packages/kombu/connection.py", line 436, in _ensured
return fun(_args, *_kwargs)
File "/home/me/workspace/my_proj/env/local/lib/python2.7/site-packages/kombu/messaging.py", line 188, in _publish
mandatory=mandatory, immediate=immediate,
File "/home/me/workspace/my_proj/env/local/lib/python2.7/site-packages/kombu/transport/virtual/init.py", line 521, in basic_publish
message, exchange, routing_key, *_kwargs
File "/home/me/workspace/my_proj/env/local/lib/python2.7/site-packages/kombu/transport/virtual/exchange.py", line 61, in deliver
_put(queue, message, *_kwargs)
File "/home/me/workspace/my_proj/env/local/lib/python2.7/site-packages/kombu/transport/django/init.py", line 39, in _put
Queue.objects.publish(queue, dumps(message))
File "/home/me/workspace/my_proj/env/local/lib/python2.7/site-packages/kombu/transport/django/managers.py", line 29, in publish
queue.messages.create(payload=payload)
File "/home/me/workspace/my_proj/env/local/lib/python2.7/site-packages/django/db/models/fields/related.py", line 750, in create
return super(RelatedManager, self.db_manager(db)).create(**kwargs)
File "/home/me/workspace/my_proj/env/local/lib/python2.7/site-packages/django/db/models/manager.py", line 127, in manager_method
return getattr(self.get_queryset(), name)(_args, *_kwargs)
File "/home/me/workspace/my_proj/env/local/lib/python2.7/site-packages/django/db/models/query.py", line 348, in create
obj.save(force_insert=True, using=self.db)
File "/home/me/workspace/my_proj/env/local/lib/python2.7/site-packages/django/db/models/base.py", line 710, in save
force_update=force_update, update_fields=update_fields)
File "/home/me/workspace/my_proj/env/local/lib/python2.7/site-packages/django/db/models/base.py", line 735, in save_base
with transaction.atomic(using=using, savepoint=False):
File "/home/me/workspace/my_proj/env/local/lib/python2.7/site-packages/django/db/transaction.py", line 164, in enter
"The outermost 'atomic' block cannot use "
TransactionManagementError: The outermost 'atomic' block cannot use savepoint = False when autocommit is off.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing obj.delete() with CelerySearchIndex enabled and compare it with the disabled case. Inspect the referenced djcelery_transactions/transaction_signals.py and init.py paths, along with the Django transaction error, to establish the failing interaction. Done means deletion succeeds with indexing enabled and a regression test covers the behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, search
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100