Page MenuHomePhabricator

Admin console fails to add new diffusionrepo entries
Closed, ResolvedPublic

Description

Something goes horribly wrong when the admin console tries to write a row into django_admin_log.

2016-08-30T16:36:16Z [3f6ffcaa141a4439957e785137032773] django.request ERROR: In
ternal Server Error: /contrib-admin/tools/diffusionrepo/add/
Traceback (most recent call last):
  File "/srv/deployment/striker/venv/lib/python3.4/site-packages/django/contrib/
contenttypes/models.py", line 67, in get_for_model
    ct = self.get(app_label=opts.app_label, model=opts.model_name)
  File "/srv/deployment/striker/venv/lib/python3.4/site-packages/django/db/model
s/manager.py", line 127, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/srv/deployment/striker/venv/lib/python3.4/site-packages/django/db/model
s/query.py", line 328, in get
    num = len(clone)
  File "/srv/deployment/striker/venv/lib/python3.4/site-packages/django/db/model
s/query.py", line 144, in __len__
    self._fetch_all()
  File "/srv/deployment/striker/venv/lib/python3.4/site-packages/django/db/model
s/query.py", line 965, in _fetch_all
    self._result_cache = list(self.iterator())
  File "/srv/deployment/striker/venv/lib/python3.4/site-packages/django/db/model
s/query.py", line 238, in iterator
    results = compiler.execute_sql()
  File "/srv/deployment/striker/venv/lib/python3.4/site-packages/django/db/model
s/sql/compiler.py", line 840, in execute_sql
    cursor.execute(sql, params)
  File "/srv/deployment/striker/venv/lib/python3.4/site-packages/django/db/backe
nds/utils.py", line 59, in execute
    self.db.validate_no_broken_transaction()
  File "/srv/deployment/striker/venv/lib/python3.4/site-packages/django/db/backe
nds/base/base.py", line 327, in validate_no_broken_transaction
    "An error occurred in the current transaction. You can't "
django.db.transaction.TransactionManagementError: An error occurred in the curre
nt transaction. You can't execute queries until the end of the 'atomic' block.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/deployment/striker/venv/lib/python3.4/site-packages/django/core/handlers/base.py", line 132, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/srv/deployment/striker/venv/lib/python3.4/site-packages/django/contrib/admin/options.py", line 618, in wrapper
    return self.admin_site.admin_view(view)(*args, **kwargs)
  File "/srv/deployment/striker/venv/lib/python3.4/site-packages/django/utils/decorators.py", line 110, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "/srv/deployment/striker/venv/lib/python3.4/site-packages/django/views/decorators/cache.py", line 57, in _wrapped_view_func
    response = view_func(request, *args, **kwargs)
  File "/srv/deployment/striker/venv/lib/python3.4/site-packages/django/contrib/admin/sites.py", line 233, in inner
    return view(request, *args, **kwargs)
  File "/srv/deployment/striker/venv/lib/python3.4/site-packages/django/contrib/admin/options.py", line 1518, in add_view
    return self.changeform_view(request, None, form_url, extra_context)
  File "/srv/deployment/striker/venv/lib/python3.4/site-packages/django/utils/decorators.py", line 34, in _wrapper
    return bound_func(*args, **kwargs)
  File "/srv/deployment/striker/venv/lib/python3.4/site-packages/django/utils/decorators.py", line 110, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "/srv/deployment/striker/venv/lib/python3.4/site-packages/django/utils/decorators.py", line 30, in bound_func
    return func.__get__(self, type(self))(*args2, **kwargs2)
  File "/usr/lib/python3.4/contextlib.py", line 30, in inner
    return func(*args, **kwds)
  File "/srv/deployment/striker/venv/lib/python3.4/site-packages/django/contrib/admin/options.py", line 1472, in changeform_view
    self.log_addition(request, new_object)
  File "/srv/deployment/striker/venv/lib/python3.4/site-packages/django/contrib/admin/options.py", line 810, in log_addition
    content_type_id=get_content_type_for_model(object).pk,
  File "/srv/deployment/striker/venv/lib/python3.4/site-packages/django/contrib/admin/options.py", line 65, in get_content_type_for_model
    return ContentType.objects.get_for_model(obj, for_concrete_model=False)
  File "/srv/deployment/striker/venv/lib/python3.4/site-packages/django/contrib/contenttypes/models.py", line 80, in get_for_model
    "Error creating new content types. Please make sure contenttypes "
RuntimeError: Error creating new content types. Please make sure contenttypes is migrated before trying to migrate apps individually.

Event Timeline

bd808 triaged this task as High priority.Aug 31 2016, 12:21 AM
bd808 moved this task from Backlog to Ready on the Striker board.

Change 308296 had a related patch set uploaded (by BryanDavis):
Wrap MilestoneManager.recordMilestone in a transaction

https://gerrit.wikimedia.org/r/308296

Change 308296 merged by jenkins-bot:
Wrap MilestoneManager.recordMilestone in a transaction

https://gerrit.wikimedia.org/r/308296

Krenair assigned this task to bd808.
Krenair added a subscriber: Krenair.

Seems fine now