dump format error for symbol(0x6) - related to ruby issue #5564 #3644

Closed
LaughingJohn opened this Issue Nov 16, 2011 · 1 comment

Projects

None yet

2 participants

@LaughingJohn

I'm new to rails so it could be me, but I'm trying to run a newly created empty rails project on Windows 7 64 bit and getting the following:

[2011-11-16 11:05:21] INFO WEBrick 1.3.1
[2011-11-16 11:05:21] INFO ruby 1.9.3 (2011-10-30) [i386-mingw32]
[2011-11-16 11:05:21] INFO WEBrick::HTTPServer#start: pid=4192 port=3000
fileName=C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.1.2.rc2/lib/action_view/data/encoding_conversions.dump
dump format error for symbol(0x6)
C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.1.2.rc2/lib/action_view/template.rb:27:in load' C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.1.2.rc2/lib/action_view/template.rb:27:in<top (required)>'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/coffee-rails-3.1.1/lib/coffee/rails/template_handler.rb:17:in block in <top (required)>' C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.1.2.rc2/lib/active_support/lazy_load_hooks.rb:36:ininstance_eval'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.1.2.rc2/lib/active_support/lazy_load_hooks.rb:36:in execute_hook' C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.1.2.rc2/lib/active_support/lazy_load_hooks.rb:43:inblock in run_load_hooks'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.1.2.rc2/lib/active_support/lazy_load_hooks.rb:42:in each' C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.1.2.rc2/lib/active_support/lazy_load_hooks.rb:42:inrun_load_hooks'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.1.2.rc2/lib/action_view/base.rb:216:in <class:Base>' C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.1.2.rc2/lib/action_view/base.rb:133:inmodule:ActionView'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.1.2.rc2/lib/action_view/base.rb:8:in <top (required)>' C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.1.2.rc2/lib/abstract_controller/view_paths.rb:90:inview_paths='
C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.1.2.rc2/lib/abstract_controller/view_paths.rb:76:in prepend_view_path' C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.1.2.rc2/lib/rails/engine.rb:532:inblock (2 levels) in class:Engine'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.1.2.rc2/lib/active_support/lazy_load_hooks.rb:36:in instance_eval' C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.1.2.rc2/lib/active_support/lazy_load_hooks.rb:36:inexecute_hook'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.1.2.rc2/lib/active_support/lazy_load_hooks.rb:43:in block in run_load_hooks' C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.1.2.rc2/lib/active_support/lazy_load_hooks.rb:42:ineach'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.1.2.rc2/lib/active_support/lazy_load_hooks.rb:42:in run_load_hooks' C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.1.2.rc2/lib/action_controller/base.rb:234:inclass:Base'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.1.2.rc2/lib/action_controller/base.rb:171:in <module:ActionController>' C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.1.2.rc2/lib/action_controller/base.rb:3:in<top (required)>'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.1.2.rc2/lib/action_dispatch/middleware/static.rb:31:in ext' C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.1.2.rc2/lib/action_dispatch/middleware/static.rb:15:inmatch?'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.1.2.rc2/lib/action_dispatch/middleware/static.rb:47:in call' C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.1.2.rc2/lib/rails/engine.rb:456:incall'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.3.5/lib/rack/content_length.rb:14:in call' C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.1.2.rc2/lib/rails/rack/log_tailer.rb:14:incall'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.3.5/lib/rack/handler/webrick.rb:59:in service' C:/Ruby193/lib/ruby/1.9.1/webrick/httpserver.rb:138:inservice'
C:/Ruby193/lib/ruby/1.9.1/webrick/httpserver.rb:94:in run' C:/Ruby193/lib/ruby/1.9.1/webrick/server.rb:191:inblock in start_thread'

It's failing in template.rb on the line "conversions = Marshal.load(File.read(filename))", the code looks like this:

if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'ruby' && RUBY_VERSION == '1.9.3' && RUBY_PATCHLEVEL == 0

This is a hack to work around a bug in Ruby 1.9.3p0:

http://redmine.ruby-lang.org/issues/5564

Basically, at runtime we may need to perform some encoding conversions on the templates,

but if the converter hasn't been loaded by Ruby beforehand (i.e. now), then it won't be

able to find it (due to a bug).

However, we don't know what conversions we may need to do a runtime. So we load up a

marshal-dumped structure which contains a pre-generated list of all the possible conversions,

and we load all of them.

In my testing this increased the process size by about 3.9 MB (after the conversions array

is GC'd) and took around 170ms to run, which seems acceptable for a workaround.

The script to dump the conversions is: https://gist.github.com/1342729

filename = File.join(File.dirname(FILE), 'data', 'encoding_conversions.dump')
puts "fileName=" + filename

begin
conversions = Marshal.load(File.read(filename))

conversions.each do |from, to_array|
  to_array.each do |to|
    Encoding::Converter.new(from, to)
  end
end

rescue => e
puts e.message
puts e.backtrace
end
end

The comment suggests it's related to a fix for Rubyt issue #5564. Apologies if I'm posting to the wrong place.

LJ.

Member

Thanks for reporting this regression. I'll get it fixed before the 3.1.2 final release.

@jonleighton jonleighton added a commit that closed this issue Nov 16, 2011
@jonleighton jonleighton Switch from marshal format to plain text for the encoding conversions…
… dump. This is for windows compatibility. Fixes #3644.
6f08621
@lazyatom lazyatom pushed a commit to lazyatom/rails that referenced this issue Nov 16, 2011
@jonleighton jonleighton Switch from marshal format to plain text for the encoding conversions…
… dump. This is for windows compatibility. Fixes #3644.
3a6a10a
@arunagw arunagw pushed a commit to arunagw/rails that referenced this issue Nov 17, 2011
@jonleighton jonleighton Switch from marshal format to plain text for the encoding conversions…
… dump. This is for windows compatibility. Fixes #3644.
f754f3d
@georgeG georgeG added a commit to georgeG/rails that referenced this issue Nov 27, 2011
@georgeG georgeG Merge remote-tracking branch 'upstream/master'
* upstream/master: (25 commits)
  It should be @calculated_ip not @calculate_ip
  No need to `readlines` then `join`, just use `read` ❤️
  Fix impractical I18n lookup in nested fields_for
  Initialize our instance variables.
  No need to `readlines` then `join`, just use `read` ❤️
  Adding a deprecation warning for use of the schema_info table.
  Join method uses empty string by default, so remove it
  dbfile isn't supported anymore, so remove
  Reduce schema format tests
  Move conditionals to separate tasks so they can be reused.
  `ActiveRecord::Base#becomes` should retain the errors of the original object.
  the object itself isn't the IP, #to_s is the IP
  :facepalm: Request#remote_ip has to work without the middleware
  Revert "Revert "Merge pull request #3640 from indirect/remote_ip""
  removing some useless conditionals
  Switch from marshal format to plain text for the encoding conversions dump. This is for windows compatibility. Fixes #3644.
  fixing tests on PG
  bundler treats trunk ruby as ruby 1.9, hack around that for now
  Substituted RailsCommands for Rails::Commands
  Changed Commands module to RailsCommands.
  ...
d46826d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment