"gem install bundler" fails using 2.0 or 2.1 mode #1595

Closed
donv opened this Issue Mar 29, 2014 · 20 comments

Projects

None yet
@donv
Member
donv commented Mar 29, 2014

Hi!

gem install bundler fails:

$ rvm use jruby
Using /Users/uwe/.rvm/gems/jruby-1.7.11
$ ruby --version
jruby 1.7.11 (1.9.3p392) 2014-02-24 86339bb on Java HotSpot(TM) 64-Bit Server VM 1.7.0_51-b13 [darwin-x86_64]
$ gem install bundler
Successfully installed bundler-1.6.0
1 gem installed
$ ruby --1.9 -S gem install bundler
Successfully installed bundler-1.6.0
1 gem installed
$ ruby --2.0 -S gem install bundler
ERROR:  While executing gem ... (ArgumentError)
    marshal data too short
$ rvm use jruby-head
Using /Users/uwe/.rvm/gems/jruby-head
$ ruby --version
jruby 9000.dev (2.1.2) 2014-03-29 6035ded on Java HotSpot(TM) 64-Bit Server VM 1.7.0_51-b13 [darwin-x86_64]
$ gem install bundler
ERROR:  While executing gem ... (ArgumentError)
    marshal data too short

Other rubies work OK, including JRuby in 1.9.3 mode:

$ rvm use 2.1.1
Using /Users/uwe/.rvm/gems/ruby-2.1.1
$ ruby --version
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin12.0]
$ gem install bundler
Fetching: bundler-1.6.0.gem (100%)
Successfully installed bundler-1.6.0
1 gem installed
$ rvm use 2.0.0
Using /Users/uwe/.rvm/gems/ruby-2.0.0-p451
$ ruby --version
ruby 2.0.0p451 (2014-02-24 revision 45167) [x86_64-darwin12.5.0]
$ gem install bundler
Fetching: bundler-1.6.0.gem (100%)
Successfully installed bundler-1.6.0
1 gem installed
$ rvm use 1.9.3
Using /Users/uwe/.rvm/gems/ruby-1.9.3-p545
$ ruby --version
ruby 1.9.3p545 (2014-02-24 revision 45159) [x86_64-darwin13.1.0]
$ gem install bundler
Fetching: bundler-1.6.0.gem (100%)
Successfully installed bundler-1.6.0
1 gem installed
@LTe
LTe commented Mar 31, 2014

The same here

╰─$ ruby -v                                                                                                                                                                                                     
jruby 9000.dev (2.1.2) 2014-03-31 d68cc0e on Java HotSpot(TM) 64-Bit Server VM 1.7.0_45-b18 [linux-amd64]
╰─$ gem install bundler                                                                                                                                                                                              
ERROR:  While executing gem ... (ArgumentError)
    marshal data too short
@masover
masover commented Apr 1, 2014

I can't reproduce this:

$ rbenv shell jruby-1.7.11 
$ ruby --version
jruby 1.7.11 (2.0.0p195) 2014-02-24 86339bb on OpenJDK 64-Bit Server VM 1.7.0_51-b00 [linux-amd64]
$ ruby --2.0 -S gem install bundler
Fetching: bundler-1.6.0.gem (100%)
Successfully installed bundler-1.6.0
1 gem installed

The only difference that jumps out at me is the Java version, and that I have a .jrubyrc that specifies 2.0 mode (but I can't reproduce it if I remove that), and that I'm running rbenv instead of rvm.

@enebo
Member
enebo commented Apr 1, 2014

I can confirm that there seems to be an issue unmarshalling something on master when installing a gem.

@enebo
Member
enebo commented Apr 1, 2014

Narrowed down a little bit. This is not a marshalling issue. It fails:

str = Gem::RemoteFetcher.fetcher.fetch_path uri

str is "" at this point (in api_set.rb). The other difference between master and jruby-1_7 is master is using 2.2.2 while 1.7 branch is at 2.1.9.

@LTe
LTe commented Apr 2, 2014

@enebo good job! It turned out that Net::HTTPOK object does not have filled body instance variable. So this issue is strongly related to #1216

@LTe
LTe commented Apr 2, 2014

After applying this patch everything works. Thanks @djmaze!

╰─$ bin/ruby bin/jgem install bundler                                                                                                                                                                            Successfully installed bundler-1.6.1
1 gem installed
@enebo
Member
enebo commented Apr 2, 2014

@LTe Awesome...I did figure out that gzip was the culprit by the end of yesterday...I did not notice this other issue. I will try and commit something this morning on this...but I will try and figure out why the block form is not working in the first place...

@enebo enebo added a commit that closed this issue Apr 2, 2014
@enebo enebo Fixes #1595, #1216. Zlib.inflat should accept a block for chunked inf…
…lation (on master)
2cbe7e5
@enebo enebo closed this in 2cbe7e5 Apr 2, 2014
@enebo
Member
enebo commented Apr 2, 2014

I fixed this on 1.7 branch with the workaround @djmaze came up with. The amount of API changing needed to fix this for 2.0 mode (which is always going to be experimental on 1.7.x) made me nervous :)

Fixed in commit 89ef3e9

@enebo enebo added this to the JRuby 1.7.12 milestone Apr 2, 2014
@plukevdh

thank you!

@ncuesta
ncuesta commented Jan 16, 2015

I know it's been a long time since this issue was closed, but I'm getting the same marshall data too short on a fresh install of jruby-1.7.18. I'm not getting such error when running the same gem install command with jruby in 1.9 mode.

$ ruby --1.9 -v
jruby 1.7.18 (1.9.3p551) 2014-12-22 625381c on Java HotSpot(TM) 64-Bit Server VM 1.7.0_55-b13 [darwin-x86_64]
$ ruby --1.9 -S gem install bundler
Successfully installed bundler-1.7.12
1 gem installed

$ ruby --2.0 -v
jruby 1.7.18 (2.0.0p598) 2014-12-22 625381c on Java HotSpot(TM) 64-Bit Server VM 1.7.0_55-b13 [darwin-x86_64]
$ ruby --2.0 -S gem install bundler
ERROR:  While executing gem ... (ArgumentError)
    marshal data too short

BTW I'm using rbenv 0.4.0, if that affects anything.

Thanks in advance

@just3ws
just3ws commented Jan 19, 2015

Hi, I'm getting this as well.

  • RVM 1.26.9

  • Bundler 1.7.9

  • RubyGems 2.4.5

  • OS X 10.10.1 (14B25)

  • jruby 1.7.18 (2.0.0p598) 2014-12-22 625381c on Java HotSpot(TM) 64-Bit Server VM 1.7.0_51-b13 +jit [darwin-x86_64]

  • ~/.jrubyrc

    cext.enabled=true
    compat.version=2.0
    
  • java -version
    java version "1.7.0_51"
    Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
    Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)

When I gem update...

    $ gem update --verbose                                                                                                                                                                          
    Updating installed gems
    GET https://api.rubygems.org/specs.4.8.gz
    302 Moved Temporarily
    GET https://s3.amazonaws.com/production.s3.rubygems.org/specs.4.8.gz
    304 Not Modified
    Updating bundler
    HEAD https://api.rubygems.org/api/v1/dependencies
    200 OK
    GET https://api.rubygems.org/api/v1/dependencies?gems=bundler
    200 OK
    ERROR:  While executing gem ... (ArgumentError)
        marshal data too short

Update

  • Removed compat.version=2.0
  • gem update
  • bundle --version => 1.7.12
  • Restore compat.version=2.0
  • gem update => 👍
@n0nick
n0nick commented Feb 12, 2015

I have the same issue.

jruby 1.7.19 2015-01-29 20786bd on OpenJDK 64-Bit Server VM.

Doing $ jruby --1.9 -S gem install bundler mitigated this for now. I was able to continue with bundle install and install other gems.

@kikorb
kikorb commented Feb 18, 2015

I have the same issue here using jruby-1.7.9 and ruby-version 2.0
I know the support for 2.0 is experimental but it will be nice to have the patch everywhere so we don't have to do --1.9 -S everytime we find this issue

@g3d
g3d commented May 13, 2015
> ruby -v                                                                                                
jruby 1.7.20 (2.0.0p598) 2015-05-04 3086e6a on Java HotSpot(TM) 64-Bit Server VM 1.8.0_31-b13 +jit [darwin-x86_64]

> сat .jrubyrc
compat.version=2.0

> gem install bundler
ERROR:  While executing gem ... (ArgumentError)
    marshal data too short
@splattael
Contributor

I've ran into a similar issue.

Applying the patch 89ef3e9 to .rvm/rubies/jruby-1.7.20/lib/ruby/2.0/net/http/response.rb fixed it for me.

It's strange that 89ef3e9 did not make it into 1.7.20 although it's from April 2014 (1.7.12).

@mjc
Contributor
mjc commented May 21, 2015

This definitely still exists and 89ef3e9 didn't get applied.

@voondo
voondo commented May 21, 2015

Same issue here.

@astjohn
astjohn commented Jun 29, 2015

This issue was a huge pain to track down for us when all of a sudden our http response bodies became blank. We switched to 2.0 mode due to a dependency from another gem... Still present in 1.7.20 and (1.7.20.1). I guess we just hope 9000 will be fine?

@backus backus referenced this issue in mbj/devtools Jul 21, 2015
Merged

Bump reek dependency to ~> 3.0.4 #74

@splattael
Contributor

This error still exists in jruby 1.7.21.
After applying the patch from 89ef3e9 it works again.

@enebo @headius I think this issue should be re-opened as 89ef3e9 somehow did not make it into lib/ruby/2.0/net/http/response.rb of 1.7.21.

@mkristian
Member

@splattael reapplied the patch

@mkristian mkristian modified the milestone: JRuby 1.7.22, JRuby 1.7.12 Aug 6, 2015
@kares kares added a commit that referenced this issue Aug 6, 2015
@kares kares Merge branch 'jruby-1_7'
* jruby-1_7:
  avoid (expensive) replaceAll when char replace is possible
  little BacktraceData#transformBacktrace cleanup
  avoid Pattern compiling on every BacktraceData construction - use startsWith
  use static helpers in OSEnvironment for slightly less empty map garbage
  Hack --2.0 net/http gzip problem to avoid multiple version refactoring hell (Fixes #1595, #1216)
  Revert "[build] do not use maven-rc"
  use EMPTY_MAP instead of new (temporary) HashMap instance
  avoid getRuntime() in RubyHash#to_h
  minor cleanup at RubyGlobal
  for better ENV compatibility we should not respond to `to_h` on <= 1.9.3
  ensure that ENV.to_h duplicates the env per MRI ruby
  add failing spec for to_h not duplicating
  [build] do not use maven-rc
  improve test on whether jrubyHome is inside a jar
  Fix NPE when getting parameter.

Conflicts:
	core/src/main/java/org/jruby/RubyGlobal.java
	core/src/main/java/org/jruby/runtime/backtrace/BacktraceData.java
	core/src/main/java/org/jruby/util/OSEnvironment.java
	ext/readline/src/main/java/org/jruby/JRubyApplet.java
	lib/ruby/2.0/net/http/response.rb
a9557ff
@yujinakayama yujinakayama added a commit to rspec/rspec-support that referenced this issue Oct 13, 2015
@yujinakayama yujinakayama Use JRuby 1.7.22 on Travis
With `rvm: jruby` JRuby 1.7.19 is used and the version has an issue with
Bundler upgrade.

jruby/jruby#1595
54e84fd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment