1

On the redmine of my company, there is this bug where I get an internal error if I want to search into a project.

Here is the log corresponding to the error:

Processing by SearchController#index as HTML
  Parameters: {"utf8"=>"✓", "issues"=>"1", "q"=>"test", "id"=>"sprint"}
  Current user: me (id=60)
Completed 500 Internal Server Error in 85.0ms

TypeError (no implicit conversion of nil into String):
  lib/plugins/acts_as_searchable/lib/acts_as_searchable.rb:126:in `search'
  app/controllers/search_controller.rb:74:in `block in index'
  app/controllers/search_controller.rb:73:in `each'
  app/controllers/search_controller.rb:73:in `index'

The lines corresponding to the error in the controller are :

 if !@tokens.empty?
      # no more than 5 tokens to search for
      @tokens.slice! 5..-1 if @tokens.size > 5

      @results = []
      @results_by_type = Hash.new {|h,k| h[k] = 0}

      limit = 10
      @scope.each do |s|
        r, c = s.singularize.camelcase.constantize.search(@tokens, projects_to_search,
          :all_words => @all_words,
          :titles_only => @titles_only,
          :limit => (limit+1),
          :offset => offset,
          :before => params[:previous].nil?)
        @results += r

Here is my config :

Environment:
  Redmine version                2.6.9.stable
  Ruby version                   2.3.0-p0 (2015-12-25) [x86_64-linux]
  Rails version                  3.2.22
  Environment                    production
  Database adapter               PostgreSQL
SCM:
  Git                            1.9.1
  Filesystem                     
Redmine plugins:
  no plugin installed

What is interesting is that when I search only one letter, i'm redirected on the search page, but I don't have an internal error.

I'm very new to Redmine developpement and to Ruby, I was just assigned to try to fix this bug. Do any of you have an idea of how to fix it ?

Thanks.

Roux
  • 293
  • 2
  • 17

2 Answers2

1

I had the same issue, I was able to fix it by downgrading my ruby & rails version, a working set is :

  • Rails 3.2.19
  • Ruby 2.1.4p265

It's look like it's due to a braking change in ruby-2.3.0.

Nementon
  • 11
  • 1
0

It's really odd. We are using 'Redmine' -2.0.3.1 and we do not have that kind of behaviour. It seems that "someone" messed up the form linked to the search input. Try to follow that data from when you press enter until it answer you with the 500 error code.

If you can , change the environment to development, this way it will show you more detailed errors.

But I can't help you much more , you didn't provide enough info about the problem.

Ruben Barbosa
  • 151
  • 1
  • 12