Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

Infinite recursive calls in downloader class (v9.0.4) #3

Open
Annih opened this issue Apr 12, 2018 · 3 comments
Open

Infinite recursive calls in downloader class (v9.0.4) #3

Annih opened this issue Apr 12, 2018 · 3 comments

Comments

@Annih
Copy link

Annih commented Apr 12, 2018

Hello,

With the latest version of java_se (9.0.4) our code relying on it is not working anymore, hitting a stack too deep error:

SystemStackError:    stack level too deep
     # /tmp/d20180411-7446-1f6rgce/cookbooks/java_se/libraries/downloader.rb:78:in `first_hash_argument'
     # /tmp/d20180411-7446-1f6rgce/cookbooks/java_se/libraries/downloader.rb:73:in `allow_redirections'
     # /tmp/d20180411-7446-1f6rgce/cookbooks/java_se/libraries/downloader.rb:60:in `open_uri'
@dhoer
Copy link
Collaborator

dhoer commented Apr 13, 2018

I don't see the 9 branch. But if I had to guess, the path might of changed, e.g., 9.0.4+11? http://download.oracle.com/otn-pub/java/jdk/9.0.4+11/c2514751926b4512b076cc82f959763f/jdk-9.0.4_linux-x64_bin.tar.gz

@dhoer
Copy link
Collaborator

dhoer commented Apr 13, 2018

I forgot master was 9 and not 10. The link still looks good https://github.com/vrivellino/chef-java_se/blob/master/libraries/default.rb#L30-L31

@Annih
Copy link
Author

Annih commented Apr 18, 2018

Hello,

I have more context :)

  1. I miss read my Berksfile, the error occurred with version 8.162.0, but is still present in higher version :(
  2. The error does not occure while trying to download java, but in Chefspec when trying to download an out-of-date fauxhai version:
     # /tmp/d20180412-7298-1twzlcr/cookbooks/java_se/libraries/downloader.rb:66:in `open_uri'
     # ./vendor/bundle/ruby/2.3.0/gems/fauxhai-6.1.0/lib/fauxhai/mocker.rb:58:in `block in fauxhai_data'
     # ./vendor/bundle/ruby/2.3.0/gems/fauxhai-6.1.0/lib/fauxhai/mocker.rb:80:in `fauxhai_data'
     # ./vendor/bundle/ruby/2.3.0/gems/fauxhai-6.1.0/lib/fauxhai/mocker.rb:31:in `initialize'
     # ./vendor/bundle/ruby/2.3.0/gems/fauxhai-6.1.0/lib/fauxhai.rb:12:in `new'
     # ./vendor/bundle/ruby/2.3.0/gems/fauxhai-6.1.0/lib/fauxhai.rb:12:in `mock'
     # ./vendor/bundle/ruby/2.3.0/gems/chefspec-7.2.0/lib/chefspec/solo_runner.rb:375:in `client'
     # ./vendor/bundle/ruby/2.3.0/gems/chefspec-7.2.0/lib/chefspec/solo_runner.rb:143:in `node'
     # ./vendor/bundle/ruby/2.3.0/gems/chefspec-7.2.0/lib/chefspec/solo_runner.rb:108:in `converge'
     # ./spec/unit/resources/user_spec.rb:7:in `block (3 levels) in <top (required)>'
     # ./spec/unit/resources/user_spec.rb:80:in `block (3 levels) in <top (required)>'```

I think this is due to the way you patch *open_uri*, if the code is applied multiple times, it'll end up call "original_uri" which is the patched version calling again *original_uri*, etc.

I hope this happens only in tests, but we never know. I'll send a PR soon to properly patch this method.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants