Bug #20264
closed
Segfault in Enumerator#next while installing RMagick on M1 Mac
Added by andy@andyjeffries.co.uk (Andy Jeffries) 6 months ago.
Updated 6 months ago.
Description
I raised a bug at RMagick, they said to go to pkg-config. I raised a bug there, and they said to raise it here. Hopefully this is the right place...
https://github.com/ruby-gnome/pkg-config/issues/24
Simplest reproduction steps (although a full backtrace of a Rails app trying to do it is at the link above):
$ docker run -it --platform=linux/arm64 registry.docker.com/library/ruby:3.3-slim bash
root@163711a82570:/# apt-get update
root@163711a82570:/# apt-get install --no-install-recommends -y build-essential pkg-config libmagickwand-dev
root@163711a82570:/# gem install rmagick
The interesting parts from the upstream ticket:
Segmentation fault at 0x0067ffffb37006c0
ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [aarch64-linux]
-- Control frame information -----------------------------------------------
c:0012 p:---- s:0068 E:002060 CFUNC :next
c:0011 p:0005 s:0064 e:000063 BLOCK
/usr/local/bundle/ruby/3.3.0/gems/pkg-config-1.5.6/lib/pkg-config.rb:439
c:0010 p:0018 s:0060 e:000059 METHOD <internal:kernel>:187
c:0009 p:0014 s:0055 e:000054 METHOD
/usr/local/bundle/ruby/3.3.0/gems/pkg-config-1.5.6/lib/pkg-config.rb:438
c:0008 p:0035 s:0048 e:000047 METHOD
/usr/local/bundle/ruby/3.3.0/gems/pkg-config-1.5.6/lib/pkg-config.rb:403
c:0007 p:0003 s:0039 e:000038 METHOD
/usr/local/bundle/ruby/3.3.0/gems/pkg-config-1.5.6/lib/pkg-config.rb:297
c:0006 p:0007 s:0033 e:000032 METHOD
/usr/local/bundle/ruby/3.3.0/gems/pkg-config-1.5.6/lib/pkg-config.rb:603
c:0005 p:0108 s:0028 e:000025 METHOD extconf.rb:111
c:0004 p:0018 s:0016 e:000015 METHOD extconf.rb:53 [FINISH]
c:0003 p:---- s:0012 e:000011 CFUNC :new
c:0002 p:0067 s:0008 E:000f60 EVAL extconf.rb:449 [FINISH]
c:0001 p:0000 s:0003 E:000520 DUMMY [FINISH]
Unfortunately, no C-level backtrace included.
So it's crashing in Enumerator#next
on this line https://github.com/ruby-gnome/pkg-config/blob/eff47c9f57f8411b5e3c535cae0d8e4c9a368c27/lib/pkg-config.rb#L439
def normalize_cflags(cflags)
normalized_cflags = []
enumerator = cflags.to_enum
begin
loop do
cflag = enumerator.next # CRASH!
normalized_cflags << cflag
case cflag
when "-I"
normalized_cflags << enumerator.next
end
end
rescue StopIteration
end
normalized_cflags
end
I haven't tried to repro yet.
- Subject changed from Segfault installing RMagick on M1 Mac to Segfault in Enumerator#next while installing RMagick on M1 Mac
- Related to Bug #20085: Fiber.new{ }.resume causes Segmentation fault for Ruby 3.3.0 on aarch64-linux added
I could install rmagick
with linux/amd64
.
$ docker run -it --platform=linux/amd64 registry.docker.com/library/ruby:3.3-slim bash
This may be fixed with #20085 with @sorah (Sorah Fukumori) 's suggestion.
hsbt (Hiroshi SHIBATA) wrote in #note-6:
I could install rmagick
with linux/amd64
.
$ docker run -it --platform=linux/amd64 registry.docker.com/library/ruby:3.3-slim bash
This may be fixed with #20085 with @sorah (Sorah Fukumori) 's suggestion.
This is definitely an arm64 issue, our production containers use amd64 and I agree it works fine on that platform.
- Related to deleted (Bug #20085: Fiber.new{ }.resume causes Segmentation fault for Ruby 3.3.0 on aarch64-linux)
- Is duplicate of Bug #20085: Fiber.new{ }.resume causes Segmentation fault for Ruby 3.3.0 on aarch64-linux added
- Status changed from Open to Feedback
there's no workaround right now (AFAIK affected platform is Linux VM on Apple Silicon), need to wait 3.3.1 to be shipped (any estimates?)
Also available in: Atom
PDF
Like0
Like0Like0Like0Like1Like0Like0Like0Like0Like0Like0