Searching yields "500 Internal Server Error" for specific search phrases

Hi there,

we are observing sporadic problems using the search feature of Discourse.

Observations

During the last weeks, we observed sporadic “500 Internal Server Error” responses when searching on https://community.hiveeyes.org/. While that might sound funny, we believe it actually depends on the search phrase.

The problem only happens when using the ad hoc search near the hamburger menu. When navigating to the search page /search before and invoking the search from there, everything is fine.

Now, after others also pointed us towards that problem on our platform, we finally wanted to start investigating this problem in detail.

See for yourself

Lucky us, we just have been able to reproduce it on Meta. So, when searching for “search returns 500”, we have been able to trigger that error deterministically. It also happens when not being logged in to the system.

image

The response is:

image

The search phrase is the bad guy – seriously?

It feels like that. Searching for “search croaks 500” in the same manner does not trigger that problem.

Upshot

We find this thing both weird and funny enough that we wanted to share our observations with you. While we are not exactly suffering badly, I believe you would like to investigate this if your time permits.

Thanks for listening and with kind regards,
Andreas.

P.S.: Triggering that error while searching for the issue on Meta makes it even more funny as I believe we all still love recursions.

3 Likes

Hmm, yes. This is the error we get in the logs

URI::InvalidURIError (bad URI(is not URI?): "http:error]")
/usr/local/lib/ruby/2.6.0/uri/rfc3986_parser.rb:67:in `split'

/usr/local/lib/ruby/2.6.0/uri/rfc3986_parser.rb:67:in `split'
/usr/local/lib/ruby/2.6.0/uri/rfc3986_parser.rb:73:in `parse'
/usr/local/lib/ruby/2.6.0/uri/common.rb:234:in `parse'
/usr/local/lib/ruby/2.6.0/uri/common.rb:737:in `URI'
/var/www/discourse/lib/search/grouped_search_results.rb:83:in `block in blurb_for'
/usr/local/lib/ruby/2.6.0/set.rb:338:in `each_key'
/usr/local/lib/ruby/2.6.0/set.rb:338:in `each'
/var/www/discourse/lib/search/grouped_search_results.rb:82:in `blurb_for'
/var/www/discourse/lib/search/grouped_search_results.rb:60:in `blurb'
/var/www/discourse/app/serializers/search_post_serializer.rb:9:in `blurb'

Thanks for the report @amotl

5 Likes

Thanks @amotl and @david, this is now fixed here on meta via https://github.com/discourse/discourse/commit/0dfc5947843eb126eeb05a7ecec531665e4b4bb1

6 Likes

Dear @david and @pmusaraj,

thanks for the quick turnaround time on this, from confirmation to the actual fix. We are looking forward to receive this fix. Will it be included within 2.4.0.beta7 maybe?

With kind regards,
Andreas.

2 Likes

Yes, it will be included in the next beta.

6 Likes

This topic was automatically closed after 5 days. New replies are no longer allowed.