Rspec process hangs at different places, process cannot be killed. How to diagnose?
Asked Answered
N

1

6

In a rails application I'm developing (on OS-X), I'm finding running the test suite via rspec locking up increasingly frequently. It does not happen every time. I've tried adding --format documentation when running the suite to see if it happens at the same place every time, and it does not.

I've tried killing the process with kill -9. It then changes the name to (ruby) with a process status of ?E. This link suggests that the process is blocked waiting for a system call to finish. I have to restart my machine every time this happens in order to kill this process.

I've tried re-installing rvm, ruby, mysql, and imagemagick. This project is using imagemagick (via the mini_magick) gem, and I suspected that it may be one of these commands that is causing rspec to block. I tried adding puts statements around each of the mini_magick commands to ensure they finish executing, and all looks fine.

I'm looking for suggestions on how to diagnose this issue.

Normanormal answered 14/3, 2013 at 21:34 Comment(5)
Use the -e switch to only run certain specs based on the pattern you give it. Run rspec -h for more info.Amaras
The problem doesn't seem to happen when running individual specs or a small subset of specs (single file), but rather when running the entire test suite. I'm looking for a way to debug what the process is blocked on?Normanormal
I think you'll need to post at least some of your specs, at least then it's possible to get an idea of what they're trying to do. Also, check that your specs aren't running in a random order. If you used RSpec to generate the spec_helper file then it adds random ordering as a default.Amaras
Can you explain why random ordering would have an effect on this?Normanormal
You said it didn't happen in the same place. Maybe it does, but the specs aren't being run in the order you expect. The "--format documentation" output is not a guarantee of the order.Amaras
I
0

It's possible your problem is an order-dependency bug, you can pass the seed along and the order will remain consistent. RSpec prints out the random number it used to seed the randomizer. Use this number to run rspec with the same order --order rand:3455

Izolaiztaccihuatl answered 17/7, 2015 at 13:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.