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
Test Kitchen 1.2.0 breaks Berkshelf 2.0 on (OS X) #357
Comments
Just for completeness, do you have a Berksfile or metadata.rb available to see what kind of cookbooks are coming in? Thanks! |
@fnichol ah, good point. I was using cookbooks from private Chef server, but I can reproduce the problem also with totally empty Berksfile. |
Even better, simple case :) |
Confirmed, this appears to be an issue with MRI Ruby (possibly only on Mac) when trying to load dynamic libraries (native code) in a thread that is not the main thread. This article was the tip-off. I'm looking at a way for Berkshelf/Librarian-Chef libs to be loaded at provisioner object creation time rather than late loading when in a thread. the downside is that |
The need for this change was initated with #293 which runs every instance action in a thread of execution, even in serial mode. The issue is that on the Mac platform MRI Ruby 1.9 and 2.0 (not confirmed for 2.1), dynamic (i.e. native) code needs to be loaded in the main thread otherwise causing a "Trace/BPT trap: 5" crash. References: * http://stackoverflow.com/questions/9933969/matlab-ruby-gem-doesnt-work-when-called-from-thread#answer-12319780 * https://bugs.launchpad.net/sbcl/+bug/1014409 For Berkshelf 2.0.x at least, there are multiple transitive dependencies that *could* load native code, meaning that `require 'berkshelf'` could very well lead to a VM crash if performed in a thread other than main. This commit pushes library loading code ahead to Provisioner creation time. In other words, by the time you have a Provisioner object reference either Berkshelf, Librarian-Chef, or nothing has been required (assuming a Chef provisioner). A drawback to this approach is that these dynamic dependencies will be eagerly loaded when Test Kitchen is booting for trivial CLI commands such as `kitchen list` and `kitchen diagnose`. Further work is needed to ensure that `kitchen diagnose` remains viable even in the face of a failure to load these dependencies. Finally, the loaded version of Berkshelf or Librarian-Chef will be displayed to the user on INFO for converge action and DEBUG on code loading for troubleshooting. Closes #357 /cc @reset, @ivey, @sethvargo
In resolving #357 some code loading logic needed to be moved early in an object's life meaning that an Instance (or a collaborator object) could crash before `#diagnose` was callable. A design goal for `kitchen diagnose` is that it not crash itself and to provide some minimum useful information in a failure scenario. This commit will return an error hash in the :instances and :loader keys if an exception was raised.
The latest release seems to cause problems with Berkshelf 2.0. Berkshelf from master works. Git bisecting blames this concurrency commit in PR #293.
OS X 10.8.5
Ruby MRI 2.0.0-p353
berkshelf 2.0.14
test-kitchen 1.2.0
kitchen-vagrant 0.14.0
Vagrant 1.4.3
The same issue has been seen with 1.9.3 too.
The text was updated successfully, but these errors were encountered: