berkshelf / vagrant-berkshelf

A Vagrant plugin to add Berkshelf integration to the Chef provisioners
Other
378 stars 100 forks source link

Adding a cookbook from a chef-server to Berksfile breaks vagrant provision #51

Closed simonjohansson closed 11 years ago

simonjohansson commented 11 years ago

Versions:

Vagrant version 1.2.1
vagrant-berkshelf (1.2.0)
Berkshelf (1.4.4)
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-linux]

To make sure that there is not weird state going on, I start out removing the berkshelf directory

rm -rf ~/.berkshelf

I have a berksfile that looks like this

site :opscode
metadata
cookbook "java", "> 1.10.2"
cookbook "database", "> 1.3.12"
cookbook "mysql", "> 2.1.2"
cookbook "apt", "> 1.9.2"
cookbook "nginx", "> 0.100.2"

Doing a vagrant up/provision in the cookbook works as expected. It pulls in all the cookbooks and provisions the machine etc.

I then add a new cookbook that needs to be fetched from my chef-server into the berksfile like so,

echo 'cookbook "base", ">= 0.2.0", chef_api: :config' >> Berksfile

and run berks to pull in base, and all the cookbooks that base depend upon, which works fine. (note that I dont have a config.json in ~/.berkshelf or in the cookbook directory)

But when running a vagrant provision it yields this:

Ridley::Connection crashed!
Celluloid::FiberStackError: stack level too deep (please see https://github.com/celluloid/celluloid/wiki/Fiber-stack-errors)
    /home/simon/.vagrant.d/gems/gems/celluloid-0.14.0/lib/celluloid/tasks/task_fiber.rb:21:in `rescue in deliver'
    /home/simon/.vagrant.d/gems/gems/celluloid-0.14.0/lib/celluloid/tasks/task_fiber.rb:19:in `deliver'
    /home/simon/.vagrant.d/gems/gems/celluloid-0.14.0/lib/celluloid/tasks.rb:69:in `resume'
    /home/simon/.vagrant.d/gems/gems/celluloid-0.14.0/lib/celluloid/actor.rb:424:in `task'
    /home/simon/.vagrant.d/gems/gems/celluloid-0.14.0/lib/celluloid/actor.rb:319:in `handle_message'
    /home/simon/.vagrant.d/gems/gems/celluloid-0.14.0/lib/celluloid/actor.rb:176:in `run'
    /home/simon/.vagrant.d/gems/gems/celluloid-0.14.0/lib/celluloid/actor.rb:159:in `block in initialize'
    /home/simon/.vagrant.d/gems/gems/celluloid-0.14.0/lib/celluloid/thread_handle.rb:12:in `block in initialize'
    /home/simon/.vagrant.d/gems/gems/celluloid-0.14.0/lib/celluloid/internal_pool.rb:59:in `call'
    /home/simon/.vagrant.d/gems/gems/celluloid-0.14.0/lib/celluloid/internal_pool.rb:59:in `block in create'
Celluloid::PoolManager crashed!
Celluloid::FiberStackError: stack level too deep (please see https://github.com/celluloid/celluloid/wiki/Fiber-stack-errors)
    /home/simon/.vagrant.d/gems/gems/celluloid-0.14.0/lib/celluloid/tasks/task_fiber.rb:21:in `rescue in deliver'
    /home/simon/.vagrant.d/gems/gems/celluloid-0.14.0/lib/celluloid/tasks/task_fiber.rb:19:in `deliver'
    /home/simon/.vagrant.d/gems/gems/celluloid-0.14.0/lib/celluloid/tasks.rb:69:in `resume'
    /home/simon/.vagrant.d/gems/gems/celluloid-0.14.0/lib/celluloid/responses.rb:11:in `dispatch'
    /home/simon/.vagrant.d/gems/gems/celluloid-0.14.0/lib/celluloid/actor.rb:333:in `handle_message'
    /home/simon/.vagrant.d/gems/gems/celluloid-0.14.0/lib/celluloid/actor.rb:176:in `run'
    /home/simon/.vagrant.d/gems/gems/celluloid-0.14.0/lib/celluloid/actor.rb:159:in `block in initialize'
    /home/simon/.vagrant.d/gems/gems/celluloid-0.14.0/lib/celluloid/thread_handle.rb:12:in `block in initialize'
    /home/simon/.vagrant.d/gems/gems/celluloid-0.14.0/lib/celluloid/internal_pool.rb:59:in `call'
    /home/simon/.vagrant.d/gems/gems/celluloid-0.14.0/lib/celluloid/internal_pool.rb:59:in `block in create'
Ridley::Client::ConnectionSupervisor crashed!
Celluloid::FiberStackError: stack level too deep (please see https://github.com/celluloid/celluloid/wiki/Fiber-stack-errors)
    /home/simon/.vagrant.d/gems/gems/celluloid-0.14.0/lib/celluloid/tasks/task_fiber.rb:21:in `rescue in deliver'
    /home/simon/.vagrant.d/gems/gems/celluloid-0.14.0/lib/celluloid/tasks/task_fiber.rb:19:in `deliver'
    /home/simon/.vagrant.d/gems/gems/celluloid-0.14.0/lib/celluloid/tasks.rb:69:in `resume'
    /home/simon/.vagrant.d/gems/gems/celluloid-0.14.0/lib/celluloid/responses.rb:11:in `dispatch'
    /home/simon/.vagrant.d/gems/gems/celluloid-0.14.0/lib/celluloid/actor.rb:333:in `handle_message'
    /home/simon/.vagrant.d/gems/gems/celluloid-0.14.0/lib/celluloid/actor.rb:176:in `run'
    /home/simon/.vagrant.d/gems/gems/celluloid-0.14.0/lib/celluloid/actor.rb:159:in `block in initialize'
    /home/simon/.vagrant.d/gems/gems/celluloid-0.14.0/lib/celluloid/thread_handle.rb:12:in `block in initialize'
    /home/simon/.vagrant.d/gems/gems/celluloid-0.14.0/lib/celluloid/internal_pool.rb:59:in `call'
    /home/simon/.vagrant.d/gems/gems/celluloid-0.14.0/lib/celluloid/internal_pool.rb:59:in `block in create'
Celluloid::PoolManager#finalize crashed!
NoMethodError: undefined method `+' for nil:NilClass
    /home/simon/.vagrant.d/gems/gems/celluloid-0.14.0/lib/celluloid/pool_manager.rb:27:in `__shutdown__'
    /home/simon/.vagrant.d/gems/gems/celluloid-0.14.0/lib/celluloid/actor.rb:397:in `block in run_finalizer'
    /home/simon/.vagrant.d/gems/gems/celluloid-0.14.0/lib/celluloid/tasks.rb:42:in `block in initialize'
    /home/simon/.vagrant.d/gems/gems/celluloid-0.14.0/lib/celluloid/tasks/task_fiber.rb:9:in `block in create'
Ridley::Client crashed!
Celluloid::FiberStackError: stack level too deep (please see https://github.com/celluloid/celluloid/wiki/Fiber-stack-errors)
    /home/simon/.vagrant.d/gems/gems/celluloid-0.14.0/lib/celluloid/tasks/task_fiber.rb:21:in `rescue in deliver'
    /home/simon/.vagrant.d/gems/gems/celluloid-0.14.0/lib/celluloid/tasks/task_fiber.rb:19:in `deliver'
    /home/simon/.vagrant.d/gems/gems/celluloid-0.14.0/lib/celluloid/tasks.rb:69:in `resume'
    /home/simon/.vagrant.d/gems/gems/celluloid-0.14.0/lib/celluloid/responses.rb:11:in `dispatch'
    /home/simon/.vagrant.d/gems/gems/celluloid-0.14.0/lib/celluloid/actor.rb:333:in `handle_message'
    /home/simon/.vagrant.d/gems/gems/celluloid-0.14.0/lib/celluloid/actor.rb:176:in `run'
    /home/simon/.vagrant.d/gems/gems/celluloid-0.14.0/lib/celluloid/actor.rb:159:in `block in initialize'
    /home/simon/.vagrant.d/gems/gems/celluloid-0.14.0/lib/celluloid/thread_handle.rb:12:in `block in initialize'
    /home/simon/.vagrant.d/gems/gems/celluloid-0.14.0/lib/celluloid/internal_pool.rb:59:in `call'
    /home/simon/.vagrant.d/gems/gems/celluloid-0.14.0/lib/celluloid/internal_pool.rb:59:in `block in create'
/opt/vagrant/embedded/gems/gems/vagrant-1.2.1/lib/vagrant/action/warden.rb:53: stack level too deep (SystemStackError)

Creating a config.json in ~/.berkshelf via berks configure so it looks like this

{
  "chef": {
    "chef_server_url": "http:\/\/......:4000",
    "validation_client_name": ..",
    "validation_key_path": "...",
    "client_key": "...",
    "node_name": "..."
  },
  "cookbook": {
    "copyright": "YOUR_NAME",
    "email": "YOUR_EMAIL",
    "license": "reserved"
  },
  "vagrant": {
    "vm": {
      "box": "Berkshelf-CentOS-6.3-x86_64-minimal",
      "box_url": "https:\/\/dl.dropbox.com\/u\/31081437\/Berkshelf-CentOS-6.3-x86_64-minimal.box",
      "forward_port": {

      },
      "network": {
        "bridged": false,
        "hostonly": "33.33.33.10"
      },
      "provision": "chef_solo"
    }
  },
  "ssl": {
    "verify": true
  }
}

doesnt help either.

But by removing the last line in the Berksfile, everything works as expected again, including using the base cookbook.

simonjohansson commented 11 years ago

After doing some digging in the source ive discovered where the whole thing crashes. (Im not a ruby-dev so Im in deep water right now)

In /.vagrant.d/gems/gems/berkshelf-1.4.4/lib/berkshelf/locations/chef_api_locations.rb line 135.

@conn = Ridley.new(
        server_url: uri,
        client_name: node_name,
        client_key: client_key,
        ssl: {
          verify: options[:verify_ssl]
        }
      )

Doing some debugging priting of uri, node_name, client_key and options[:verify_ssl] before createing the connection with Ridley reveals

uri, http://supersecret-url:4000
node_name, simon
client_key, /home/simon/.chef/key.pem
ssl, true

So up to this point everything seems to work like it should, but then BAM, I get the stacktrace posted in the first message

Interestingly though.

simon@simonpad ~$ irb                                                                                      
irb(main):001:0> require 'ridley'
=> true
irb(main):002:0> Ridley.new(server_url: 'http:///supersecret-url:4000', client_name:'simon', client_key:'/home/simon/.chef/key.pem', ssl: {verify: true})
=> #<Celluloid::ActorProxy(Ridley::Client:0x1e72c2c) @options={:ssh=>{}....................................................................

I get a connection

ivey commented 11 years ago

This is likely in Ridley. @reset is going to take a look. This should be resolved in 2.0.0.

adamjk-dev commented 11 years ago

I believe I am having a similar issue.

The output from doing a bundle install, berks install, and vagrant up:

Fetching gem metadata from http://rubygems.org/........
Fetching gem metadata from http://rubygems.org/..
Resolving dependencies...
Using i18n (0.6.4) 
Using multi_json (1.7.7) 
Using activesupport (3.2.14) 
Using addressable (2.3.5) 
Using builder (3.2.2) 
Using gyoku (1.1.0) 
Using nokogiri (1.5.10) 
Using akami (1.2.0) 
Using buff-ruby_engine (0.1.0) 
Using buff-shell_out (0.1.0) 
Using timers (1.1.0) 
Using celluloid (0.14.1) 
Using hashie (2.0.5) 
Using chozo (0.6.1) 
Using multipart-post (1.2.0) 
Using faraday (0.8.8) 
Using minitar (0.5.4) 
Using rbzip2 (0.2.0) 
Using retryable (1.3.3) 
Using buff-extensions (0.5.0) 
Using nio4r (0.4.6) 
Using celluloid-io (0.14.1) 
Using erubis (2.7.0) 
Using json (1.8.0) 
Using mixlib-log (1.6.0) 
Using mixlib-authentication (1.3.0) 
Using net-http-persistent (2.9) 
Using net-ssh (2.6.8) 
Using solve (0.8.0) 
Using varia_model (0.1.1) 
Using ffi (1.9.0) 
Using gssapi (1.0.3) 
Using httpclient (2.2.0.2) 
Using little-plugger (1.1.3) 
Using logging (1.6.2) 
Using rubyntlm (0.1.1) 
Using rack (1.5.2) 
Using httpi (0.9.7) 
Using nori (1.1.5) 
Using wasabi (1.0.0) 
Using savon (0.9.5) 
Using uuidtools (2.1.4) 
Using winrm (1.1.2) 
Using ridley (1.2.4) 
Using thor (0.18.1) 
Using berkshelf (2.0.7) 
Using bundler (1.3.5) 
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
Using jenkins (0.8.0)
Using java (1.4.2)
Using runit (1.1.4)
Using build-essential (1.4.0)
Using yum (0.8.2)
Using apt (1.4.8)
Using apache2 (1.6.0)
Using nginx (1.6.0)
Using ohai (1.1.8)
Using iptables (0.12.0)
Bringing machine 'default' up with 'virtualbox' provider...
[default] Importing base box 'rhel-5.8-x86_64'...

Progress: 10%
Progress: 20%
Progress: 30%
Progress: 40%
Progress: 50%
Progress: 60%
Progress: 90%
[default] Matching MAC address for NAT networking...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
[Berkshelf] Updating Vagrant's berkshelf: '/home/jenkins-test/.berkshelf/default/vagrant/berkshelf-20130801-10106-w0ztvb-default'
[Berkshelf] Using jenkins (0.8.0)
[Berkshelf] Using java (1.4.2)
[Berkshelf] Using runit (1.1.4)
[Berkshelf] Using build-essential (1.4.0)
[Berkshelf] Using yum (0.8.2)
[Berkshelf] Using apt (1.4.8)
[Berkshelf] Using apache2 (1.6.0)
[Berkshelf] Using nginx (1.6.0)
Ridley::CookbookResource crashed!
Celluloid::FiberStackError: stack level too deep (please see https://github.com/celluloid/celluloid/wiki/Fiber-stack-errors)
    /home/jenkins-test/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/tasks/task_fiber.rb:23:in `rescue in deliver'
    /home/jenkins-test/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/tasks/task_fiber.rb:21:in `deliver'
    /home/jenkins-test/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/tasks.rb:69:in `resume'
    /home/jenkins-test/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/responses.rb:11:in `dispatch'
    /home/jenkins-test/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/actor.rb:331:in `handle_message'
    /home/jenkins-test/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/actor.rb:174:in `run'
    /home/jenkins-test/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/actor.rb:157:in `block in initialize'
    /home/jenkins-test/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/thread_handle.rb:13:in `block in initialize'
    /home/jenkins-test/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/internal_pool.rb:59:in `call'
    /home/jenkins-test/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/internal_pool.rb:59:in `block in create'
Ridley::SandboxResource crashed!
Celluloid::FiberStackError: stack level too deep (please see https://github.com/celluloid/celluloid/wiki/Fiber-stack-errors)
    /home/jenkins-test/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/tasks/task_fiber.rb:23:in `rescue in deliver'
    /home/jenkins-test/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/tasks/task_fiber.rb:21:in `deliver'
    /home/jenkins-test/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/tasks.rb:69:in `resume'
    /home/jenkins-test/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/responses.rb:11:in `dispatch'
    /home/jenkins-test/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/actor.rb:331:in `handle_message'
    /home/jenkins-test/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/actor.rb:174:in `run'
    /home/jenkins-test/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/actor.rb:157:in `block in initialize'
    /home/jenkins-test/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/thread_handle.rb:13:in `block in initialize'
    /home/jenkins-test/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/internal_pool.rb:59:in `call'
    /home/jenkins-test/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/internal_pool.rb:59:in `block in create'
[default] Destroying VM and associated drives...
/opt/vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/batch_action.rb:76: stack level too deep (SystemStackError)

Berksfile contents:

# Define the chef API we want to use to download cookbooks from 
chef_api "<chef 11 server URL>",
    node_name: "jenkins",   
    client_key: "/etc/chef/chef-11-server-new/jenkins.pem"

# Define the cookbooks we need
cookbook "jenkins"

Gemfile contents:

source 'http://rubygems.org'

gem 'berkshelf'

Berkshelf config.json contents:

{
  "ssl": {
    "verify": false
  }
}

Vagrantfile contents:

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  # Enabling the Berkshelf plugin. To enable this globally, add this configuration
  # option to your ~/.vagrant.d/Vagrantfile file
  config.berkshelf.enabled = true

  # The path to the Berksfile to use with Vagrant Berkshelf
  config.berkshelf.berksfile_path = "./Berksfile"

  # An array of symbols representing groups of cookbook described in the Vagrantfile
  # to exclusively install and copy to Vagrant's shelf.
  # config.berkshelf.only = []

  # An array of symbols representing groups of cookbook described in the Vagrantfile
  # to skip installing and copying to Vagrant's shelf.
  # config.berkshelf.except = []

  # Set the hostname, box name, and box_url
  config.vm.hostname = "jenkins-server"
  config.vm.box = "rhel-5.8-x86_64"
  config.vm.box_url = "<box URL>"

  # Set up the network (forwarded port(s) and network type)
  config.vm.network :forwarded_port, guest: 8080, host: 8080
  config.vm.network :public_network, :bridge => "em1"

  # SSH settings
  config.ssh.max_tries = 40
  config.ssh.timeout   = 120
  config.ssh.forward_agent = true

  # Set the provisioner (use chef solo, pass in node attributes for the plugins to install)
  config.vm.provision :chef_solo do |chef|
    chef.json = {
      :jenkins => {
        :server => {
          :plugins => [
            "mailer", "external-monitor-job", "ldap", "pam-auth", 
            "ant", "javadoc", "global-build-stats", "build-metrics", 
            "maven-plugin", "copyartifact", "envinject", "ssh-slaves", 
            "blame-upstream-commiters", "rundeck", "perforce", 
            "dashboard-view", "translation", "greenballs", "subversion",
            "cvs", "chucknorris", "build-blocker-plugin",
            "parameterized-trigger", "git-client", "git", 
            "postbuild-task", "project-stats-plugin", "gitorious" ]
          }
      }
    }

    # Add recipes to run
    chef.add_recipe "jenkins::server"

  end
end

Berkshelf version: 2.0,.7

vagrant-berkshelf plugin version: 1.3.3

reset commented 11 years ago

@adamjk-dev hmm, from the output it looks like the cookbooks were attempted to be uploaded somewhere during the Vagrant up. You are using the chef_solo provisioner, though, which means no upload takes place. Is this the right Vagrantfile?

Could you do me a favor and put this line within the SandboxResource class definition in lib/ridley/resources/sandbox_resource.rb:

class SandboxResource
  task_class TaskThread
  ...
end

Let me know if you see a crash after you've done that. Thanks so much for helping me track this down!

adamjk-dev commented 11 years ago

@reset Where is it trying to upload cookbooks? Yeah, that is the correct Vagrantfile. I added the line "task_class TaskThread" to the top of that Class definition in /home/jenkins-test/.vagrant.d/gems/gems/ridley-1.2.4/lib/ridley/resources/sandbox_resource.rb and I still got the same error.

Bringing machine 'default' up with 'virtualbox' provider...
[default] Importing base box 'rhel-5.8-x86_64'...
Progress: 90%
[default] Matching MAC address for NAT networking...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
[Berkshelf] Updating Vagrant's berkshelf: '/home/jenkins-test/.berkshelf/default/vagrant/berkshelf-20130801-28005-wn17v6-default'
[Berkshelf] Using jenkins (0.8.0)
[Berkshelf] Using java (1.4.2)
[Berkshelf] Using runit (1.1.4)
[Berkshelf] Using build-essential (1.4.0)
[Berkshelf] Using yum (0.8.2)
[Berkshelf] Using apt (1.4.8)
[Berkshelf] Using apache2 (1.6.0)
[Berkshelf] Using nginx (1.6.0)
Ridley::CookbookResource crashed!
Celluloid::FiberStackError: stack level too deep (please see https://github.com/celluloid/celluloid/wiki/Fiber-stack-errors)
    /home/jenkins-test/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/tasks/task_fiber.rb:23:in `rescue in deliver'
    /home/jenkins-test/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/tasks/task_fiber.rb:21:in `deliver'
    /home/jenkins-test/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/tasks.rb:69:in `resume'
    /home/jenkins-test/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/responses.rb:11:in `dispatch'
    /home/jenkins-test/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/actor.rb:331:in `handle_message'
    /home/jenkins-test/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/actor.rb:174:in `run'
    /home/jenkins-test/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/actor.rb:157:in `block in initialize'
    /home/jenkins-test/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/thread_handle.rb:13:in `block in initialize'
    /home/jenkins-test/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/internal_pool.rb:59:in `call'
    /home/jenkins-test/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/internal_pool.rb:59:in `block in create'
Ridley::SandboxResource crashed!
Celluloid::FiberStackError: stack level too deep (please see https://github.com/celluloid/celluloid/wiki/Fiber-stack-errors)
    /home/jenkins-test/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/tasks/task_fiber.rb:23:in `rescue in deliver'
    /home/jenkins-test/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/tasks/task_fiber.rb:21:in `deliver'
    /home/jenkins-test/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/tasks.rb:69:in `resume'
    /home/jenkins-test/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/responses.rb:11:in `dispatch'
    /home/jenkins-test/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/actor.rb:331:in `handle_message'
    /home/jenkins-test/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/actor.rb:174:in `run'
    /home/jenkins-test/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/actor.rb:157:in `block in initialize'
    /home/jenkins-test/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/thread_handle.rb:13:in `block in initialize'
    /home/jenkins-test/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/internal_pool.rb:59:in `call'
    /home/jenkins-test/.vagrant.d/gems/gems/celluloid-0.14.1/lib/celluloid/internal_pool.rb:59:in `block in create'
[default] Destroying VM and associated drives...
/opt/vagrant/embedded/gems/gems/vagrant-1.2.2/lib/vagrant/batch_action.rb:76: stack level too deep (SystemStackError)
reset commented 11 years ago

@adamjk-dev It looked like the SandboxResource crashed first which caused the CookbookResource to crash. The SandboxResource isn't used unless an upload is happening. I could be reading the stack trace wrong. Could you put that line at the top of the CookbookResource class and let me know the results?

adamjk-dev commented 11 years ago

@reset That seems to be working, actually. I am going to try again to make sure in a few places but it is definitely running.

Bringing machine 'default' up with 'virtualbox' provider...
[default] Importing base box 'rhel-5.8-x86_64'...
Progress: 90%
[default] Matching MAC address for NAT networking...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
[Berkshelf] Updating Vagrant's berkshelf: '/home/jenkins-test/.berkshelf/default/vagrant/berkshelf-20130801-4800-72sqjx-default'
[Berkshelf] Using jenkins (0.8.0)
[Berkshelf] Using java (1.4.2)
[Berkshelf] Using runit (1.1.4)
[Berkshelf] Using build-essential (1.4.0)
[Berkshelf] Using yum (0.8.2)
[Berkshelf] Using apt (1.4.8)
[Berkshelf] Using apache2 (1.6.0)
[Berkshelf] Using nginx (1.6.0)
[Berkshelf] Installing ohai (1.1.8) from chef_api: 'https://<chef server URL>'
[Berkshelf] Installing iptables (0.12.0) from chef_api: 'https://<chef server URL>'
[default] Fixed port collision for 22 => 2222. Now on port 4701.
[default] Fixed port collision for 22 => 4700. Now on port 4702.
[default] Fixed port collision for 8080 => 8080. Now on port 4703.
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 4701 (adapter 1)
[default] -- 22 => 4702 (adapter 1)
[default] -- 8080 => 4703 (adapter 1)
[default] Booting VM...
[default] Waiting for VM to boot. This can take a few minutes.
[default] VM booted and ready for use!
[default] Setting hostname...
[default] Configuring and enabling network interfaces...
[default] Mounting shared folders...
[default] -- /vagrant
[default] -- /tmp/vagrant-chef-1/chef-solo-1/cookbooks
[default] Running provisioner: chef_solo...
Generating chef JSON and uploading...
Running chef-solo...
[2013-08-01T17:53:37+00:00] INFO: *** Chef 10.16.2 ***
[2013-08-01T17:53:37+00:00] INFO: Setting the run_list to ["recipe[jenkins::server]"] from JSON
[2013-08-01T17:53:37+00:00] INFO: Run List is [recipe[jenkins::server]]
[2013-08-01T17:53:37+00:00] INFO: Run List expands to [jenkins::server]
[2013-08-01T17:53:37+00:00] INFO: Starting Chef Run for jenkins-server
[2013-08-01T17:53:37+00:00] INFO: Running start handlers
[2013-08-01T17:53:37+00:00] INFO: Start handlers complete.
[2013-08-01T17:53:38+00:00] INFO: Processing ruby_block[set-env-java-home] action create (java::openjdk line 36)
[2013-08-01T17:53:38+00:00] INFO: ruby_block[set-env-java-home] called
[2013-08-01T17:53:38+00:00] INFO: Processing ruby_block[update-java-alternatives] action nothing (java::openjdk line 43)
[2013-08-01T17:53:38+00:00] INFO: Processing package[java-1.6.0-openjdk] action install (java::openjdk line 79)
[2013-08-01T17:53:51+00:00] INFO: package[java-1.6.0-openjdk] installing java-1.6.0-openjdk-1.6.0.0-1.41.1.11.11.90.el5_9 from rhel-x86_64-server-5 repository
[2013-08-01T17:54:04+00:00] INFO: Processing package[java-1.6.0-openjdk-devel] action install (java::openjdk line 79)
[2013-08-01T17:54:04+00:00] INFO: package[java-1.6.0-openjdk-devel] installing java-1.6.0-openjdk-devel-1.6.0.0-1.41.1.11.11.90.el5_9 from rhel-x86_64-server-5 repository
[2013-08-01T17:54:11+00:00] INFO: package[java-1.6.0-openjdk-devel] not queuing delayed action create on ruby_block[update-java-alternatives] (delayed), as it's already been queued
reset commented 11 years ago

@adamjk-dev now that I see the entire output, it makes sense now to what was happening. The cookbook resource crashed while downloading the Ohai cookbook.

Do you have GChat or something like that? I can't actually repro this bug and it'd be awesome if I could get you to try a few things to help track the source of it down a bit better. Setting the task_class is a big hammer ;)

adamjk-dev commented 11 years ago

@reset I see. I just emailed you from a gmail account to the email you have listed on your github profile. I would be happy to try some stuff and dig a little further into this.

reset commented 11 years ago

@adamjk-dev and I tracked this down as best we could. It appears that under certain circumstances the deserialization of cookbooks when they are converted into CookbookObjects will cause the CookbookResource to crash. I have opened a ticket against Ridley master to address this problem.

reset commented 11 years ago

released in 1.2.5. Uninstall and Re-install the vagrant berkshelf plugin to get the updates!

adamjk-dev commented 11 years ago

Verified this fixed the issues I was seeing. Thanks!

dustinmm80 commented 11 years ago

I am still seeing this; it is happening now when I try to bring any vagrant box up.

vagrant up mongo 09:19:36 EDT Bringing machine 'mongo' up with 'virtualbox' provider... [mongo] Importing base box 'ubuntu12.04'... [mongo] Matching MAC address for NAT networking... [mongo] Setting the name of the VM... [mongo] Clearing any previously set forwarded ports... [Berkshelf] This version of the Berkshelf plugin has not been fully tested on this version of Vagrant. [Berkshelf] You should check for a newer version of vagrant-berkshelf. [Berkshelf] If you encounter any errors with this version, please report them at https://github.com/RiotGames/vagrant-berkshelf/issues [Berkshelf] You can also join the discussion in #berkshelf on Freenode. [Berkshelf] Updating Vagrant's berkshelf: '/Users/dcollins/.berkshelf/clean/vagrant/berkshelf-20131007-6907-a3kg8o-mongo' [Berkshelf] Using apt (1.9.2) [Berkshelf] Using build-essential (1.4.2) [Berkshelf] Using chef-server (2.0.0) [Berkshelf] Using cron (1.2.6) [Berkshelf] Using curl (1.1.0) [Berkshelf] Using fail2ban (1.2.4) [Berkshelf] Using git (2.7.0) [Berkshelf] Using gunicorn (1.1.0) [Berkshelf] Using jenkins (1.2.0) [Berkshelf] Using magic_shell (0.3.2) [Berkshelf] Installing mongodb (0.13.1) from git: 'https://github.com/edelight/chef-mongodb.git' with branch: 'master' at ref: '1624d731556aa1394b8102a11f1cdcd07dc59f37' [Berkshelf] Using newrelic (0.5.3) [Berkshelf] Using nginx (1.1.0) [Berkshelf] Installing nodejs (1.3.0) from git: 'https://github.com/mdxp/nodejs-cookbook.git' with branch: 'master' at ref: '4c685529e7a8db0222b17407367e8b309afd3137' [Berkshelf] Using ohai (1.1.8) [Berkshelf] Using opencv (0.0.4) [Berkshelf] Using package-driver (0.1.1) [Berkshelf] Using postgresql (3.0.2) [Berkshelf] Using python (1.4.0) [Berkshelf] Using ruby (0.9.2) [Berkshelf] Installing rvm (0.9.0) from git: 'https://github.com/fnichol/chef-rvm.git' with branch: 'master' at ref: '4a408e5d6c5a52c37388a799c516430263339849' [Berkshelf] Installing s3cmd (0.2.0) from git: 'https://github.com/hectcastro/chef-s3cmd.git' with branch: 'master' at ref: '8ce21f35259ad9073177d746f56984b1e7a99180' [Berkshelf] Using ssh-keys (1.0.0) [Berkshelf] Using sudo (2.2.0) [Berkshelf] Using supervisor (0.4.8) [Berkshelf] Using users (1.5.2) [Berkshelf] Using yum (2.3.2) [Berkshelf] Using dmg (2.0.4) [Berkshelf] Using windows (1.11.0) [Berkshelf] Using chef_handler (1.1.4) [Berkshelf] Using runit (1.3.0) [Berkshelf] Using java (1.14.0) [Berkshelf] Using aws (0.101.6) [Berkshelf] Using apache2 (1.8.4) [Berkshelf] Using iptables (0.12.0) [Berkshelf] Using php (1.2.6) [Berkshelf] Using xml (1.2.0) [Berkshelf] Using mysql (3.0.12) [Berkshelf] Using openssl (1.1.0) [Berkshelf] Using ms_dotnet4 (1.0.1) [Berkshelf] Using bluepill (2.3.0) [Berkshelf] Using rsyslog (1.9.0) [Berkshelf] Using chocolatey (0.0.5) [Berkshelf] Using powershell (1.1.2) [mongo] Destroying VM and associated drives... [mongo] Running cleanup tasks for 'chef_solo' provisioner... /Applications/Vagrant/embedded/gems/gems/vagrant-1.3.4/lib/vagrant/batch_action.rb:76: stack level too deep (SystemStackError)

maraca commented 11 years ago

Same here.

vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
[default] Importing base box 'pangolin64-vagrant'...
[default] Matching MAC address for NAT networking...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
[Berkshelf] This version of the Berkshelf plugin has not been fully tested on this version of Vagrant.
[Berkshelf] You should check for a newer version of vagrant-berkshelf.
[Berkshelf] If you encounter any errors with this version, please report them at https://github.com/RiotGames/vagrant-berkshelf/issues
[Berkshelf] You can also join the discussion in #berkshelf on Freenode.
[Berkshelf] Updating Vagrant's berkshelf: '/home/martin/.berkshelf/default/vagrant/berkshelf-20131014-23483-e4acw4-default'
[Berkshelf] Using aws (0.101.6)
[Berkshelf] Using java (1.14.0)
[Berkshelf] Installing elasticsearch (0.3.3) from github: 'elasticsearch/cookbook-elasticsearch' with branch: '0.3.3' over protocol: 'ssh'
[Berkshelf] Installing redisio (1.7.0) from github: 'brianbianco/redisio' with branch: '1.7.0' over protocol: 'ssh'
[Berkshelf] Installing swap (0.3.5) from github: 'sethvargo-cookbooks/swap' with branch: 'v0.3.5' over protocol: 'ssh'
[Berkshelf] Using watcher (0.1.3) at '../watcher-cookbook'
[Berkshelf] Using minitest-handler (1.0.0)
[Berkshelf] Using datastore (0.1.22) from metadata
[Berkshelf] Using windows (1.11.0)
[Berkshelf] Using chef_handler (1.1.4)
[Berkshelf] Using build-essential (1.4.2)
[Berkshelf] Using xml (1.2.0)
[Berkshelf] Using monit (0.7.1)
[Berkshelf] Using ark (0.4.0)
[Berkshelf] Using ulimit (0.3.1)
[Berkshelf] Using sensu (0.6.0)
[Berkshelf] Using apt (2.2.1)
[Berkshelf] Using yum (2.3.4)
[Berkshelf] Using rabbitmq (2.3.2)
[Berkshelf] Using erlang (1.3.2)
[default] Destroying VM and associated drives...
/opt/vagrant/embedded/gems/gems/vagrant-1.3.0/lib/vagrant/batch_action.rb:76: stack level too deep (SystemStackError)
tmatilai commented 11 years ago

It would help if you can gist the debug output of

VAGRANT_LOG=debug vagrant up
maraca commented 11 years ago

I deleted the repo cloned again and the problem "went away" so I can't reproduce right now - I will make sure to post a debug log of vagrant next time I see it.

dustinmm80 commented 11 years ago

I figured out why I was having this problem. I had a Berksfile for a cookbook that lists metadata as a requirement and used berks install --path vendor/cookbooks when I was working on that cookbook (to see the 3rd-party cookbooks). If you then list that cookbook in another cookbook's Berksfile as a dependency berks will go all the way through the dependency tree and get into an infinite loop when it's trying to resolve them.

To fix the issue I deleted all vendor/cookbooks paths in my projects. I notice this happens as well in ~/.berks, but maybe it's just my dev setup.

maraca commented 11 years ago

There we go https://gist.github.com/maraca/6995758 @dustinmm80 thanks for the heads up. I'll take a look to see if that's what's going on.

iroller commented 10 years ago

Getting stack level to deep on kitchen verify with all the newest versions of chef-dk(berks 3.0.1) and all the related software.

D      ------Exception-------
D      Class: Kitchen::ActionFailed
D      Message: Failed to complete #converge action: [stack level too deep]
D      ---Nested Exception---
D      Class: SystemStackError
D      Message: stack level too deep
D      ------Backtrace-------
D      /Users/user/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/semverse-1.1.0/lib/semverse/constraint.rb:82
D      ----------------------

Also tried berks v.3.1.1 and got all the same issue:

% berks install
....
[EXTRA LOG] constraint = ">= 0.0.0"
[EXTRA LOG] constraint = ">= 0.0.0"
/Users/user/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/semverse-1.1.0/lib/semverse/version.rb:78: stack level too deep (SystemStackError)
% berks install | sort | uniq -c
/Users/user/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/semverse-1.1.0/lib/semverse/version.rb:78: stack level too deep (SystemStackError)
   1 Resolving cookbook dependencies...
   1 [EXTRA] constraint = "= 2.5.3"
2950 [EXTRA] constraint = ">= 0.0.0"

debug (looks like it gets into a loop on "apt cookbook"):

...
D, [2014-04-22T13:08:47.663429 #31826] DEBUG -- :         Checking transitive dependencies for chef-client (0.2.18)
D, [2014-04-22T13:08:47.663445 #31826] DEBUG -- :           Checking bluepill (>= 0.0.0)
D, [2014-04-22T13:08:47.663479 #31826] DEBUG -- :           Checking transitive dependencies for bluepill (0.7.22)
D, [2014-04-22T13:08:47.663495 #31826] DEBUG -- :           Checking cron (>= 0.0.0)
D, [2014-04-22T13:08:47.663529 #31826] DEBUG -- :           Checking transitive dependencies for cron (0.4.6)
D, [2014-04-22T13:08:47.663546 #31826] DEBUG -- :             Checking base (>= 0.0.0)
D, [2014-04-22T13:08:47.663583 #31826] DEBUG -- :             Checking transitive dependencies for base (0.1.13)
D, [2014-04-22T13:08:47.663600 #31826] DEBUG -- :               Checking apt (>= 0.0.0)
D, [2014-04-22T13:08:47.663634 #31826] DEBUG -- :               Checking transitive dependencies for apt (0.5.6)
D, [2014-04-22T13:08:47.663679 #31826] DEBUG -- :                 Checking apt (>= 0.0.0)
D, [2014-04-22T13:08:47.663715 #31826] DEBUG -- :                 Checking transitive dependencies for apt (0.5.6)
D, [2014-04-22T13:08:47.663731 #31826] DEBUG -- :                   Checking apt (>= 0.0.0)
D, [2014-04-22T13:08:47.663765 #31826] DEBUG -- :                   Checking transitive dependencies for apt (0.5.6)
D, [2014-04-22T13:08:47.663781 #31826] DEBUG -- :                     Checking apt (>= 0.0.0)
D, [2014-04-22T13:08:47.663818 #31826] DEBUG -- :                     Checking transitive dependencies for apt (0.5.6)
D, [2014-04-22T13:08:47.663834 #31826] DEBUG -- :                       Checking apt (>= 0.0.0)
D, [2014-04-22T13:08:47.663868 #31826] DEBUG -- :                       Checking transitive dependencies for apt (0.5.6)
D, [2014-04-22T13:08:47.663884 #31826] DEBUG -- :                         Checking apt (>= 0.0.0)
D, [2014-04-22T13:08:47.663941 #31826] DEBUG -- :                         Checking transitive dependencies for apt (0.5.6)
D, [2014-04-22T13:08:47.663958 #31826] DEBUG -- :                           Checking apt (>= 0.0.0)
D, [2014-04-22T13:08:47.663993 #31826] DEBUG -- :                           Checking transitive dependencies for apt (0.5.6)
D, [2014-04-22T13:08:47.664009 #31826] DEBUG -- :                             Checking apt (>= 0.0.0)
D, [2014-04-22T13:08:47.664047 #31826] DEBUG -- :                             Checking transitive dependencies for apt (0.5.6)
D, [2014-04-22T13:08:47.664064 #31826] DEBUG -- :                               Checking apt (>= 0.0.0)
D, [2014-04-22T13:08:47.664098 #31826] DEBUG -- :                               Checking transitive dependencies for apt (0.5.6)
D, [2014-04-22T13:08:47.664115 #31826] DEBUG -- :                                 Checking apt (>= 0.0.0)
D, [2014-04-22T13:08:47.664149 #31826] DEBUG -- :                                 Checking transitive dependencies for apt (0.5.6)
...
/Users/user/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/ridley-3.1.0/lib/ridley/logger.rb:47: stack level too deep (SystemStackError)

All the same configuration worked with berks 3.0.x.pre version.

iroller commented 10 years ago

^Figured it out. There was "depends 'apt'" in my apt cookbook. Thanks debug log.