Ruby Issue Tracking System: Issueshttps://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112011-11-23T03:32:11ZRuby Issue Tracking System
Redmine Backport193 - Backport #5661 (Closed): Segfault in Random.rand with Spork gemhttps://redmine.ruby-lang.org/issues/56612011-11-23T03:32:11ZOdaeus (Andrew France)andrew@avito.co.uk
<p>When running my Rails 3.1 RSpec suite with the Spork gem I get a Segmentation Fault caused by the Random.rand method.</p>
<p>The full debug output is attached. Sorry I have not been able to isolate the code to a minimum test case. Suggestions on reproducing with less code would be welcome.</p>
<p>The offending code is in a Factory Girl factory definition:</p>
<p>trait :with_messages do<br>
after_create do |mt|<br>
user = FactoryGirl.create(:user) # To prevent creating 1 user per message<br>
FactoryGirl.create_list(:message, 1 + Random.rand(4), thread: mt, created_by: user)<br>
end<br>
end</p>
<p>Spork is loaded with: bundle exec spork rspec<br>
The fault occurs when the test run is executed with: bundle exec rspec spec<br>
It works fine when not running in the Spork process.</p>