[RBX19] Code converter not found (UTF-8 to UTF-8) #2052

Closed
hron84 opened this Issue Nov 24, 2012 · 10 comments

Comments

Projects
None yet
2 participants

hron84 commented Nov 24, 2012

Hi, I got this strange stacktrace with latest head:

[02:56:33][Execute spec] An exception occurred running at_exit handlers
[02:56:33][Execute spec]     code converter not found (UTF-8 to UTF-8 (Encoding::ConverterNotFoundError)
[02:56:33][Execute spec] 
[02:56:33][Execute spec] Backtrace:
[02:56:33][Execute spec]  [0;31m        Encoding::Converter#initialize at kernel/common/encoding.rb:138 [0m
[02:56:33][Execute spec]  [0;34m                         String#encode at kernel/common/string19.rb:50 [0m
[02:56:33][Execute spec]  [0;34m                        String#encode! at kernel/common/string19.rb:20 [0m
[02:56:33][Execute spec]  SimpleCov::SourceFile::Line#initialize at /var/lib/jenkins/.rvm/gems
[02:56:33][Execute spec]                                            /rbx-head@rhcp/gems/simplecov-0.7.1
[02:56:33][Execute spec]                                            /lib/simplecov/source_file.rb:33 [0m
[02:56:33][Execute spec]    { } in SimpleCov::SourceFile#lines at /var/lib/jenkins/.rvm/gems
[02:56:33][Execute spec]                                          /rbx-head@rhcp/gems/simplecov-0.7.1/lib
[02:56:33][Execute spec]                                          /simplecov/source_file.rb:98 [0m
[02:56:33][Execute spec]  [0;34m  { } in Enumerable(Array)#each_with_index at kernel/common/enumerable19.rb:137 [0m
[02:56:33][Execute spec]  [0;34m                            Array#each at kernel/bootstrap/array.rb:68 [0m
[02:56:33][Execute spec]  [0;34m     Enumerable(Array)#each_with_index at kernel/common/enumerable19.rb:136 [0m
[02:56:33][Execute spec]           SimpleCov::SourceFile#lines at /var/lib/jenkins/.rvm/gems
[02:56:33][Execute spec]                                          /rbx-head@rhcp/gems/simplecov-0.7.1/lib
[02:56:33][Execute spec]                                          /simplecov/source_file.rb:97 [0m
[02:56:33][Execute spec]   SimpleCov::SourceFile#covered_lines at /var/lib/jenkins/.rvm/gems
[02:56:33][Execute spec]                                          /rbx-head@rhcp/gems/simplecov-0.7.1/lib
[02:56:33][Execute spec]                                          /simplecov/source_file.rb:141 [0m
[02:56:33][Execute spec]  { } in SimpleCov::FileList#covered_lines at /var/lib/jenkins/.rvm/gems
[02:56:33][Execute spec]                                              /rbx-head@rhcp/gems/simplecov-0.7.1
[02:56:33][Execute spec]                                              /lib/simplecov/file_list.rb:7 [0m
[02:56:33][Execute spec]  [0;34m        Array(SimpleCov::FileList)#map at kernel/bootstrap/array19.rb:18 [0m
[02:56:33][Execute spec]     SimpleCov::FileList#covered_lines at /var/lib/jenkins/.rvm/gems
[02:56:33][Execute spec]                                          /rbx-head@rhcp/gems/simplecov-0.7.1/lib
[02:56:33][Execute spec]                                          /simplecov/file_list.rb:7 [0m
[02:56:33][Execute spec]     SimpleCov::FileList#lines_of_code at /var/lib/jenkins/.rvm/gems
[02:56:33][Execute spec]                                          /rbx-head@rhcp/gems/simplecov-0.7.1/lib
[02:56:33][Execute spec]                                          /simplecov/file_list.rb:30 [0m
[02:56:33][Execute spec]   SimpleCov::FileList#covered_percent at /var/lib/jenkins/.rvm/gems
[02:56:33][Execute spec]                                          /rbx-head@rhcp/gems/simplecov-0.7.1/lib
[02:56:33][Execute spec]                                          /simplecov/file_list.rb:35 [0m
[02:56:33][Execute spec]   { } in SimpleCov::Formatter::HTMLFormatter#format at (erb):8 [0m
[02:56:33][Execute spec]  [0;34m Rubinius::BlockEnvironment#call_on_instance at kernel/common
[02:56:33][Execute spec]                                                 /block_environment.rb:75 [0m
[02:56:33][Execute spec]  [0;34m                      Kernel(ERB)#eval at kernel/common/eval.rb:75 [0m
[02:56:33][Execute spec]                            ERB#result at /var/lib/jenkins/.rvm/src/rbx-head
[02:56:33][Execute spec]                                          /staging/lib/19/erb.rb:838 [0m
[02:56:33][Execute spec]  { } in SimpleCov::Formatter::HTMLFormatter#format at /var/lib/jenkins/.rvm/gems
[02:56:33][Execute spec]                                                       /rbx-head@rhcp/gems
[02:56:33][Execute spec]                                                       /simplecov-html-0.7.1/lib
[02:56:33][Execute spec]                                                       /simplecov-html.rb:19 [0m
[02:56:33][Execute spec]  [0;34m                               IO.open at kernel/common/io.rb:216 [0m
[02:56:33][Execute spec]  SimpleCov::Formatter::HTMLFormatter#format at /var/lib/jenkins/.rvm/gems
[02:56:33][Execute spec]                                                /rbx-head@rhcp/gems
[02:56:33][Execute spec]                                                /simplecov-html-0.7.1/lib
[02:56:33][Execute spec]                                                /simplecov-html.rb:18 [0m
[02:56:33][Execute spec]   SimpleCov::Formatter::MergedFormatter#format at .simplecov:4 [0m
[02:56:33][Execute spec]             SimpleCov::Result#format! at /var/lib/jenkins/.rvm/gems
[02:56:33][Execute spec]                                          /rbx-head@rhcp/gems/simplecov-0.7.1/lib
[02:56:33][Execute spec]                                          /simplecov/result.rb:91 [0m
[02:56:33][Execute spec]  { } in SimpleCov::Configuration(Module)#at_exit at /var/lib/jenkins/.rvm/gems
[02:56:33][Execute spec]                                                     /rbx-head@rhcp/gems
[02:56:33][Execute spec]                                                     /simplecov-0.7.1/lib
[02:56:33][Execute spec]                                                     /simplecov
[02:56:33][Execute spec]                                                     /configuration.rb:133 [0m
[02:56:33][Execute spec]              { } in Object#__script__ at /var/lib/jenkins/.rvm/gems
[02:56:33][Execute spec]                                          /rbx-head@rhcp/gems/simplecov-0.7.1/lib
[02:56:33][Execute spec]                                          /simplecov/defaults.rb:52 [0m
[02:56:33][Execute spec]  [0;34m         Rubinius::Loader#run_at_exits at kernel/loader.rb:697 [0m
[02:56:33][Execute spec]  [0;34m         Rubinius::Loader#run_at_exits at kernel/loader.rb:702 [0m
[02:56:33][Execute spec]  [0;34m             Rubinius::Loader#epilogue at kernel/loader.rb:717 [0m
[02:56:33][Execute spec]  [0;34m                 Rubinius::Loader#main at kernel/loader.rb:850 [0m
[02:56:33][Execute spec] 
[02:56:33]
[Execute spec] RuntimeError: /var/lib/jenkins/.rvm/src/rbx-head/staging/bin/rbx -S rspec ./spec/helpers/widget_helper_spec.rb ./spec/requests/sign_in_as_spec.rb ./spec/mailers/domain_mailer_spec.rb ./spec/routing/aliases_routing_spec.rb ./spec/routing/posts_routing_spec.rb ./spec/routing/mailboxes_routing_spec.rb ./spec/models/contact_spec.rb ./spec/models/domain_spec.rb ./spec/models/package_spec.rb ./spec/models/address_spec.rb ./spec/models/access_spec.rb ./spec/models/account_spec.rb ./spec/models/post_spec.rb ./spec/models/user_spec.rb ./spec/models/mailbox_spec.rb ./spec/models/alias_spec.rb ./spec/controllers/sign_in_as_controller_spec.rb ./spec/controllers/pages_controller_spec.rb ./spec/controllers/mailboxes_controller_spec.rb ./spec/controllers/posts_controller_spec.rb ./spec/controllers/dashboard_controller_spec.rb ./spec/controllers/aliases_controller_spec.rb failed

Stacktrace:
/var/lib/jenkins/.rvm/gems/rbx-head@rhcp/gems/rspec-core-2.11.1/lib/rspec/core/rake_task.rb:137:in `initialize'
/var/lib/jenkins/.rvm/gems/rbx-head@rhcp/gems/rake-0.9.2.2/lib/rake/file_utils_ext.rb:60:in `verbose'
/var/lib/jenkins/.rvm/gems/rbx-head@rhcp/gems/rspec-core-2.11.1/lib/rspec/core/rake_task.rb:127:in `initialize'
/var/lib/jenkins/.rvm/gems/rbx-head@rhcp/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `execute'
kernel/bootstrap/array.rb:68:in `each'
/var/lib/jenkins/.rvm/gems/rbx-head@rhcp/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `standard_execute (execute)'
/var/lib/jenkins/.buildAgent/plugins/rake-runner/rb/runner/rake_ext.rb:262:in `execute'
/var/lib/jenkins/.buildAgent/plugins/rake-runner/rb/runner/rake_ext.rb:90:in `target_exception_handling'
/var/lib/jenkins/.buildAgent/plugins/rake-runner/rb/runner/rake_ext.rb:268:in `execute'
/var/lib/jenkins/.rvm/gems/rbx-head@rhcp/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `invoke_with_call_chain'
/var/lib/jenkins/.rvm/src/rbx-head/staging/lib/19/monitor.rb:201:in `synchronize (mon_synchronize)'
/var/lib/jenkins/.rvm/gems/rbx-head@rhcp/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/var/lib/jenkins/.rvm/gems/rbx-head@rhcp/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `standard_invoke_with_call_chain (invoke)'
/var/lib/jenkins/.buildAgent/plugins/rake-runner/rb/runner/rake_ext.rb:235:in `my_invoke_with_call_chain'
/var/lib/jenkins/.buildAgent/plugins/rake-runner/rb/runner/rake_ext.rb:90:in `target_exception_handling'
/var/lib/jenkins/.buildAgent/plugins/rake-runner/rb/runner/rake_ext.rb:234:in `invoke (my_invoke_with_call_chain)'
/var/lib/jenkins/.rvm/gems/rbx-head@rhcp/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/var/lib/jenkins/.rvm/gems/rbx-head@rhcp/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
kernel/bootstrap/array.rb:68:in `each'
/var/lib/jenkins/.rvm/gems/rbx-head@rhcp/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
/var/lib/jenkins/.buildAgent/plugins/rake-runner/rb/runner/rake_ext.rb:314:in `standard_exception_handling'
/var/lib/jenkins/.rvm/gems/rbx-head@rhcp/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/var/lib/jenkins/.rvm/gems/rbx-head@rhcp/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `run'
/var/lib/jenkins/.buildAgent/plugins/rake-runner/rb/runner/rake_ext.rb:314:in `standard_exception_handling'
/var/lib/jenkins/.rvm/gems/rbx-head@rhcp/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/var/lib/jenkins/.buildAgent/plugins/rake-runner/rb/runner/rake_ext.rb:179:in `run'
/var/lib/jenkins/.buildAgent/plugins/rake-runner/rb/runner/rakerunner.rb:40:in `__script__'
kernel/delta/codeloader.rb:68:in `load_script'
kernel/delta/codeloader.rb:118:in `load_script'
kernel/loader.rb:615:in `script'
kernel/loader.rb:816:in `main'
[02:56:33] [Execute spec] 
[02:56:33] [Step 4/4] 
[02:56:33] [Step 4/4] Rake aborted!
[02:56:34] [Step 4/4] Process exited with code 1
[02:56:34] [Step 4/4] Step Rake failed
[02:56:34] Publishing internal artifacts
[02:56:34] Publishing artifacts
[02:56:34] Build finished

Rubinius version: rubinius 2.0.0rc1 (1.9.3 ce14ea64 2012-11-02 JI) [x86_64-unknown-linux-gnu]

Any help will be appreciated.

Owner

dbussink commented Nov 24, 2012

Can you provide us with a way to reproduce this? A small script that we can run that shows the problem would be great!

hron84 commented Nov 24, 2012

@dbussink I cannot provide an example, because I do not understand what is the real problem. But, the mentioned code is this:

module SimpleCov
  #
  # Representation of a source file including it's coverage data, source code,
  # source lines and featuring helpers to interpret that data.
  #
  class SourceFile
    # Representation of a single line in a source file including
    # this specific line's source code, line_number and code coverage,
    # with the coverage being either nil (coverage not applicable, e.g. comment
    # line), 0 (line not covered) or >1 (the amount of times the line was
    # executed)
    class Line
      # The source code for this line. Aliased as :source
      attr_reader :src
      # The line number in the source file. Aliased as :line, :number
      attr_reader :line_number
      # The coverage data for this line: either nil (never), 0 (missed) or >=1 (times covered)
      attr_reader :coverage
      # Whether this line was skipped
      attr_reader :skipped

      # Lets grab some fancy aliases, shall we?
      alias_method :source, :src
      alias_method :line, :line_number
      alias_method :number, :line_number

      def initialize(src, line_number, coverage)
        raise ArgumentError, "Only String accepted for source" unless src.kind_of?(String)
        raise ArgumentError, "Only Fixnum accepted for line_number" unless line_number.kind_of?(Fixnum)
        raise ArgumentError, "Only Fixnum and nil accepted for coverage" unless coverage.kind_of?(Fixnum) or coverage.nil?
        @src, @line_number, @coverage = src, line_number, coverage
        @skipped = false
        @src.encode!('UTF-8', 'UTF-8', :invalid => :replace) if @src.respond_to?(:encode!)
      end

As you see, the L33 is @src.encode!('UTF-8', 'UTF-8', :invalid => :replace) if @src.respond_to?(:encode!), so it is literally do that what exception mentioning (converting UTF-8 to UTF-8). I do not know why it makes sense as I do not know String#encode too deep... but the basic failing spec is:

#!/usr/bin/env ruby
# -*- encoding:utf-8 -*-

require 'rspec/autorun'

# Adding this class to pass under MRI 1.8
unless defined?(Encoding)
  class Encoding
    class ConverterNotFoundError < StandardError
    end
  end
end

describe String do
  subject { "Quick brown fox" }
  describe 'method encode!' do
    it 'should not raise an exception' do
      expect do
        subject.encode!('UTF-8', 'UTF-8', :replace => true) if subject.respond_to?(:encode!)
      end.to_not raise_error(Encoding::ConverterNotFoundError)
    end
  end
end

Results:

hron@darkstar /Volumes/Data HD/Projects/job/rwh/rhcp/tmp (feature-user-interface) $ rvm use 1.8.7@rhcp
Using /Users/hron/.rvm/gems/ruby-1.8.7-p371 with gemset rhcp
hron@darkstar /Volumes/Data HD/Projects/job/rwh/rhcp/tmp (feature-user-interface) $ rspec encode_spec.rb 
.

Finished in 0.01536 seconds
1 example, 0 failures
hron@darkstar /Volumes/Data HD/Projects/job/rwh/rhcp/tmp (feature-user-interface) $ rvm use 1.9.3@rhcp
Using /Users/hron/.rvm/gems/ruby-1.9.3-p327 with gemset rhcp
hron@darkstar /Volumes/Data HD/Projects/job/rwh/rhcp/tmp (feature-user-interface) $ rspec encode_spec.rb 
.

Finished in 0.0023 seconds
1 example, 0 failures
hron@darkstar /Volumes/Data HD/Projects/job/rwh/rhcp/tmp (feature-user-interface) $ rvm use jruby@rhcp
Using /Users/hron/.rvm/gems/jruby-1.7.0 with gemset rhcp
hron@darkstar /Volumes/Data HD/Projects/job/rwh/rhcp/tmp (feature-user-interface) $ jruby --1.8 -S rspec encode_spec.rb 
.

Finished in 0.018 seconds
1 example, 0 failures
hron@darkstar /Volumes/Data HD/Projects/job/rwh/rhcp/tmp (feature-user-interface) $ jruby --1.9 -S rspec encode_spec.rb 
.

Finished in 0.021 seconds
1 example, 0 failures
hron@darkstar /Volumes/Data HD/Projects/job/rwh/rhcp/tmp (feature-user-interface) $ rvm use rbx-head@rhcp 
Using /Users/hron/.rvm/gems/rbx-head with gemset rhcp
hron@darkstar /Volumes/Data HD/Projects/job/rwh/rhcp/tmp (feature-user-interface) $ rbx -X18 -S rspec encode_spec.rb 
F

Failures:

  1) String method encode! should not raise an exception
     Failure/Error: end.to_not raise_error(Encoding::ConverterNotFoundError)
     Rubinius::CompileError:
       Error trying to compile /Users/hron/.rvm/gems/rbx-head@rhcp/gems/rspec-expectations-2.11.3/lib/rspec/matchers/built_in/raise_error.rb
     # /Users/hron/.rvm/rubies/rbx-head/runtime/18/compiler/compiler.rbc:13:in `compiler_error'
     # /Users/hron/.rvm/rubies/rbx-head/runtime/18/compiler/compiler.rbc:92:in `compile'
     # kernel/delta/codeloader.rb:181:in `compile_file'
     # kernel/delta/codeloader.rb:155:in `load_file'
     # kernel/common/codeloader.rb:129:in `require'
     # kernel/common/codeloader.rb:206:in `require'
     # kernel/common/autoload.rb:46:in `resolve'
     # ./encode_spec.rb:20:in `__script__'
     # kernel/common/eval18.rb:45:in `instance_eval'
     # kernel/bootstrap/array18.rb:18:in `map'
     # kernel/bootstrap/array18.rb:18:in `map'
     # kernel/bootstrap/array18.rb:18:in `map'
     # kernel/loader.rb:697:in `run_at_exits'
     # kernel/loader.rb:717:in `epilogue'
     # kernel/loader.rb:850:in `main'

Finished in 0.01425 seconds
1 example, 1 failure

Failed examples:

rspec ./encode_spec.rb:17 # String method encode! should not raise an exception

hron@darkstar /Volumes/Data HD/Projects/job/rwh/rhcp/tmp (feature-user-interface) $ rbx -X19 -S rspec encode_spec.rb 
F

Failures:

  1) String method encode! should not raise an exception
     Failure/Error: expect do
       expected no Encoding::ConverterNotFoundError, got #<Encoding::ConverterNotFoundError: code converter not found (UTF-8 to UTF-8)>
     # ./encode_spec.rb:18:in `__script__'
     # kernel/common/eval19.rb:45:in `instance_eval'
     # kernel/bootstrap/array19.rb:18:in `map'
     # kernel/bootstrap/array19.rb:18:in `map'
     # kernel/bootstrap/array19.rb:18:in `map'
     # kernel/loader.rb:697:in `run_at_exits'
     # kernel/loader.rb:717:in `epilogue'
     # kernel/loader.rb:850:in `main'

Finished in 0.00557 seconds
1 example, 1 failure

Failed examples:

rspec ./encode_spec.rb:17 # String method encode! should not raise an exception

Again, please convert it to your spec system, this is for RSpec 2.x.

Owner

dbussink commented Nov 24, 2012

So basically the code that fails is this?

"Quick brown fox".encode!('UTF-8', 'UTF-8', :replace => true)

If you report issues, it's far easier for us to either report them as a spec for Rubyspec (also see for example http://rubyspec.org/style_guide/), or if you don't do that as a as simple as possible stand alone report. In this case the line of code I described above. If you report issues with the whole rspec setup, we have to wade through a whole lot of rspec boilerplate code that only makes it harder for us to understand the problem.

This problem is actually fixed in 55fad50, so it doesn't fail here for me if I run this single line of code. Can you confirm that that version fixes the problem for you too?

hron84 commented Nov 24, 2012

@dbussink as I see RubySpec is not differs from RSpec in too many things... I'll check it.

Also I will check the mentioned commit, when I guess how can I tell rvm to fetch it. It is not merged in master yet, well?

Owner

dbussink commented Nov 24, 2012

It is in master. All work mostly happens in master, so that is the most up to date version with all the latest bugfixes, also this one. What let you to believe this wasn't in master yet?

hron84 commented Nov 24, 2012

@dbussink Crazy me. I counted hours wrong, and I belived I installed my rbx lesser than 15h.

hron84 commented Nov 24, 2012

Til rbx compiling:

describe String do
  describe 'method encode!' do
    it 'not raises Encoding::ConverterNotFoundError' do
      ruby_version_is '1.9' do
        lambda { "Quick brown fox".encode!('UTF-8', 'UTF-8', :replace => true) }.should_not raise_error(Encoding::ConverterNotFoundError)
      end
    end
  end
end

This can be a correct RubySpec for this error? Except, it is not covers if JRuby is running under 1.8 compliant mode. But that case is confuses me.

hron84 commented Nov 24, 2012

55fad50 is closes this issue.

hron84 closed this Nov 24, 2012

Owner

dbussink commented Nov 24, 2012

@brixen also added specs for this behavior on ea748ae. So if it works for you now, there is also no need to add any specs because they already have been added.

Regarding that spec description. ruby_version_is guards should never be inside an it block, also see http://rubyspec.org/guards/. It is by design that then this spec doesn't run in any 1.8 modes, because encodings aren't a part of 1.8 at all.

hron84 commented Nov 24, 2012

I guessed there is a spec, i was just curious (hey, this is my first
rubyspec! :-) ). Thanks for tips.

Garami Gábor
gabor.garami@hron.me
Skype: hron84
Tel: +36 20 235 9621

Sent from my T-Mobile G2
Ezt a levelet telefonról adták fel, ékezethibákat tartalmazhat.
2012.11.24. 15:15, "Dirkjan Bussink" notifications@github.com ezt írta:

@brixen https://github.com/brixen also added specs for this behavior on
ea748aehttps://github.com/rubinius/rubinius/commit/ea748ae858f6d58ed6bde61886df7b9d07e52111.
So if it works for you now, there is also no need to add any specs because
they already have been added.

Regarding that spec description. ruby_version_is guards should never be
inside an it block, also see http://rubyspec.org/guards/. It is by design
that then this spec doesn't run in any 1.8 modes, because encodings aren't
a part of 1.8 at all.


Reply to this email directly or view it on GitHubhttps://github.com/rubinius/rubinius/issues/2052#issuecomment-10678037.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment