Skip to content

Ruby script crashes on Windows when using hist_find #331

Closed
@niklasweber

Description

@niklasweber

Hi, I am having an issue with ruby-vips on windows. When I run some_image.hist_find it seems like ruby crashes. I condensed my problem down to the following script which reliably crashes each time for me:

require 'vips'

img = Vips::Image.new_from_file('test.jpg', access: :sequential)
puts('Loaded image')
img.hist_find
puts('Ran hist_find')

start_time = Time.now
while true
    puts "Elapsed: #{ Time.now - start_time} seconds"
end

The output is:

Loaded image
Ran hist_find
Elapsed: 0.0 seconds
[omitted]
Elapsed: 0.5107214 seconds
Elapsed: 0.5107635 seconds
Elapsed: 0.5108055 seconds
Elapsed: 0.5108474 seconds
[crash]

The expected behavior would be that the for loop runs forever, but after around 0.5 seconds it just stops without any other output and $? returns false. I initially used a tiff image but the problem persists also if I use jpeg or other image formats. Also very small and very large images do not make a difference. Removing access: :sequential from new_from_file in order to use the default VIPS_ACCESS_RANDOM method also still makes it crash. The problem only occurs if I run hist_find. When leaving out img.hist_find it runs fine.

This problem only occurs on Windows. On Linux it runs fine.

My setup:
Windows 10
ruby-vips 2.1.4
ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x64-mingw32]

To install ruby-vips I put

gem 'ruby-vips', '~> 2.0', '>= 2.0.7', :require => false

in my Gemfile and ran

bundler install

Can someone reproduce this? What could be the problem here?
Thank you very much!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions