Psych double loading problem with version > 1.1.0: psych.rb: warning: already initialized constant VERSION
frahugo opened this issue · 2 comments
Hi. I'm having a Psych loading problem in my Rails project (loaded twice). When I run a rake task (or even Zeus), I get the following warnings:
/Users/hugo/.rvm/gems/ruby-1.9.3-p385@score/gems/psych-2.0.1/lib/psych.rb:219: warning: already initialized constant VERSION
/Users/hugo/.rvm/gems/ruby-1.9.3-p385@score/gems/psych-2.0.1/lib/psych.rb:222: warning: already initialized constant LIBYAML_VERSION
I'm using RVM 1.22.15, ruby 1.9.3-p385, rubygems 2.1.5, bundler 1.3.5.
I can fix the issue by downgrading rubygems-bundler to version 1.1.0.
I inspected the source code and I see that noexec.rb requires 'yaml'. This of course is most likely loading the psych.rb included in ruby 1.9.3, which is version 1.3.4.
These are just warnings. But later, if I run some ActiveRecord code, it tries to call Psych::Visitors::YAMLTree.create which does not exist in version 1.3.4.
Short story, is there a way to fix this? Could noexec.rb unload yaml when done with parsing yaml stuff?
released version 1.3.4
... I assumed that the configuration file is rarely used function as automated behavior is expected - so moving the require
fixes the problem, there is no unload in ruby so this seamed like the only possible solution to just defer loading yaml
.
Excellent...thanks a lot, it fixes my problems. Thanks for the fast reply.