Page MenuHomePhabricator

[BUG] Internal Server Error re-adding category to event
Closed, ResolvedPublicBUG REPORT

Description

What is the problem?

In the "Categories filter" UI, after removing a category, without saving, if you add the same category again and attempt to save you see an error such as:

500: Internal Server Error
The server said: An exception occurred while executing 'INSERT INTO event_category (ec_title, ec_category_id, ec_domain, ec_event_id) VALUES (?, ?, ?, ?)' with params ["Chicagoland", 61612, "en.wikivoyage", 374]: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '374-61612-en.wikivoyage' for key 'ec_event_domains'

Presumably it attempts to update the event with what it thinks is a new category and hits the integrity constraint.

Might happen to a user if they, for example, accidentally remove a category and, rather than refreshing the page, re-enter it.

Steps to reproduce problem
  1. In the Categories filter UI, enter any category in any wiki and click Save
  2. Remove the category you just saved, then re-enter it and click save

Expected behavior: Event should return to the same state as it was after step 1
Observed behavior: Fatal error

Event Timeline

I reproduced this error, just as Dom described it. Thanks for nailing the steps to reproduce this one down Dom. I'd gotten as far as figuring out that "when I change categories quickly a number of times" I get that error.

Should be fixed now. Thanks for the detailed report!

No longer reproducible on staging.

I can re-add categories to events without issue, for various wikis, including re-adding several at a time.

It also detects duplicates if using underscore rather than space.

I have not seen any regressions regarding adding/removing categories.

Good work guys. Thanks.