Search gives "Internal error"

Added by Bjorn Solberg over 9 years ago

I've installed 0.7.3 and have added some issues. When I search for something, I get "Internal error" and the app log shows

Processing SearchController#index (for 71.118.225.119 at 2008-08-16 02:36:52) [G
ET]
Session ID: 66219c8c0b2409bc42b8dc6e83e0020a
Parameters: {"action"=>"index", "id"=>"bjorns-stuff", "q"=>"search", "controll
er"=>"search"}
Rendering template within layouts/base
Rendering search/index

ActionView::TemplateError (undefined method `length' for #<Enumerable::Enumerato
r:0xb7864a18>) on line #23 of search/index.rhtml:
20: <h3><%= l(:label_result_plural) ></h3>
21: <ul>
22: <
@results.each do |e| >
23: <li><p><
= link_to highlight_tokens(truncate(e.event_title, 255), @t
okens), e.event_url ><br />
24: <
= highlight_tokens(e.event_description, @tokens) ><br />
25: <span class="author"><
= format_time(e.event_datetime) ></span></p>
</li>
26: <
end %>

vendor/rails/actionpack/lib/action_view/helpers/text_helper.rb:50:in `trunca
te'
app/views/search/index.rhtml:23:in `_run_erb_47app47views47search47index46rh
tml'
app/views/search/index.rhtml:22:in `each'
app/views/search/index.rhtml:22:in `_run_erb_47app47views47search47index46rh
tml'
vendor/rails/actionpack/lib/action_view/base.rb:637:in `send'
vendor/rails/actionpack/lib/action_view/base.rb:637:in `compile_and_render_t
emplate'
vendor/rails/actionpack/lib/action_view/base.rb:365:in `render_template'
vendor/rails/actionpack/lib/action_view/base.rb:316:in `render_file'
vendor/rails/actionpack/lib/action_controller/base.rb:1100:in `render_for_fi
le'
vendor/rails/actionpack/lib/action_controller/base.rb:836:in `render_with_no
_layout'
vendor/rails/actionpack/lib/action_controller/layout.rb:262:in `render_witho
ut_benchmark'
vendor/rails/actionpack/lib/action_controller/benchmarking.rb:51:in `render'
/usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'
[...]

Is something wrong with the DB, config or install? Any pointers to a solution is much appreciated.

Thanks,

Bjorn.

Replies (7)

RE: Search gives "Internal error" - Added by Bjorn Solberg over 9 years ago

Now, trying to update an issue, I also get an "Internal server eror":

Processing IssuesController#show (for 71.118.225.119 at 2008-08-16 02:52:18) [GE
T]
Session ID: 66219c8c0b2409bc42b8dc6e83e0020a
Parameters: {"action"=>"show", "id"=>"83", "controller"=>"issues"}
Rendering template within layouts/base
Rendering issues/show.rhtml

ActionView::TemplateError (undefined method `length' for #<Enumerable::Enumerato
r:0xb73128d0>) on line #11 of issues/_history.rhtml:
8: <li><%= show_detail(detail) ></li>
9: <
end >
10: </ul>
11: <
= render_notes(journal) unless journal.notes.blank? >
12: </div>
13: <
end %>

vendor/rails/actionpack/lib/action_view/helpers/text_helper.rb:50:in `trunca
te'
app/helpers/application_helper.rb:318:in `textilizable'
app/helpers/application_helper.rb:301:in `gsub'
app/helpers/application_helper.rb:301:in `textilizable'
app/helpers/journals_helper.rb:29:in `render_notes'
app/views/issues/_history.rhtml:11:in `_run_erb_47app47views47issues47_histo
ry46rhtml'
app/views/issues/_history.rhtml:1:in `each'
app/views/issues/_history.rhtml:1:in `_run_erb_47app47views47issues47_histor
y46rhtml'
vendor/rails/actionpack/lib/action_view/base.rb:637:in `send'
vendor/rails/actionpack/lib/action_view/base.rb:637:in `compile_and_render_t
emplate'
vendor/rails/actionpack/lib/action_view/base.rb:365:in `render_template'
vendor/rails/actionpack/lib/action_view/base.rb:316:in `render_file'
vendor/rails/actionpack/lib/action_view/base.rb:331:in `render'
vendor/rails/actionpack/lib/action_view/partials.rb:120:in `render_partial'
vendor/rails/actionpack/lib/action_view/base.rb:352:in `render'
app/views/issues/show.rhtml:87:in `_run_erb_47app47views47issues47show46rhtm
l'
vendor/rails/actionpack/lib/action_view/base.rb:637:in `send'
vendor/rails/actionpack/lib/action_view/base.rb:637:in `compile_and_render_t
emplate'
[...]

Bjorn

RE: Search gives "Internal error" - Added by Thomas Lecavelier over 9 years ago

You have a mismatching configuration:

Rails2.0.2 with Ruby 1.8.6 OK
Rails2.1 with Ruby 1.8.7 Ok
Rails2.0.2 with Ruby 1.8.7 == BAD BAD BAD!

I recommand you to upgrade your rails version.

RE: Search gives "Internal error" - Added by Bjorn Solberg over 9 years ago

$ ruby --version
ruby 1.8.7 (2008-06-20 patchlevel 22) [i686-linux]
$ rails --version
Rails 2.1.0

I stopped and restarted Redmine. But still, when I try a search, I see this in the production.log:

Processing SearchController#index (for 71.118.225.119 at 2008-08-17 22:07:54) [GET]
Session ID: 7e2005f74b5e3da294c2c4d292535f3c
Parameters: {"action"=>"index", "id"=>"bjorns-stuff", "q"=>"search", "controller"=>"search"}
Rendering template within layouts/base
Rendering search/index

ActionView::TemplateError (undefined method `length' for #<Enumerable::Enumerator:0xb6eef884>) on line #23 of search/index.rhtml:
20: <h3><%= l(:label_result_plural) ></h3>
21: <ul>
22: <
@results.each do |e| >
23: <li><p><
= link_to highlight_tokens(truncate(e.event_title, 255), @tokens), e.event_url ><br />
24: <
= highlight_tokens(e.event_description, @tokens) ><br />
25: <span class="author"><
= format_time(e.event_datetime) ></span></p></li>
26: <
end %>

vendor/rails/actionpack/lib/action_view/helpers/text_helper.rb:50:in `trunca
te'
app/views/search/index.rhtml:23:in `_run_erb_47app47views47search47index46rh
tml'
app/views/search/index.rhtml:22:in `each'
app/views/search/index.rhtml:22:in `_run_erb_47app47views47search47index46rh
tml'
vendor/rails/actionpack/lib/action_view/base.rb:637:in `send'
vendor/rails/actionpack/lib/action_view/base.rb:637:in `compile_and_render_t
emplate'
vendor/rails/actionpack/lib/action_view/base.rb:365:in `render_template'
vendor/rails/actionpack/lib/action_view/base.rb:316:in `render_file'
vendor/rails/actionpack/lib/action_controller/base.rb:1100:in `render_for_fi
le'
vendor/rails/actionpack/lib/action_controller/base.rb:836:in `render_with_no
_layout'
vendor/rails/actionpack/lib/action_controller/layout.rb:262:in `render_witho
ut_benchmark'
vendor/rails/actionpack/lib/action_controller/benchmarking.rb:51:in `render'
/usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'
[...]

Is more of the log helpful? Should I reinstall Redmine too after the rails upgrade? Can the database be salvaged, or will it need to be scratched as well if so?

Thanks for any pointers,

Bjorn.

RE: Search gives "Internal error" - Added by Thomas Lecavelier over 9 years ago

Just to be sure:

Are you running redmine through fcgi or mod_rails? In that cases, just restarting web server isn't enough: you have to kill each fcgi/mod_rails processes before starting the server.

In each other cases, this combinaison of rails and ruby should work like a charm under redmine 0.7.3

RE: Search gives "Internal error" - Added by Maarten Kossen over 9 years ago

There is said to be a solution for this (http://www.redmine.org/issues/show/1609) but that doesn't work for me. I have the same configuration as you have. Could you try this and see what happens?

RE: Search gives "Internal error" - Added by Thomas Lecavelier over 9 years ago

I imagine that you have a parasite ruby or rails stack or more probably: an ancient rails version frozen in your redmine.
From your redmine directory, please run this command:

rake rails:unfreeze

Then restart your server and test it again.

RE: Search gives "Internal error" - Added by Bjorn Solberg over 9 years ago

I did the solution suggested by Maarten, i.e. replace the "truncate" method inside the Rails vendor directory, and that made things work again. It seems Rails is included in Redmine inside the vendor/rails directory, so as such the suggestion from Thomas would seem like a good one, but when I tried that Redmine stopped working altogether.

I ended up installing Redmine from SVN, and I'm now a happy Redmine camper again - search and all.

Thanks for your help!

Bjorn.

(1-7/7)