Issue #14714 has been updated by renchap (Renaud Chaput).

File ruby-bug-14714_2018-04-30-150948.crash added

I think I am seeing a similar bug.

My test suite (Rails system tests, using Minitest and Capybara) is crashing on MacOS when using Ruby 2.5.1.
It is not happening with MRI 2.4.4, or on Linux (containers on Circle CI) using 2.5.1.

I first suspected a bug with `ruby-vips` but as I can not reproduce it with 2.4.4, I think this is a bug in MRI (`ruby-vips` issue for reference: https://github.com/jcupitt/ruby-vips/issues/174).

`ruby-vips` is used to resize images using `libvips` (via ffi). When I switch to another way of resizing (using MiniMagick  which shells out to ImageMagick), the segfault does not occur. I think it happens because when using `ruby-vips` the resize is handled inside the MRI process and more memory is used.

The crash does not always happen, about 30% of the time the test suite finished. It sometimes crashes while resizing an image, but it sometimes also crashes later, in a test without any `ruby-vips` calls. The stack trace is always the same, and related to GC.

I tried to reproduce the problem by isolating my image resizing code and calling it a few thousand times on the same images as my test, without success. Running my app full test suite on 2.5.1 on a mac is the only way to reproduce it.
I tried to enable `GC.stress = true` at the start of the test suite but as the test suite uses a full-featured Rails app, launches a headless browser, ..., it is far too slow and I can not even get Rails to start.

----------------------------------------
Bug #14714: Ruby 2.5.1 Segmentation Fault
https://bugs.ruby-lang.org/issues/14714#change-71734

* Author: obromios (Chris Drane)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
I am using Ruby 2.5.1, and running ruby on rails 5.1.4 with rspec-rails 3.7.2 and capybara 3.0.2.

When I run my feature tests, i.e. rspec spec/features, I get a segmentation fault.  When I found the test in which  the fault is occurring, and run that test by itself, then the fault does not appear. If I make the offending test pending,and run rspec spec/features again, then the fault still occurs but in another test.  Accordingly, I cannot give you the exact code that is causing the fault.

I have attached the crash report log file.


---Files--------------------------------
ruby_2018-04-26-200005_MiniMe.crash (59.4 KB)
ruby-bug-14714_2018-04-30-150948.crash (115 KB)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>