Closed Bug 708102 Opened 13 years ago Closed 13 years ago

[kitsune] Deleting KB articles fails

Categories

(support.mozillamessaging.com Graveyard :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: rolandtanglao, Assigned: gozer)

Details

Steps to reproduce:

1. Try to delete an article e.g.
https://support.mozillamessaging.com/en-US/kb/moving-thunderbird-knowledge-base/delete

Expected Result: article is deleted

Actual Result:
"An Error Occurred

Oh, no! It looks like an unexpected error occurred. We've already notified the site administrators. Please try again now, or in a few minutes.
"
and article is NOT deleted

Apparently delete DOES work on :sancus's test VM
The only error I see in the logs and might not be correlated is:

[Tue Dec 06 13:48:08 2011] [error]   DeprecationWarning
[Tue Dec 06 13:48:41 2011] [error] /srv/support.mozillamessaging.com/kitsune/vendor/src/django/django/contrib/csrf/middleware.py:6: DeprecationWarning: This import for CSRF functionality is deprecated.  Please use django.middleware.csrf for the middleware and django.views.decorators.csrf for decorators.

@sancus, any way to increase log levels on the server-side ?
well, you can set DEBUG to True, but that will expose full error reports to the web. Maybe we can do that on staging? It looks like it's giving 500 errors when you try to delete, too...
Okay, I wondered about staging too. I turned debug on there.

The error_log is more interesting there:

[Tue Dec 06 17:02:37 2011] [error] [client a.b.c.d] mod_wsgi (pid=19375): Exception occurred processing WSGI script '[kistune-root]/wsgi/kitsune.wsgi'.
[Tue Dec 06 17:02:37 2011] [error] [client a.b.c.d] Traceback (most recent call last):
[Tue Dec 06 17:02:37 2011] [error] [client a.b.c.d]   File "[kistune-root]/wsgi/kitsune.wsgi", line 41, in application
[Tue Dec 06 17:02:37 2011] [error] [client a.b.c.d]     return django_app(env, start_response)
[Tue Dec 06 17:02:37 2011] [error] [client a.b.c.d]   File "[kistune-root]/vendor/src/django/django/core/handlers/wsgi.py", line 273, in __call__
[Tue Dec 06 17:02:37 2011] [error] [client a.b.c.d]     response = self.get_response(request)
[Tue Dec 06 17:02:37 2011] [error] [client a.b.c.d]   File "[kistune-root]/vendor/src/django/django/core/handlers/base.py", line 169, in get_response
[Tue Dec 06 17:02:37 2011] [error] [client a.b.c.d]     response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
[Tue Dec 06 17:02:37 2011] [error] [client a.b.c.d]   File "[kistune-root]/vendor/src/django/django/core/handlers/base.py", line 111, in get_response
[Tue Dec 06 17:02:37 2011] [error] [client a.b.c.d]     response = callback(request, *callback_args, **callback_kwargs)
[Tue Dec 06 17:02:37 2011] [error] [client a.b.c.d]   File "[kistune-root]/apps/access/decorators.py", line 47, in _wrapped_view
[Tue Dec 06 17:02:37 2011] [error] [client a.b.c.d]     return view_fn(request, *args, **kwargs)
[Tue Dec 06 17:02:37 2011] [error] [client a.b.c.d]   File "[kistune-root]/apps/wiki/views.py", line 899, in delete_document
[Tue Dec 06 17:02:37 2011] [error] [client a.b.c.d]     document.delete()
[Tue Dec 06 17:02:37 2011] [error] [client a.b.c.d]   File "[kistune-root]/vendor/src/django/django/db/models/base.py", line 581, in delete
[Tue Dec 06 17:02:37 2011] [error] [client a.b.c.d]     collector.delete()
[Tue Dec 06 17:02:37 2011] [error] [client a.b.c.d]   File "[kistune-root]/vendor/src/django/django/db/models/deletion.py", line 63, in decorated
[Tue Dec 06 17:02:37 2011] [error] [client a.b.c.d]     func(self, *args, **kwargs)
[Tue Dec 06 17:02:37 2011] [error] [client a.b.c.d]   File "[kistune-root]/vendor/src/django/django/db/models/deletion.py", line 254, in delete
[Tue Dec 06 17:02:37 2011] [error] [client a.b.c.d]     query.delete_batch(pk_list, self.using)
[Tue Dec 06 17:02:37 2011] [error] [client a.b.c.d]   File "[kistune-root]/vendor/src/django/django/db/models/sql/subqueries.py", line 44, in delete_batch
[Tue Dec 06 17:02:37 2011] [error] [client a.b.c.d]     self.do_query(self.model._meta.db_table, where, using=using)
[Tue Dec 06 17:02:37 2011] [error] [client a.b.c.d]   File "[kistune-root]/vendor/src/django/django/db/models/sql/subqueries.py", line 29, in do_query
[Tue Dec 06 17:02:37 2011] [error] [client a.b.c.d]     self.get_compiler(using).execute_sql(None)
[Tue Dec 06 17:02:37 2011] [error] [client a.b.c.d]   File "[kistune-root]/vendor/src/django/django/db/models/sql/compiler.py", line 735, in execute_sql
[Tue Dec 06 17:02:37 2011] [error] [client a.b.c.d]     cursor.execute(sql, params)
[Tue Dec 06 17:02:37 2011] [error] [client a.b.c.d]   File "[kistune-root]/vendor/src/django/django/db/backends/util.py", line 34, in execute
[Tue Dec 06 17:02:37 2011] [error] [client a.b.c.d]     return self.cursor.execute(sql, params)
[Tue Dec 06 17:02:37 2011] [error] [client a.b.c.d]   File "[kistune-root]/vendor/src/django/django/db/backends/mysql/base.py", line 86, in execute
[Tue Dec 06 17:02:37 2011] [error] [client a.b.c.d]     return self.cursor.execute(query, args)
[Tue Dec 06 17:02:37 2011] [error] [client a.b.c.d]   File "/usr/lib/python2.6/site-packages/MySQLdb/cursors.py", line 173, in execute
[Tue Dec 06 17:02:37 2011] [error] [client a.b.c.d]     self.errorhandler(self, exc, value)
[Tue Dec 06 17:02:37 2011] [error] [client a.b.c.d]   File "/usr/lib/python2.6/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
[Tue Dec 06 17:02:37 2011] [error] [client a.b.c.d]     raise errorclass, errorvalue
[Tue Dec 06 17:02:37 2011] [error] [client a.b.c.d] IntegrityError: (1451, 'Cannot delete or update a parent row: a foreign key constraint fails (`stage_kitsune`.`wiki_operatingsystem`, CONSTRAINT `document_id_refs_id_16d22ea7` FOREIGN KEY (`document_id`) REFERENCES `wiki_document` (`id`))')
Wait, wiki_operatingsystem? I think that table should be dropped... I bet... we are missing a migration because some tag wasn't quite right...

Do wiki_operatingsystem and wiki_firefoxversion both still exist?
DROP TABLE wiki_firefoxversion;
DROP TABLE wiki_operatingsystem;
UPDATE schema_version SET version=127;

Run that on staging, please :)
This is fixed now, as gozer has applied the above to staging. Thanks, gozer! I deleted the article used as an example above to test.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Applied to production as well.
Status: RESOLVED → UNCONFIRMED
Ever confirmed: false
Resolution: FIXED → ---
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.