hummingbird-me / kitsu-tools

:hammer: The tools we use to build Kitsu, the coolest platform for anime and manga
https://kitsu.app
Apache License 2.0
2.09k stars 264 forks source link

The "strange" search mystery #42

Closed cybrox closed 10 years ago

cybrox commented 10 years ago

Hi, i noticed a curious bug today. When we try to search the word "Strange", we have the follow error message "We're sorry, but something went wrong." As a web dev, i don't understand why the search process is crashing for this string ... I use the last version of Firefox and i realized some "slowdown" on Hummingbird. Thanks for reading.

Reference:

http://forums.hummingbird.me/t/bug-when-we-search-strange/9072

trmcnvn commented 10 years ago

Can't test ATM but most likely caused by the anime Strange+ 2nd Season http://hummingbird.me/anime/strange-2nd-season.

{
    "anime": {
        "id": "strange-2nd-season",
        "canonical_title": "Strange+ 2nd Season",
        "english_title": null,
        "romaji_title": "Strange+ 2nd Season",
        "synopsis": null,
        "poster_image": "http://static.hummingbird.me/anime/poster_images/000/008/344/large/60511.jpg?1396223148",
        "show_type": null,
        "age_rating": null,
        "age_rating_guide": null,
        "episode_count": null,
        "episode_length": null,
        "started_airing": null,
        "started_airing_date_known": true,
        "finished_airing": null,
        "genres": []
    }
}
SEAPUNK commented 10 years ago

@vevix It's not Strange+. It's users. Other types search fine, but when you do type=users, then it crashes. users_to_follow works, though. http://hummingbird.me/search.json?query=strange&type=users

SEAPUNK commented 10 years ago

Likely has to do with this line

cybrox commented 10 years ago

@Strat- I don't think it's the rendering either. http://hummingbird.me/search.json?query=strange&type=mixed works fine. That's what the instant search field is using to get the previews. http://hummingbird.me/search.json?query=strange&type=full also returns 500 though it doesn't render anything except the result json.

Must be something in the user db request or mapping.

SEAPUNK commented 10 years ago

That's true. It didn't give me an issue with mixed. Maybe it's a bad entry in the DB?

cybrox commented 10 years ago

I will see if I can reproduce that with my old dump and check the query results. It pretty much has to be a bad entry but I couldn't say what kind of bad would affect it like that.

SEAPUNK commented 10 years ago

Maybe someone tried to exploit your registration form?

shane-tw commented 10 years ago

Perhaps related: http://hummingbird.me/search?query=56501 breaks also. Rather than remove any entries that break the search, is there a way to figure out why http://hummingbird.me/api/v1/anime/56501 works and http://hummingbird.me/anime/56501 not?

erengy commented 10 years ago

http://hummingbird.me/search?query=strange&type=anime (500 - "something went wrong") http://hummingbird.me/search?query=strange&type=manga (200 - "Found 0 results") http://hummingbird.me/search?query=strange&type=users (200 - "Found 9 results")

http://hummingbird.me/search.json?query=strange&type=anime (200) http://hummingbird.me/search.json?query=strange&type=manga (406 - "Not Acceptable") http://hummingbird.me/search.json?query=strange&type=users (500 - "Internal Server Error")

Not sure if it's related, but there's an empty value "" in anime search results:

{
  "search": [
    "Strange+",
    "",
    "Strange Dawn",
    "Strange Love",
    "Strange+ 2nd Season",
    "The Doraemons: Strange, Sweets, Strange?",
    "Kikou Sennyo Rouran",
    "Strange Steel Fairy Rouran",
    "Doraemon: Nobita and the Strange Wind Rider",
    "Hatsu Inu 2 The Animation: Strange Kind of Women - Again",
    "Gendai Kibunroku Kaii Monogatari",
    "Strange tales of modern mysterious events",
    "One Piece: Chinjuujima no Chopper Oukoku",
    "One Piece: Chopper Kingdom of Strange Animal Island",
    "Dr. Slump Movie 1: Arale-chan Hello! Fushigi Shima",
    "Dr. Slump & Arale-chan Hello! Strange Island"
  ]
}
vikhyat commented 10 years ago

Should be pretty easy to resolve once I look at the error log. Will check it out tonight. — Sent from Mailbox

On Fri, Jun 13, 2014 at 7:23 PM, Eren Okka notifications@github.com wrote:

http://hummingbird.me/search?query=strange&type=anime (500 - "something went wrong") http://hummingbird.me/search?query=strange&type=manga (200 - "Found 0 results") http://hummingbird.me/search?query=strange&type=users (200 - "Found 9 results") http://hummingbird.me/search.json?query=strange&type=anime (200) http://hummingbird.me/search.json?query=strange&type=manga (406 - "Not Acceptable") http://hummingbird.me/search.json?query=strange&type=users (500 - "Internal Server Error") Not sure if it's related, but there's an empty value "" in anime search results:

{
  "search": [
    "Strange+",
    "",
    "Strange Dawn",
    "Strange Love",
    "Strange+ 2nd Season",
    "The Doraemons: Strange, Sweets, Strange?",
    "Kikou Sennyo Rouran",
    "Strange Steel Fairy Rouran",
    "Doraemon: Nobita and the Strange Wind Rider",
    "Hatsu Inu 2 The Animation: Strange Kind of Women - Again",
    "Gendai Kibunroku Kaii Monogatari",
    "Strange tales of modern mysterious events",
    "One Piece: Chinjuujima no Chopper Oukoku",
    "One Piece: Chopper Kingdom of Strange Animal Island",
    "Dr. Slump Movie 1: Arale-chan Hello! Fushigi Shima",
    "Dr. Slump & Arale-chan Hello! Strange Island"
  ]
}

Reply to this email directly or view it on GitHub: https://github.com/hummingbird-me/hummingbird/issues/42#issuecomment-46013412

SEAPUNK commented 10 years ago

@erengy That's really interesting, because search.json and search return different things for each type. You'd expect it to be consistent.

SEAPUNK commented 10 years ago

I guess you can say... it's really strange

vikhyat commented 10 years ago

I can reproduce this locally (you should be able to as well @cybrox) but strangely enough Rails is refusing to print any debugging information. Will have to dig deeper.

trmcnvn commented 10 years ago

@Strat-, @Kenshii (your query is related to this reason) I still stand by what I said earlier, Strange+ 2nd Season is causing a 500 error on a web request because the view is attempting to do operations on synopsis and its a null object.

I still can't test until I get my hands on a DB dump but, the type=users issue is most likely the fact that the search_controller.rb#basic is not setup to return JSON for that type.

type=full issue is still most likely related to point 1, as it is doing operations on synopsis which is a null object -- as you'll note something where results don't have a null synopsis work, ex: http://hummingbird.me/search.json?query=steins&type=full

vikhyat commented 10 years ago

You were correct, @vevix. Fixing this, thanks!