New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JRuby 9.1.0.0 on Windows causes frozen string errors when using rake and minitest #3855

Closed
jeremyevans opened this Issue May 5, 2016 · 6 comments

Comments

Projects
None yet
3 participants
@jeremyevans
Contributor

jeremyevans commented May 5, 2016

Basically, running jruby 9.1.0.0 from the command line in Windows works correctly. However, when using rake's sh method the same command line breaks with a frozen string error.

Because of this issue, I can't run Sequel's specs using rake with JRuby 9.1.0.0 on Windows.

Environment

jruby 9.1.0.0 (2.3.0) 2016-05-02 a633c63 Java HotSpot(TM) 64-Bit Server VM 25.45-b02 on 1.8.0_45-b15 +jit [mswin32-x86_64]

Expected Behavior

>C:/jruby-9.1.0.0/bin/jruby.exe -ve "require 'minitest/autorun'"
jruby 9.1.0.0 (2.3.0) 2016-05-02 a633c63 Java HotSpot(TM) 64-Bit Server VM 25.45-b02 on 1.8.0_45-b15 +jit [mswin32-x86_64]
io/console not supported; tty will not be manipulated
Run options: --seed 28803

# Running:



Finished in 0.017170s, 0.0000 runs/s, 0.0000 assertions/s.

0 runs, 0 assertions, 0 failures, 0 errors, 0 skips
>type Rakefile
task :default do
  sh "#{FileUtils::RUBY} -ve \"require 'minitest/autorun'\""
end
>C:/jruby-9.1.0.0/bin/jruby.exe -S rake
C:/jruby-9.1.0.0/bin/jruby.exe -ve "require 'minitest/autorun'"
jruby 9.1.0.0 (2.3.0) 2016-05-02 a633c63 Java HotSpot(TM) 64-Bit Server VM 25.45-b02 on 1.8.0_45-b15 +jit [mswin32-x86_64]
io/console not supported; tty will not be manipulated
Run options: --seed 28803

# Running:



Finished in 0.017170s, 0.0000 runs/s, 0.0000 assertions/s.

0 runs, 0 assertions, 0 failures, 0 errors, 0 skips

Actual Behavior

>C:/jruby-9.1.0.0/bin/jruby.exe -S rake
C:/jruby-9.1.0.0/bin/jruby.exe -ve "require 'minitest/autorun'"
jruby 9.1.0.0 (2.3.0) 2016-05-02 a633c63 Java HotSpot(TM) 64-Bit Server VM 25.45-b02 on 1.8.0_45-b15 +jit [mswin32-x86_64]
io/console not supported; tty will not be manipulatedRuntimeError: can't modify frozen String
    <top> at C:/jruby-9.1.0.0/lib/ruby/stdlib/rubygems/user_interaction.rb:11
  require at org/jruby/RubyKernel.java:944
    <top> at C:/jruby-9.1.0.0/lib/ruby/stdlib/rubygems/config_file.rb:1
  require at org/jruby/RubyKernel.java:944
    <top> at C:/jruby-9.1.0.0/lib/ruby/stdlib/rubygems/config_file.rb:8
  require at org/jruby/RubyKernel.java:944
    <top> at C:/jruby-9.1.0.0/lib/ruby/stdlib/rubygems/defaults/jruby.rb:1
  require at org/jruby/RubyKernel.java:944
    <top> at C:/jruby-9.1.0.0/lib/ruby/stdlib/rubygems/defaults/jruby.rb:1
     load at org/jruby/RubyKernel.java:962
    <top> at C:/jruby-9.1.0.0/lib/ruby/stdlib/rubygems.rb:1
rake aborted!
Command failed with status (1): [C:/jruby-9.1.0.0/bin/jruby.exe -ve "requir...]
L:/jrubytest/rakefile:2:in `block in (root)'
Tasks: TOP => default
(See full trace by running task with --trace)
@kerbo

This comment has been minimized.

Show comment
Hide comment
@kerbo

kerbo May 6, 2016

I'm having the same problem with RubyMine. Rails won't start.

kerbo commented May 6, 2016

I'm having the same problem with RubyMine. Rails won't start.

@headius

This comment has been minimized.

Show comment
Hide comment
@headius

headius May 9, 2016

Member

Ignore those commits; they were for another bug and have been force-pushed to fix the bad reference.

Member

headius commented May 9, 2016

Ignore those commits; they were for another bug and have been force-pushed to fix the bad reference.

@mprins mprins referenced this issue May 10, 2016

Merged

Upgrade JRuby to 9.1.x.x #102

3 of 4 tasks complete
@headius

This comment has been minimized.

Show comment
Hide comment
@headius

headius May 11, 2016

Member

Looking into this one today.

Member

headius commented May 11, 2016

Looking into this one today.

@headius headius self-assigned this May 11, 2016

@headius

This comment has been minimized.

Show comment
Hide comment
@headius

headius May 11, 2016

Member

Relevant portion of the Java trace. It's an IO#puts call triggering the error.

        frozenCheck at org/jruby/RubyString.java:890
        modifyCheck at org/jruby/RubyString.java:878
               view at org/jruby/RubyString.java:1001
           setValue at org/jruby/RubyString.java:5440
        doWriteconv at org/jruby/util/io/OpenFile.java:2080
             fwrite at org/jruby/util/io/OpenFile.java:2036
              write at org/jruby/RubyIO.java:1437
              write at org/jruby/RubyIO.java:1409
            finvoke at org/jruby/RubyClass.java:770
             invoke at org/jruby/runtime/Helpers.java:403
         callMethod at org/jruby/RubyBasicObject.java:385
              write at org/jruby/RubyIO.java:2546
     writeSeparator at org/jruby/RubyIO.java:2489
              puts0 at org/jruby/RubyIO.java:2440
               puts at org/jruby/RubyIO.java:2416
Member

headius commented May 11, 2016

Relevant portion of the Java trace. It's an IO#puts call triggering the error.

        frozenCheck at org/jruby/RubyString.java:890
        modifyCheck at org/jruby/RubyString.java:878
               view at org/jruby/RubyString.java:1001
           setValue at org/jruby/RubyString.java:5440
        doWriteconv at org/jruby/util/io/OpenFile.java:2080
             fwrite at org/jruby/util/io/OpenFile.java:2036
              write at org/jruby/RubyIO.java:1437
              write at org/jruby/RubyIO.java:1409
            finvoke at org/jruby/RubyClass.java:770
             invoke at org/jruby/runtime/Helpers.java:403
         callMethod at org/jruby/RubyBasicObject.java:385
              write at org/jruby/RubyIO.java:2546
     writeSeparator at org/jruby/RubyIO.java:2489
              puts0 at org/jruby/RubyIO.java:2440
               puts at org/jruby/RubyIO.java:2416
@headius

This comment has been minimized.

Show comment
Hide comment
@headius

headius May 11, 2016

Member

I think I see it; it appears that the logic for transcoding written strings before writing them attempts to replace the contents of the original string. Because we reuse the same frozen string for \n in puts calls, it blows up trying to transcode that.

Fix shortly. No workaround I'm afraid.

Member

headius commented May 11, 2016

I think I see it; it appears that the logic for transcoding written strings before writing them attempts to replace the contents of the original string. Because we reuse the same frozen string for \n in puts calls, it blows up trying to transcode that.

Fix shortly. No workaround I'm afraid.

@headius headius closed this in 24f3a47 May 11, 2016

@headius

This comment has been minimized.

Show comment
Hide comment
@headius

headius May 11, 2016

Member

And a trivial reproduction for anyone curious:

$ jruby -e "File.open('/tmp/blah.txt', 'w', newline: :crlf) {|f| f.puts}"
RuntimeError: can't modify frozen String
        write at org/jruby/RubyIO.java:1437
        write at org/jruby/RubyIO.java:1409
        write at org/jruby/RubyIO.java:2546
         puts at org/jruby/RubyIO.java:2416
  block in -e at -e:1
         open at org/jruby/RubyIO.java:1131
        <top> at -e:1

I will turn this into a RubySpec.

Member

headius commented May 11, 2016

And a trivial reproduction for anyone curious:

$ jruby -e "File.open('/tmp/blah.txt', 'w', newline: :crlf) {|f| f.puts}"
RuntimeError: can't modify frozen String
        write at org/jruby/RubyIO.java:1437
        write at org/jruby/RubyIO.java:1409
        write at org/jruby/RubyIO.java:2546
         puts at org/jruby/RubyIO.java:2416
  block in -e at -e:1
         open at org/jruby/RubyIO.java:1131
        <top> at -e:1

I will turn this into a RubySpec.

headius added a commit that referenced this issue May 11, 2016

eregon added a commit to ruby/spec that referenced this issue May 29, 2016

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