Project

General

Profile

Actions

Backport #5642

closed

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

Added by LaughingJohn (Laughing John) over 12 years ago. Updated over 12 years ago.

Status:
Rejected
Assignee:
-
[ruby-core:41074]

Description

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: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: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: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:in each' 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_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:in module: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:in view_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:in block (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: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: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:in each'
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:in class: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:in match?'
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:in call'
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:in call'
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:in service'
C:/Ruby193/lib/ruby/1.9.1/webrick/httpserver.rb:94:in run' C:/Ruby193/lib/ruby/1.9.1/webrick/server.rb:191:in block 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 issue #5564 which is why I'm raising this here. Apologies if this is the wrong place.

LJ.

Updated by nobu (Nobuyoshi Nakada) over 12 years ago

  • Status changed from Open to Rejected

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

Use File.binread.

Actions

Also available in: Atom PDF

Like0
Like0