Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Builds err with segfault in csv.rb, called by read_data_file #9537

Open
dmalan opened this issue Jan 31, 2024 · 4 comments
Open

[Bug]: Builds err with segfault in csv.rb, called by read_data_file #9537

dmalan opened this issue Jan 31, 2024 · 4 comments

Comments

@dmalan
Copy link
Contributor

dmalan commented Jan 31, 2024

Operating System

Ubuntu 22.04

Ruby Version

ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [aarch64-linux]

Jekyll Version

jekyll 4.3.3

GitHub Pages Version

No response

Expected Behavior

Build should succeed without segfault.

Current Behavior

This might actually be an underlying issue in Ruby 3.3.0, but each time we try to build a site with Ruby 3.3.0 and Jekyll 4.3.3 that includes a CSV file within _data, the build fails with a segfault in /usr/local/lib/ruby/3.3.0/csv.rb:2558, which is invoked (a few frames earlier) by /usr/local/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/readers/data_reader.rb:62:in read_data_file'`.

Removing _data/ or all CSV files within eliminates the error. Downgrading to Ruby 3.2.3 also avoids it altogether.

The warnings atop the output aren't worrisome in and of themselves, per #9534, but worth noting the first pertains to csv too.

Minimal demo at https://github.com/dmalan/jekyll-demo.git.

CC @rongxin-liu

Relevant log output

$ bundle exec jekyll build
/usr/local/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll.rb:28: warning: csv was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add csv to your Gemfile or gemspec. Also contact author of jekyll-4.3.3 to add csv into its gemspec.
/usr/local/lib/ruby/gems/3.3.0/gems/safe_yaml-1.0.5/lib/safe_yaml/transform.rb:1: warning: base64 was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add base64 to your Gemfile or gemspec. Also contact author of safe_yaml-1.0.5 to add base64 into its gemspec.
/usr/local/lib/ruby/gems/3.3.0/gems/liquid-4.0.4/lib/liquid/standardfilters.rb:2: warning: bigdecimal was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add bigdecimal to your Gemfile or gemspec. Also contact author of liquid-4.0.4 to add bigdecimal into its gemspec.
Configuration file: none
 Theme Config file: /home/ubuntu/.gem/bundler/gems/jekyll-theme-cs50-729caa0c3877/_config.yml
/usr/local/lib/ruby/gems/3.3.0/gems/httpclient-2.8.3/lib/httpclient/auth.rb:11: warning: mutex_m was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add mutex_m to your Gemfile or gemspec. Also contact author of httpclient-2.8.3 to add mutex_m into its gemspec.
            Source: /mnt/tmp
       Destination: /mnt/tmp/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
 Theme Config file: /home/ubuntu/.gem/bundler/gems/jekyll-theme-cs50-729caa0c3877/_config.yml
/usr/local/lib/ruby/3.3.0/csv.rb:2558: [BUG] Segmentation fault at 0x004caaaab23296e4
ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [aarch64-linux]

-- Control frame information -----------------------------------------------
c:0047 p:---- s:0269 E:0026f0 CFUNC  :next
c:0046 p:0021 s:0265 e:000264 METHOD /usr/local/lib/ruby/3.3.0/csv.rb:2558 [FINISH]
c:0045 p:---- s:0260 e:000259 CFUNC  :to_a
c:0044 p:0003 s:0256 e:000255 METHOD /usr/local/lib/ruby/3.3.0/csv.rb:2596
c:0043 p:0004 s:0251 e:000250 BLOCK  /usr/local/lib/ruby/3.3.0/csv.rb:1830
c:0042 p:0102 s:0247 e:000246 METHOD /usr/local/lib/ruby/3.3.0/csv.rb:1611
c:0041 p:0008 s:0236 e:000235 METHOD /usr/local/lib/ruby/3.3.0/csv.rb:1830
c:0040 p:0064 s:0230 e:000229 METHOD /usr/local/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/readers/data_reader.rb:62
c:0039 p:0075 s:0225 e:000221 BLOCK  /usr/local/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/readers/data_reader.rb:49 [FINISH]
c:0038 p:---- s:0216 e:000215 CFUNC  :each
c:0037 p:0035 s:0212 e:000211 METHOD /usr/local/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/readers/data_reader.rb:41
c:0036 p:0017 s:0205 e:000204 METHOD /usr/local/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/readers/data_reader.rb:23
c:0035 p:0021 s:0199 e:000197 METHOD /usr/local/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/reader.rb:31
c:0034 p:0050 s:0193 e:000192 METHOD /usr/local/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/reader.rb:21
c:0033 p:0005 s:0189 e:000188 METHOD /usr/local/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/site.rb:181
c:0032 p:0022 s:0185 e:000184 METHOD /usr/local/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/site.rb:78
c:0031 p:0004 s:0181 e:000180 METHOD /usr/local/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/command.rb:28
c:0030 p:0093 s:0175 e:000174 METHOD /usr/local/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/commands/build.rb:65
c:0029 p:0054 s:0165 e:000164 METHOD /usr/local/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/commands/build.rb:36
c:0028 p:0015 s:0159 e:000158 BLOCK  /usr/local/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/command.rb:91 [FINISH]
c:0027 p:---- s:0155 e:000154 CFUNC  :each
c:0026 p:0005 s:0151 e:000150 METHOD /usr/local/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/command.rb:91
c:0025 p:0017 s:0141 e:000140 BLOCK  /usr/local/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/commands/build.rb:18
c:0024 p:0008 s:0136 e:000135 BLOCK  /usr/local/lib/ruby/gems/3.3.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221 [FINISH]
c:0023 p:---- s:0132 e:000131 CFUNC  :each
c:0022 p:0036 s:0128 e:000127 METHOD /usr/local/lib/ruby/gems/3.3.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221
c:0021 p:0066 s:0122 e:000121 METHOD /usr/local/lib/ruby/gems/3.3.0/gems/mercenary-0.4.0/lib/mercenary/program.rb:44
c:0020 p:0019 s:0115 e:000114 METHOD /usr/local/lib/ruby/gems/3.3.0/gems/mercenary-0.4.0/lib/mercenary.rb:21
c:0019 p:0052 s:0109 E:002430 TOP    /usr/local/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/exe/jekyll:15 [FINISH]
c:0018 p:---- s:0106 e:000105 CFUNC  :load
c:0017 p:0078 s:0101 e:000100 TOP    /usr/local/bin/jekyll:25 [FINISH]
c:0016 p:---- s:0096 e:000095 CFUNC  :load
c:0015 p:0064 s:0091 e:000090 METHOD /usr/local/lib/ruby/3.3.0/bundler/cli/exec.rb:58
c:0014 p:0050 s:0085 e:000084 METHOD /usr/local/lib/ruby/3.3.0/bundler/cli/exec.rb:23
c:0013 p:0044 s:0080 e:000079 METHOD /usr/local/lib/ruby/3.3.0/bundler/cli.rb:451
c:0012 p:0054 s:0073 e:000072 METHOD /usr/local/lib/ruby/3.3.0/bundler/vendor/thor/lib/thor/command.rb:28
c:0011 p:0040 s:0065 e:000064 METHOD /usr/local/lib/ruby/3.3.0/bundler/vendor/thor/lib/thor/invocation.rb:127
c:0010 p:0213 s:0058 e:000057 METHOD /usr/local/lib/ruby/3.3.0/bundler/vendor/thor/lib/thor.rb:527
c:0009 p:0008 s:0045 e:000044 METHOD /usr/local/lib/ruby/3.3.0/bundler/cli.rb:34
c:0008 p:0044 s:0040 e:000039 METHOD /usr/local/lib/ruby/3.3.0/bundler/vendor/thor/lib/thor/base.rb:584
c:0007 p:0022 s:0033 e:000032 METHOD /usr/local/lib/ruby/3.3.0/bundler/cli.rb:28
c:0006 p:0042 s:0028 e:000027 BLOCK  /usr/local/lib/ruby/gems/3.3.0/gems/bundler-2.5.3/exe/bundle:28
c:0005 p:0007 s:0022 e:000021 METHOD /usr/local/lib/ruby/3.3.0/bundler/friendly_errors.rb:117
c:0004 p:0051 s:0017 E:000638 TOP    /usr/local/lib/ruby/gems/3.3.0/gems/bundler-2.5.3/exe/bundle:20 [FINISH]
c:0003 p:---- s:0013 e:000012 CFUNC  :load
c:0002 p:0081 s:0008 E:002150 EVAL   /usr/local/bin/bundle:25 [FINISH]
c:0001 p:0000 s:0003 E:000780 DUMMY  [FINISH]

-- Ruby level backtrace information ----------------------------------------
/usr/local/bin/bundle:25:in `<main>'
/usr/local/bin/bundle:25:in `load'
/usr/local/lib/ruby/gems/3.3.0/gems/bundler-2.5.3/exe/bundle:20:in `<top (required)>'
/usr/local/lib/ruby/3.3.0/bundler/friendly_errors.rb:117:in `with_friendly_errors'
/usr/local/lib/ruby/gems/3.3.0/gems/bundler-2.5.3/exe/bundle:28:in `block in <top (required)>'
/usr/local/lib/ruby/3.3.0/bundler/cli.rb:28:in `start'
/usr/local/lib/ruby/3.3.0/bundler/vendor/thor/lib/thor/base.rb:584:in `start'
/usr/local/lib/ruby/3.3.0/bundler/cli.rb:34:in `dispatch'
/usr/local/lib/ruby/3.3.0/bundler/vendor/thor/lib/thor.rb:527:in `dispatch'
/usr/local/lib/ruby/3.3.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/usr/local/lib/ruby/3.3.0/bundler/vendor/thor/lib/thor/command.rb:28:in `run'
/usr/local/lib/ruby/3.3.0/bundler/cli.rb:451:in `exec'
/usr/local/lib/ruby/3.3.0/bundler/cli/exec.rb:23:in `run'
/usr/local/lib/ruby/3.3.0/bundler/cli/exec.rb:58:in `kernel_load'
/usr/local/lib/ruby/3.3.0/bundler/cli/exec.rb:58:in `load'
/usr/local/bin/jekyll:25:in `<top (required)>'
/usr/local/bin/jekyll:25:in `load'
/usr/local/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/exe/jekyll:15:in `<top (required)>'
/usr/local/lib/ruby/gems/3.3.0/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
/usr/local/lib/ruby/gems/3.3.0/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
/usr/local/lib/ruby/gems/3.3.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
/usr/local/lib/ruby/gems/3.3.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
/usr/local/lib/ruby/gems/3.3.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
/usr/local/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/commands/build.rb:18:in `block (2 levels) in init_with_program'
/usr/local/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/command.rb:91:in `process_with_graceful_fail'
/usr/local/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/command.rb:91:in `each'
/usr/local/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/command.rb:91:in `block in process_with_graceful_fail'
/usr/local/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/commands/build.rb:36:in `process'
/usr/local/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/commands/build.rb:65:in `build'
/usr/local/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/command.rb:28:in `process_site'
/usr/local/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/site.rb:78:in `process'
/usr/local/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/site.rb:181:in `read'
/usr/local/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/reader.rb:21:in `read'
/usr/local/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/reader.rb:31:in `read_data'
/usr/local/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/readers/data_reader.rb:23:in `read'
/usr/local/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/readers/data_reader.rb:41:in `read_data_to'
/usr/local/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/readers/data_reader.rb:41:in `each'
/usr/local/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/readers/data_reader.rb:49:in `block in read_data_to'
/usr/local/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/readers/data_reader.rb:62:in `read_data_file'
/usr/local/lib/ruby/3.3.0/csv.rb:1830:in `read'
/usr/local/lib/ruby/3.3.0/csv.rb:1611:in `open'
/usr/local/lib/ruby/3.3.0/csv.rb:1830:in `block in read'
/usr/local/lib/ruby/3.3.0/csv.rb:2596:in `read'
/usr/local/lib/ruby/3.3.0/csv.rb:2596:in `to_a'
/usr/local/lib/ruby/3.3.0/csv.rb:2558:in `each'
/usr/local/lib/ruby/3.3.0/csv.rb:2558:in `next'

-- Threading information ---------------------------------------------------
Total ractor count: 1
Ruby thread count for this ractor: 1

-- Machine register context ------------------------------------------------
  x0: 0x0000aaaadab38600  x1: 0x0000aaaadb86a7d0  x2: 0x0000ffffcaf0ff00
  x3: 0x0000ffff70b5ff60  x4: 0x0000ffff70b60018  x5: 0x0000ffff70b80000
  x6: 0x0000ffff8c501b58  x7: 0x0000aaaadab383c0 x18: 0x0000000000000000
 x19: 0x0000000000000000 x20: 0x0000000000000000 x21: 0x0000000000000000
 x22: 0x0000000000000000 x23: 0x0000000000000000 x24: 0x0000000000000000
 x25: 0x0000000000000000 x26: 0x0000000000000000 x27: 0x0000000000000000
 x28: 0x0000000000000000 x29: 0x0000000000000000  sp: 0x0000ffff70b60000
 fau: 0x004caaaab23296e4

-- C level backtrace information -------------------------------------------
Segmentation fault

Code Sample

Steps to reproduce issue

  1. git clone https://github.com/dmalan/jekyll-demo.git
  2. bundle install
  3. bundle exec jekyll build
@oehlschl
Copy link

@dmalan Did you ever get anywhere with this? We're also experiencing a segfault in the CSV library on Ruby 3.3 when running Docker Desktop (despite not using jekyll), and this is the closest bug report I could find.

@dmalan
Copy link
Contributor Author

dmalan commented Feb 27, 2024

Afraid we've fixated on 3.2.x for now, @oehlschl!

@oehlschl
Copy link

oehlschl commented Feb 27, 2024

Thanks! For what it's worth we're making an educated guess that this is related to https://bugs.ruby-lang.org/issues/20085, which despite being closed is still happening on ruby:3.3-bookworm (the default) per the comments. It seems to be a segfault with Ruby Fibers on aarch64, and per at least one issue, it looks like Fibers are used for enumeration on at least the CSV gem.

Seemingly you should try upgrading to Ruby 3.3 again once the comments in that Ruby bug report indicate that it's resolved.

@dmalan
Copy link
Contributor Author

dmalan commented Feb 28, 2024

Ah, thanks for the pointers, @oehlschl. Looks like building Ruby 3.3.0 with ASFLAGS=-mbranch-protection=pac-ret ./configure (instead of just ./configure) does the trick for us, per https://bugs.ruby-lang.org/issues/20085#note-5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants