Skip to content
This repository has been archived by the owner on Jul 14, 2021. It is now read-only.

Chefspec tests trigger segfault on chef dk 0.4.0 on Windows #332

Closed
bmartino opened this issue Mar 5, 2015 · 9 comments
Closed

Chefspec tests trigger segfault on chef dk 0.4.0 on Windows #332

bmartino opened this issue Mar 5, 2015 · 9 comments

Comments

@bmartino
Copy link

bmartino commented Mar 5, 2015

I believe this issue is the same as: #171

I have forked the powershell cookbook as my own copy here:
https://github.com/bmartino/powershell

I made no changes to it whatsoever. I tried the chefspec tests (ran 'rspec' cmdline) on an older chefdk (0.3.5) and got this error:

E, [2015-03-05T15:59:04.043743 #6084] ERROR -- : Couldn't cleanly terminate all actors in 10 seconds!
C:/opscode/chefdk/embedded/lib/ruby/2.0.0/thread.rb:72:in `sleep': No live threads left. Deadlock? (fatal)

So I ran it again exactly the same (no changes) on a new VM that I configured the latest chefdk on (0.4.0) and got a different error:

C:\code\Chef\ChefDevServer\brendon2\cookbooks\powershell>rspec
[2015-03-05T16:11:32-08:00] WARN: The on_platforms option to node_map has been d
eprecated
..........F.....[DEPRECATION] `ChefSpec::Runner' is deprecated. Please use `Chef
Spec::SoloRunner' or `ChefSpec::ServerRunner' instead. (called from spec/recipes
/dsc_spec.rb:5:in `block (2 levels) in <top (required)>')
.
.
.
[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

I will post the full output of the latter error on a separate post as it is very long.

Of course, I tried some of my own spec tests, a very simple one that just checked to make sure a recipe is included (nothing fancy) and got the same error first. That was when I tried to use the powershell spec tests straight out of the box and realized that nothing worked.

@bmartino
Copy link
Author

bmartino commented Mar 5, 2015

@bmartino
Copy link
Author

bmartino commented Mar 5, 2015

Specs for the VM with chef dk 0.4.0:

64-bit Win 2008r2 w/ SP1
6 GB RAM

@bmartino
Copy link
Author

bmartino commented Mar 6, 2015

I should also mention that this error as seen in the full output...

[BUG] Segmentation fault 

...was produced in a variety of ways with a very simple test cookbook I wrote that does nothing, and has a very simple spec test that just checks for a recipe's existence. Basically, I got a Seg fault one way, a seg fault a different way, a successful pass (which I have since been unable to repro) and more failures with different points of failure, but the same error message. It seems very sporadic.

@danielsdeleo
Copy link
Contributor

Without the test's failure messages, I cannot determine whether it's the cookbook's fault for having bad code or tests, or an actual ChefDK issue. The large number of deprecation warnings might indicate that it's somewhat out of date. I'll ask around if anyone is seeing segfaults like this and if they have any workarounds. Usually the only way to fix is to upgrade ruby, but on Windows we get a build from an upstream packager, so we might be limited there.

@danielsdeleo
Copy link
Contributor

@chef/client-windows had any other reports of segfaults like this?

@danielsdeleo danielsdeleo changed the title Chefspec tests fail out of the box for chef dk 0.4.0 Chefspec tests trigger segafault on chef dk 0.4.0 on Windows Mar 25, 2015
@danielsdeleo danielsdeleo changed the title Chefspec tests trigger segafault on chef dk 0.4.0 on Windows Chefspec tests trigger segfault on chef dk 0.4.0 on Windows Mar 25, 2015
@bmartino
Copy link
Author

Thanks @danielsdeleo. The code I ran was very simple. It is a simple spec test that just checks for a recipe's existence. I verified it to work on an older version of ChefDk (0.2.0, I believe) some months ago. I was also able to get this one (0.4.0) to pass a successful run once, but as I said, have been unable to reproduce that outcome (although I stop trying after a while).

I would think that my assertion of this ChefDk failing is is quite easily reproduced yourself by trying the actions that I have described. You should be able to see exactly what I am seeing for an error. If you have any further questions, please ask. Thanks.

@danielsdeleo
Copy link
Contributor

@bmartino right, there's two things going on here. At the Chef/ChefSpec level, there's a failing test:

..........F.....

If that fails only periodically, there are many different things that could be wrong. But I can't really tell what's going on, because of the second, more serious issue, which is that Ruby is crashing with a segfault. It makes sense to me that the segfault issue would appear somewhat random because usually the GC is involved in some way in creating the conditions where the segfault occurs, and GC occurs at different times based on a bunch of different factors.

Anyway, someone who knows a bit more of the windows APIs might be able to make some sense of what's going on here:

-- C level backtrace information -------------------------------------------
C:\Windows\SysWOW64\ntdll.dll(ZwWaitForSingleObject+0x15) [0x7717F8D1]
C:\Windows\syswow64\kernel32.dll(WaitForSingleObjectEx+0x43) [0x76381194]
C:\Windows\syswow64\kernel32.dll(WaitForSingleObject+0x12) [0x76381148]
C:\opscode\chefdk\embedded\bin\msvcrt-ruby200.dll(rb_vm_bugreport+0xa7) [0x668F7
FA7]
C:\opscode\chefdk\embedded\bin\msvcrt-ruby200.dll(rb_name_err_mesg_new+0x69d) [0
x667BE36D]
C:\opscode\chefdk\embedded\bin\msvcrt-ruby200.dll(rb_bug+0x2e) [0x667BF16E]
C:\opscode\chefdk\embedded\bin\msvcrt-ruby200.dll(rb_check_safe_str+0x180) [0x66
87E3B0]
 [0x00401866]
C:\Windows\SysWOW64\ntdll.dll(RtlKnownExceptionFilter+0xb7) [0x771D74FF]

@danielsdeleo
Copy link
Contributor

We upgraded Ruby on the windows build of ChefDK, so I'm going to close this. Let me know if this is still an issue on 0.6 and I'll reopen.

@bmartino
Copy link
Author

Tried it with 0.6 and not getting this issue anymore. It appears to be resolved. Thanks

@chef-boneyard chef-boneyard locked and limited conversation to collaborators Feb 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

3 participants