Search are broken (at least for us) since few version
Created by: j0k3r
When performing a search inside a repository, we got a 500 internal error. Looking in the log and I found:
Started GET "/search?utf8=%E2%9C%93&search=test&group_id=&project_id=75&search_code=[FILTERED]&repository_ref=" for 193.22.107.6 at 2015-11-18 14:28:48 +0100
Processing by SearchController#show as HTML
Parameters: {"utf8"=>"✓", "search"=>"test", "group_id"=>"", "project_id"=>"75", "search_code"=>"[FILTERED]", "repository_ref"=>""}
Started GET "/search/autocomplete?project_id=75&project_ref=&term=test" for 193.22.107.6 at 2015-11-18 14:28:48 +0100
Processing by SearchController#autocomplete as JSON
Parameters: {"project_id"=>"75", "project_ref"=>"", "term"=>"test"}
Completed 200 OK in 364ms (Views: 0.4ms | ActiveRecord: 10.5ms)
Started POST "//api/v3/internal/allowed" for 127.0.0.1 at 2015-11-18 14:28:48 +0100
Completed 500 Internal Server Error in 1227ms (ActiveRecord: 1.5ms)
Started GET "/users/sign_in" for 127.0.0.1 at 2015-11-18 14:28:49 +0100
Processing by SessionsController#new as HTML
Started POST "//api/v3/internal/allowed" for 127.0.0.1 at 2015-11-18 14:28:49 +0100
Completed 200 OK in 138ms (Views: 64.6ms | ActiveRecord: 1.9ms)
NoMethodError (undefined method `scrub' for #<String:0x0000000b193740>):
app/models/repository.rb:484:in `search_files'
lib/gitlab/project_search_results.rb:51:in `blobs'
lib/gitlab/project_search_results.rb:20:in `objects'
app/controllers/search_controller.rb:45:in `show'
Looks like it's coming from here:
Gitlab::Popen.popen(args, path_to_repo).first.scrub.split(/^--$/)
I've no idea what Gitlab::Popen.popen
return that isn't understood by .first
and .scrub
.
Note that we have this issue since (at least) 7.14.x.
Here are information from gitlab:env:info
:
System information System: Debian 7.4 Current User: git Using RVM: yes RVM Version: 1.25.17 Ruby Version: 2.0.0p353 Gem Version: 2.2.2 Bundler Version:1.5.3 Rake Version: 10.4.2 Sidekiq Version:3.3.0
GitLab information Version: 8.1.4 Revision: 4d7216aa Directory: /space/home/git/gitlab DB Adapter: mysql2 URL: xx HTTP Clone URL: xx SSH Clone URL: xx Using LDAP: no Using Omniauth: no
GitLab Shell Version: 2.6.5 Repositories: /space/home/git/repositories/ Hooks: /space/home/git/gitlab-shell/hooks/ Git: /usr/local/bin/git
Can this be related to the ruby version?