Strange "NoMethodError" and "500 - Internal error" when accessing Gantt tab

Added by Leo L almost 7 years ago

Hello,

I am running Redmine 2.0.3 stable :
Environment:
Redmine version 2.0.3.stable
Ruby version 1.8.7 (amd64-freebsd9)
Rails version 3.2.6
Environment production
Database adapter MySQL
Redmine plugins:
no plugin installed

I'm testing redmine out, so I've created a test project with a dummy task in it, and see how redmine is displaying it.
But when I'm trying to access Gantt tab, I'm encountering a "500 - Internal error" :

Started GET "/projects/newconsole/issues/gantt" for 10.0.2.142 at Fri Aug 24 12:37:45 +0000 2012
Processing by GanttsController#show as HTML
Parameters: {"project_id"=>"newconsole"}
Completed 500 Internal Server Error in 13ms

NoMethodError (undefined method `-' for true:TrueClass):
lib/redmine/helpers/gantt.rb:69:in `initialize'
app/controllers/gantts_controller.rb:34:in `new'
app/controllers/gantts_controller.rb:34:in `show'

The same exact error for Calendar tab.
Other tabs and functionnalities are working fine...

Is someone has an idea on how to fix this ?

Thanks,

--
Léo L.

Replies (33)

RE: Strange "NoMethodError" and "500 - Internal error" when accessing Gantt tab - Added by Leo L almost 7 years ago

Hi again,

I read this problem often comes from using plugins... but I have none.
I tested ChiliProject (a fork from redmine) to see how it behaves, and both Gantt/Calendar were displaying without problems.
But I prefer to use redmine :-)

It seems like a redmine problem only, but the logs aren't helping me at all...
And I've now no clue about what can I try to fix this !

Any help would be appreciated.

--
Léo L.

RE: Strange "NoMethodError" and "500 - Internal error" when accessing Gantt tab - Added by Etienne Massip almost 7 years ago

Looking at the code there is no reason this error triggers :|

Maybe you could try to upgrade the ruby interpreter used?

RE: Strange "NoMethodError" and "500 - Internal error" when accessing Gantt tab - Added by Leo L almost 7 years ago

Hi Etienne,

Thanks for your reply, even if I'm worried that the code didn't help :)
You mean using ruby19 instead of ruby18 ?

If so, I already tested it : Same problem...

RE: Strange "NoMethodError" and "500 - Internal error" when accessing Gantt tab - Added by Etienne Massip over 6 years ago

Did you have a plugin installed at some point of time?

RE: Strange "NoMethodError" and "500 - Internal error" when accessing Gantt tab - Added by Leo L over 6 years ago

Hi Etienne,

Yeah, just after completing the redmine installation, I tried to install one plugin just to see how it worked : I put the plugin folder in the plugin's directory, I restart my apache, saw that the plugin was correctly installed, and then removed the plugin from the directory.

Do you think that the plugin could have messed up entire parts of redmine ?
Thank you.

--
Léo L.

RE: Strange "NoMethodError" and "500 - Internal error" when accessing Gantt tab - Added by Leo L over 6 years ago

I tried this one out : redmine_resource_allocation-0.1b.
When I restarted the server, I couldn't access redmine at all... So I double-checked the plugin presentation page, and I saw it was made only for redmine 1.x (I'm a redmine new adopter, that's why I didn't check before), so I removed it, and redmine was reachable again. But both Gantt and Calendar were broken.

--
Léo L.

RE: Strange "NoMethodError" and "500 - Internal error" when accessing Gantt tab - Added by Etienne Massip over 6 years ago

No clue. Could you please post your /lib/redmine/helpers/gantt.rb here?

RE: Strange "NoMethodError" and "500 - Internal error" when accessing Gantt tab - Added by Leo L over 6 years ago

Thank you for your time.
There is my gantt.rb file.

--
Léo L.

gantt.rb Magnifier (31.2 KB)

RE: Strange "NoMethodError" and "500 - Internal error" when accessing Gantt tab - Added by Leo L over 6 years ago

Hi again,

Some news about my concern.
I removed completely the redmine directory, then I reinstalled it from SVN with "svn co http://redmine.rubyforge.org/svn/branches/2.0-stable redmine-2.0".
I installed no plugin since the new install, but the "500-Internal error" problem's still the same !

I thought reinstalling would solve the problem.
What's odd is that ChiliProject is displaying these tabs correctly, so I'm guessing it doesn't come from a missing lib.
Any advice ?

--
Léo.

RE: Strange "NoMethodError" and "500 - Internal error" when accessing Gantt tab - Added by Etienne Massip over 6 years ago

Could you just add the following line just before line #69 (@date_to = (@date_from >> @months) - 1) of gantt.rb?

ActiveRecord::Base.logger.info "BEFORE 500: #{@date_from.inspect} / #{@months.inspect}" 

Then restart your instance, trigger the error and have a look to the log file again?

RE: Strange "NoMethodError" and "500 - Internal error" when accessing Gantt tab - Added by Leo L over 6 years ago

Etienne,

In my gantt.rb, I have now :
68 @date_from = Date.civil(@year_from, @month_from, 1)
69 ActiveRecord::Base.logger.info "BEFORE 500: #{@date_from.inspect} / #{@months.inspect}"
70 @date_to = (@date_from >> @months) - 1

I started the server :
ruby script/rails server -p 4000 -e production

I accessed my test project, went to "Gantt" tab :

@Started GET "/projects/console/issues/gantt" for 10.0.2.142 at Tue Aug 28 16:12:21 +0000 2012
Processing by GanttsController#show as HTML
Parameters: {"project_id"=>"console"}
BEFORE 500: Wed, 01 Aug 2012 / 6
Completed 500 Internal Server Error in 17ms

NoMethodError (undefined method `-' for true:TrueClass):
lib/redmine/helpers/gantt.rb:70:in `initialize'
app/controllers/gantts_controller.rb:34:in `new'
app/controllers/gantts_controller.rb:34:in `show'@

RE: Strange "NoMethodError" and "500 - Internal error" when accessing Gantt tab - Added by Etienne Massip over 6 years ago

I must say I have no clue how a Date >> Fixnum could give a boolean except with some hidden crazy patch.

Could you try with

ActiveRecord::Base.logger.info "BEFORE 500: #{@date_from.class} / #{@months.class} / #{(@date_from >> @months).inspect}" 
?

RE: Strange "NoMethodError" and "500 - Internal error" when accessing Gantt tab - Added by Leo L over 6 years ago

Thanks for all your efforts.
Unfortunately, I have replaced your first proposition by your second, but nothing's new :

@Started GET "/projects/console/issues/gantt" for 10.0.2.142 at Tue Aug 28 17:27:47 +0200 2012
Processing by GanttsController#show as HTML
Parameters: {"project_id"=>"console"}
Completed 500 Internal Server Error in 27ms

NoMethodError (undefined method `-' for true:TrueClass):
lib/redmine/helpers/gantt.rb:69:in `initialize'
app/controllers/gantts_controller.rb:34:in `new'
app/controllers/gantts_controller.rb:34:in `show'@

No more "Before 500 : " line in the logs...

RE: Strange "NoMethodError" and "500 - Internal error" when accessing Gantt tab - Added by Etienne Massip over 6 years ago

Because it's @date_from >> @months itself which is faulty and not the subsequent substraction.

RE: Strange "NoMethodError" and "500 - Internal error" when accessing Gantt tab - Added by Etienne Massip over 6 years ago

Last debug action?

ActiveRecord::Base.logger.info "BEFORE 500: #{@date_from.class} / #{@months.class}"

RE: Strange "NoMethodError" and "500 - Internal error" when accessing Gantt tab - Added by Etienne Massip over 6 years ago

Would be better, sorry:

ActiveRecord::Base.logger.info "BEFORE 500: #{@date_from.class} / #{@months.class} / #{@date_from.mday} / #{@date_from.mon}"

RE: Strange "NoMethodError" and "500 - Internal error" when accessing Gantt tab - Added by Leo L over 6 years ago

I installed Ruby and Rails via the FreeBSD ports system.
I assume this ruby/rails system is fine if ChiliProject's is displaying it correctly... but maybe I'm wrong.

The last debug action results :

@Started GET "/projects/console/issues/gantt" for 10.0.2.142 at Tue Aug 28 17:56:19 +0200 2012
Processing by GanttsController#show as HTML
Parameters: {"project_id"=>"console"}
BEFORE 500: Date / Fixnum
Completed 500 Internal Server Error in 17ms

NoMethodError (undefined method `-' for true:TrueClass):
lib/redmine/helpers/gantt.rb:70:in `initialize'
app/controllers/gantts_controller.rb:34:in `new'
app/controllers/gantts_controller.rb:34:in `show'@

Is it leading your mind to somewhere ? Because I'm completely lost there :)

Many thanks.

--
Léo.

RE: Strange "NoMethodError" and "500 - Internal error" when accessing Gantt tab - Added by Leo L over 6 years ago

With the improved patch, it results indeed differently :

@Started GET "/projects/console/issues/gantt" for 10.0.2.142 at Tue Aug 28 18:02:48 +0200 2012
Processing by GanttsController#show as HTML
Parameters: {"project_id"=>"console"}
BEFORE 500: Date / Fixnum / 1 / 8
Completed 500 Internal Server Error in 18ms

NoMethodError (undefined method `-' for true:TrueClass):
lib/redmine/helpers/gantt.rb:70:in `initialize'
app/controllers/gantts_controller.rb:34:in `new'
app/controllers/gantts_controller.rb:34:in `show'@

RE: Strange "NoMethodError" and "500 - Internal error" when accessing Gantt tab - Added by Etienne Massip over 6 years ago

Leo L wrote:

I installed Ruby and Rails via the FreeBSD ports system.
I assume this ruby/rails system is fine if ChiliProject's is displaying it correctly... but maybe I'm wrong.

Everything in Redmine is fine; all I can see is this Freebsd-style installation; could you uninstall it and install rails using Bundler instead?

RE: Strange "NoMethodError" and "500 - Internal error" when accessing Gantt tab - Added by Leo L over 6 years ago

Hi,

I erased the redmine directory and dropped the mysql databases and user.
I removed all the rubygem-* installed via FreeBSD port's system.

I did a fresh install via SVN, then followed the general instructions for installing redmine.
Installed all the gems with bundle install :

@*** LOCAL GEMS ***

actionmailer (3.2.6)
actionpack (3.2.6)
activemodel (3.2.6)
activerecord (3.2.6)
activeresource (3.2.6)
activesupport (3.2.6)
arel (3.0.2)
builder (3.0.0)
bundler (1.1.5)
coderay (1.0.7)
daemon_controller (1.0.0)
erubis (2.7.0)
fastercsv (1.5.5)
fastthread (1.0.7)
hike (1.2.1)
i18n (0.6.0)
journey (1.0.4)
json (1.7.5)
mail (2.4.4)
mime-types (1.19)
multi_json (1.3.6)
mysql (2.8.1)
net-ldap (0.3.1)
passenger (3.0.15)
polyglot (0.3.3)
prototype-rails (3.2.1)
rack (1.4.1)
rack-cache (1.2)
rack-openid (1.3.1)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.2.6)
railties (3.2.6)
rake (0.9.2.2)
rdoc (3.12)
rmagick (2.13.1)
ruby-openid (2.1.8)
sprockets (2.1.3)
thor (0.16.0)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.33)@

I restarted apache, went to redmine page.
Created a new project.
Went to Gantt tab.
.. then cried :)

Same error :

@Started GET "/projects/consolev2/issues/gantt" for 10.0.2.142 at Wed Aug 29 17:43:50 +0200 2012
Processing by GanttsController#show as HTML
Parameters: {"project_id"=>"consolev2"}
BEFORE 500: Date / Fixnum / 1 / 8
Completed 500 Internal Server Error in 17ms

NoMethodError (undefined method `-' for true:TrueClass):
lib/redmine/helpers/gantt.rb:70:in `initialize'
app/controllers/gantts_controller.rb:34:in `new'
app/controllers/gantts_controller.rb:34:in `show'@

Too bad.
But I just can't figure out why ChiliProject is working fine, as it just based on redmine (the gantt.rb is exactly the same for both !).

Thanks again for all your help, it will remains as a mysterious error :(

--
Léo L.

RE: Strange "NoMethodError" and "500 - Internal error" when accessing Gantt tab - Added by Etienne Massip over 6 years ago

Leo L wrote:

But I just can't figure out why ChiliProject is working fine, as it just based on redmine (the gantt.rb is exactly the same for both !).

Probably because CP is still using Rails 2.3.x.

Could you please give us the result of typing Date.today >> 6 in rails console (ruby scripts/rails c from redmine dir)?

RE: Strange "NoMethodError" and "500 - Internal error" when accessing Gantt tab - Added by Toshi MARUYAMA over 6 years ago

Leo L wrote:

But I just can't figure out why ChiliProject is working fine, as it just based on redmine (the gantt.rb is exactly the same for both !).

Are you using Redmine on ChiliProject database?
There is no compatibility between Redmine and ChiliProject database.

RE: Strange "NoMethodError" and "500 - Internal error" when accessing Gantt tab - Added by Leo L over 6 years ago

Hi Etienne and Toshi,

@Toshi : I use separate databases for each project.
@Etienne : Well. When I type "ruby script/rails console" from redmine directory, I got a verbose output :)
There it is !

/usr/local/lib/ruby/gems/1.8/gems/activerecord-3.2.6/lib/active_record/connection_adapters/mysql_adapter.rb:396:in `real_connect': Unknown database 'redmine_development' (Mysql::Error)
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.2.6/lib/active_record/connection_adapters/mysql_adapter.rb:396:in `connect'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.2.6/lib/active_record/connection_adapters/mysql_adapter.rb:131:in `initialize'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.2.6/lib/active_record/connection_adapters/mysql_adapter.rb:38:in `new'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.2.6/lib/active_record/connection_adapters/mysql_adapter.rb:38:in `mysql_connection'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:309:in `send'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:309:in `new_connection'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:319:in `checkout_new_connection'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:241:in `checkout'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:236:in `loop'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:236:in `checkout'
from /usr/local/lib/ruby/1.8/monitor.rb:242:in `synchronize'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:233:in `checkout'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:96:in `connection'
from /usr/local/lib/ruby/1.8/monitor.rb:242:in `synchronize'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:95:in `connection'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:404:in `retrieve_connection'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_specification.rb:168:in `retrieve_connection'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_specification.rb:142:in `connection'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.2.6/lib/active_record/model_schema.rb:308:in `clear_cache!'
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-3.2.6/lib/active_record/railtie.rb:97:in `_callback_before_3'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:418:in `_run__1700900058__prepare__4__callbacks'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:405:in `send'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:405:in `__run_callback'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:385:in `_run_prepare_callbacks'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:81:in `send'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:81:in `run_callbacks'
from /usr/local/lib/ruby/gems/1.8/gems/actionpack-3.2.6/lib/action_dispatch/middleware/reloader.rb:74:in `prepare!'
from /usr/local/lib/ruby/gems/1.8/gems/actionpack-3.2.6/lib/action_dispatch/middleware/reloader.rb:48:in `prepare!'
from /usr/local/lib/ruby/gems/1.8/gems/railties-3.2.6/lib/rails/application/finisher.rb:47
from /usr/local/lib/ruby/gems/1.8/gems/railties-3.2.6/lib/rails/initializable.rb:30:in `instance_exec'
from /usr/local/lib/ruby/gems/1.8/gems/railties-3.2.6/lib/rails/initializable.rb:30:in `run'
from /usr/local/lib/ruby/gems/1.8/gems/railties-3.2.6/lib/rails/initializable.rb:55:in `run_initializers'
from /usr/local/lib/ruby/gems/1.8/gems/railties-3.2.6/lib/rails/initializable.rb:54:in `each'
from /usr/local/lib/ruby/gems/1.8/gems/railties-3.2.6/lib/rails/initializable.rb:54:in `run_initializers'
from /usr/local/lib/ruby/gems/1.8/gems/railties-3.2.6/lib/rails/application.rb:136:in `initialize!'
from /usr/local/lib/ruby/gems/1.8/gems/railties-3.2.6/lib/rails/railtie/configurable.rb:30:in `send'
from /usr/local/lib/ruby/gems/1.8/gems/railties-3.2.6/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /usr/local/www/redmine/config/environment.rb:14
from /usr/local/lib/ruby/gems/1.8/gems/railties-3.2.6/lib/rails/application.rb:103:in `require'
from /usr/local/lib/ruby/gems/1.8/gems/railties-3.2.6/lib/rails/application.rb:103:in `require_environment!'
from /usr/local/lib/ruby/gems/1.8/gems/railties-3.2.6/lib/rails/commands.rb:40
from script/rails:6:in `require'
from script/rails:6
[leo@srv-freebsd /usr/local/www/redmine]#

As I directly fall back to shell prompt, I can't type "Date.today >> 6" as you told me.
I looked at the output but I don't know what's normal and what's not... But I saw mysql related errors, so I checked that I put the right database and password in my database.yml, and I confirm you that's OK.

--
Léo.

1 2 (1-25/33)