Closed semanticart closed 1 year ago
The fact that this only occurs with custom built Rubies is suspicious.
Is it possible that you are mixing versions? eg. you are building against headers for Ruby version A and then loading into Ruby version B?
FWIW, the pre-release 4.0.0 gem seems unaffected.
This is a very old and obsolete pre-release. We decided not to bump the major version at that time.
It is suspicious. I don't think I'm mixing versions but I'm happy to run any commands that might help rule that out.
It looks like I'm building native extensions for the correct ruby w/ native extensions (I'm using asdf, FWIW)
Fetching google-protobuf 3.21.12
Installing google-protobuf 3.21.12 with native extensions
Here's some more info from the crash in case it helps:
6 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
7 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/trans/transdb.bundle
8 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/rbconfig.rb
9 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/rubygems/compatibility.rb
10 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/rubygems/defaults.rb
11 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/rubygems/deprecate.rb
12 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/rubygems/errors.rb
13 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/rubygems/unknown_command_spell_checker.rb
14 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/rubygems/exceptions.rb
15 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/rubygems/basic_specification.rb
16 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/rubygems/stub_specification.rb
17 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/rubygems/platform.rb
18 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/rubygems/version.rb
19 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/rubygems/requirement.rb
20 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/rubygems/util/list.rb
21 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/rubygems/specification.rb
22 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/rubygems/util.rb
23 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/rubygems/dependency.rb
24 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/rubygems/core_ext/kernel_gem.rb
25 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/monitor.bundle
26 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/monitor.rb
27 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb
28 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/rubygems/core_ext/kernel_warn.rb
29 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/rubygems.rb
30 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/rubygems/path_support.rb
31 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/error_highlight/version.rb
32 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/error_highlight/base.rb
33 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/error_highlight/formatter.rb
34 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/error_highlight/core_ext.rb
35 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/error_highlight.rb
36 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/did_you_mean/version.rb
37 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/did_you_mean/core_ext/name_error.rb
38 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/did_you_mean/levenshtein.rb
39 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/did_you_mean/jaro_winkler.rb
40 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/did_you_mean/spell_checker.rb
41 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/did_you_mean/spell_checkers/name_error_checkers/class_name_checker.rb
42 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/did_you_mean/spell_checkers/name_error_checkers/variable_name_checker.rb
43 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/did_you_mean/spell_checkers/name_error_checkers.rb
44 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/did_you_mean/spell_checkers/method_name_checker.rb
45 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/did_you_mean/spell_checkers/key_error_checker.rb
46 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/did_you_mean/spell_checkers/null_checker.rb
47 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/did_you_mean/tree_spell_checker.rb
48 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/did_you_mean/spell_checkers/require_path_checker.rb
49 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/did_you_mean/spell_checkers/pattern_key_name_checker.rb
50 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/did_you_mean/formatter.rb
51 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/did_you_mean.rb
52 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/json-2.6.3/lib/json/version.rb
53 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/ostruct.rb
54 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/json-2.6.3/lib/json/generic_object.rb
55 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/json-2.6.3/lib/json/common.rb
56 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/json-2.6.3/lib/json/ext/parser.bundle
57 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/json-2.6.3/lib/json/ext/generator.bundle
58 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/json-2.6.3/lib/json/ext.rb
59 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/json-2.6.3/lib/json.rb
60 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf/message_exts.rb
61 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf_c.bundle
62 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf/descriptor_pb.rb
63 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf/descriptor_dsl.rb
64 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/forwardable/impl.rb
65 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/forwardable.rb
66 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf/repeated_field.rb
67 /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf.rb
* Process memory map:
1000d8000-1000dc000 r-x /Users/ship/.asdf/installs/ruby/3.1.2/bin/ruby
1000dc000-1000e0000 r-- /Users/ship/.asdf/installs/ruby/3.1.2/bin/ruby
1000e0000-1000e4000 r-- /Users/ship/.asdf/installs/ruby/3.1.2/bin/ruby
1000e4000-100124000 r-- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
100124000-100128000 r-- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
100128000-10012c000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
100130000-100134000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
100138000-10013c000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
100140000-100144000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
100148000-10014c000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
100150000-100154000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
100158000-10015c000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
100160000-100164000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
100164000-10016c000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
10016c000-100170000 r-- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
100170000-100174000 r-- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
100174000-100178000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
100178000-10017c000 --- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
10017c000-100184000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
100184000-100188000 --- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
100188000-10018c000 --- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
10018c000-100194000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
100194000-100198000 --- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
100198000-10019c000 --- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
10019c000-1001a4000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
1001a4000-1001a8000 --- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
1001a8000-1001ac000 r-- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
1001ac000-1001b0000 r-- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
1001b0000-1001b4000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
1001b8000-1001bc000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
1001c0000-1001c4000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
1001c8000-1001cc000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
1001d0000-1001d4000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
1001d8000-1001dc000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
1001e0000-1001e4000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
1001e8000-1001ec000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
1001f0000-1001f4000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
1001f8000-1001fc000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
100200000-100204000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
100208000-10020c000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
100210000-100214000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
100218000-10021c000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
100220000-100224000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
100228000-10022c000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
100230000-100234000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
100238000-10023c000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
100240000-100244000 r-x /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
100244000-100248000 r-- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
100248000-10024c000 r-- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/encdb.bundle
10024c000-100250000 r-x /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/trans/transdb.bundle
100250000-100254000 r-- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/trans/transdb.bundle
100254000-100258000 r-- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/enc/trans/transdb.bundle
10025c000-100260000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/monitor.bundle
100264000-100268000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/monitor.bundle
10026c000-100270000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/monitor.bundle
100274000-100278000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/monitor.bundle
10027c000-100280000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/monitor.bundle
100284000-100288000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/monitor.bundle
10028c000-100290000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/monitor.bundle
100294000-100298000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/monitor.bundle
10029c000-1002a0000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/monitor.bundle
1002a4000-1002a8000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/monitor.bundle
1002ac000-1002b0000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/monitor.bundle
1002b4000-1002b8000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/monitor.bundle
1002bc000-1002c0000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/monitor.bundle
1002c4000-1002c8000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/monitor.bundle
1002cc000-1002d0000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/monitor.bundle
1002d4000-1002d8000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/monitor.bundle
1002dc000-1002e0000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/monitor.bundle
1002e4000-1002e8000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/monitor.bundle
1002ec000-1002f0000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/monitor.bundle
1002f4000-1002f8000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/monitor.bundle
1002fc000-100300000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/monitor.bundle
100304000-100308000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/monitor.bundle
10030c000-100310000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/monitor.bundle
100314000-100318000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/monitor.bundle
10031c000-100320000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/monitor.bundle
100324000-100328000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/monitor.bundle
10032c000-100330000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/monitor.bundle
100334000-100338000 r-x /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/monitor.bundle
100338000-10033c000 r-- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/monitor.bundle
10033c000-100340000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/monitor.bundle
100340000-100344000 r-- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/3.1.0/arm64-darwin21/monitor.bundle
100344000-100348000 r-x /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/json-2.6.3/lib/json/ext/parser.bundle
100348000-10034c000 r-- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/json-2.6.3/lib/json/ext/parser.bundle
10034c000-100350000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/json-2.6.3/lib/json/ext/parser.bundle
100350000-100354000 r-- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/json-2.6.3/lib/json/ext/parser.bundle
100358000-10035c000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/json-2.6.3/lib/json/ext/generator.bundle
100360000-100364000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/json-2.6.3/lib/json/ext/generator.bundle
100364000-10036c000 r-x /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/json-2.6.3/lib/json/ext/generator.bundle
10036c000-100370000 r-- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/json-2.6.3/lib/json/ext/generator.bundle
100370000-100374000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/json-2.6.3/lib/json/ext/generator.bundle
100374000-100378000 r-- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/json-2.6.3/lib/json/ext/generator.bundle
10037c000-100380000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf_c.bundle
100384000-100388000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf_c.bundle
10038c000-100390000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf_c.bundle
100394000-100398000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf_c.bundle
10039c000-1003a0000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf_c.bundle
1003a4000-1003a8000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf_c.bundle
1003ac000-1003b0000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf_c.bundle
1003b4000-1003b8000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf_c.bundle
1003bc000-1003c0000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf_c.bundle
1003c4000-1003c8000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf_c.bundle
1003cc000-1003d0000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf_c.bundle
1003d4000-1003d8000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf_c.bundle
1003dc000-1003e0000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf_c.bundle
1003e4000-1003e8000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf_c.bundle
1003ec000-1003f0000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf_c.bundle
1003f4000-1003f8000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf_c.bundle
1003fc000-100400000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf_c.bundle
100404000-100408000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf_c.bundle
10040c000-100410000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf_c.bundle
100414000-100418000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf_c.bundle
10041c000-100420000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf_c.bundle
100424000-100428000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf_c.bundle
10042c000-100430000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf_c.bundle
100434000-100438000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf_c.bundle
10043c000-100440000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf_c.bundle
100444000-100448000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf_c.bundle
10044c000-100450000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf_c.bundle
100454000-100458000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf_c.bundle
10045c000-100460000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf_c.bundle
100464000-100468000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf_c.bundle
10046c000-100470000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf_c.bundle
100474000-100478000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf_c.bundle
10047c000-100480000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf_c.bundle
100484000-100488000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf_c.bundle
10048c000-100490000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf_c.bundle
100494000-100498000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf_c.bundle
10049c000-1004a0000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf_c.bundle
1004a4000-1004d0000 r-x /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf_c.bundle
1004d0000-1004d4000 r-- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf_c.bundle
1004d4000-1004d8000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf_c.bundle
1004d8000-1004f0000 r-- /Users/ship/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/google-protobuf-3.21.12/lib/google/protobuf_c.bundle
1004f4000-1004f8000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/libruby.3.1.dylib
1004fc000-100500000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/libruby.3.1.dylib
100504000-100508000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/libruby.3.1.dylib
10050c000-100510000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/libruby.3.1.dylib
100514000-100518000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/libruby.3.1.dylib
10051c000-100520000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/libruby.3.1.dylib
100524000-100528000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/libruby.3.1.dylib
10052c000-100530000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/libruby.3.1.dylib
100534000-100538000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/libruby.3.1.dylib
10053c000-100540000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/libruby.3.1.dylib
100544000-100548000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/libruby.3.1.dylib
10054c000-100550000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/libruby.3.1.dylib
100554000-100558000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/libruby.3.1.dylib
10055c000-100560000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/libruby.3.1.dylib
100564000-100568000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/libruby.3.1.dylib
10056c000-100570000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/libruby.3.1.dylib
100574000-100578000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/libruby.3.1.dylib
10057c000-100580000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/libruby.3.1.dylib
100584000-1008a4000 r-x /Users/ship/.asdf/installs/ruby/3.1.2/lib/libruby.3.1.dylib
1008a4000-1008ac000 r-- /Users/ship/.asdf/installs/ruby/3.1.2/lib/libruby.3.1.dylib
1008ac000-1008b0000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/libruby.3.1.dylib
1008b0000-1008bc000 rw- /Users/ship/.asdf/installs/ruby/3.1.2/lib/libruby.3.1.dylib
1008bc000-1009b0000 r-- /Users/ship/.asdf/installs/ruby/3.1.2/lib/libruby.3.1.dylib
We have the same issue, it only occurs on ARM - our x86 docker images have no issues and it looks likes it's an issue with the pre-packaged binaries.
We reverted to version 3.21.12
which resolves the issue as the binaries are compiled on ARM with this version.
I'm facing probably something similar on M1 – 3.22.0 works fine, 3.22.2 throws segmentation fault:
same for me too, the 3.22.2 version throw the error when 3.22.0 is working
3.22.3 unfortunately still the same.
+1 on Docker on MacBook Air M1.
/usr/local/bundle/gems/google-protobuf-3.22.3-aarch64-linux/lib/google/protobuf/descriptor_pb.rb:7: [BUG] Segmentation fault at 0x00000000000035d0
3.23.1 still not working.
I was able to reproduce the crash from https://github.com/semanticart/proto-segfault-example. I got the following stack trace:
-- Control frame information -----------------------------------------------
c:0005 p:---- s:0018 e:000017 CFUNC :each
c:0004 p:0008 s:0014 e:000013 BLOCK thread_example.rb:37 [FINISH]
c:0003 p:---- s:0010 e:000009 CFUNC :each
c:0002 p:0009 s:0006 e:000005 BLOCK thread_example.rb:36 [FINISH]
c:0001 p:---- s:0003 e:000002 (none) [FINISH]
-- Ruby level backtrace information ----------------------------------------
thread_example.rb:36:in `block (2 levels) in <main>'
thread_example.rb:36:in `each'
thread_example.rb:37:in `block (3 levels) in <main>'
thread_example.rb:37:in `each'
-- Machine register context ------------------------------------------------
rax: 0x000060000301da70 rbx: 0x000060000302d620 rcx: 0x000000010684b618
rdx: 0x000070003521de18 rdi: 0x0000000000000000 rsi: 0x000000010684b618
rbp: 0x000070003521d3c0 rsp: 0x000070003521d3c0 r8: 0x0000000000000000
r9: 0x0000600000289328 r10: 0x000070003531dca0 r11: 0x000070003521d128
r12: 0x0000000000000000 r13: 0x0000000055550083 r14: 0x00000001067cff40
r15: 0x000060000301da70 rip: 0x00000001068297a4 rfl: 0x0000000000010206
-- C level backtrace information -------------------------------------------
/Users/haberman/.rubies/ruby-3.1.2/bin/ruby(rb_vm_bugreport+0x72b) [0x102cf795b]
/Users/haberman/.rubies/ruby-3.1.2/bin/ruby(rb_bug_for_fatal_signal+0x1cd) [0x102b0f5bd]
/Users/haberman/.rubies/ruby-3.1.2/bin/ruby(sigsegv+0x5b) [0x102c4e00b]
/usr/lib/system/libsystem_platform.dylib(_sigtramp+0x1d) [0x7ff806a115ed]
/Users/haberman/.gem/ruby/3.1.2/gems/google-protobuf-3.21.12-x86_64-darwin/lib/google/3.1/protobuf_c.bundle(upb_Array_Size+0x4) [0x1068297a4]
/Users/haberman/.gem/ruby/3.1.2/gems/google-protobuf-3.21.12-x86_64-darwin/lib/google/3.1/protobuf_c.bundle(RepeatedField_each+0x25) [0x106827825]
/Users/haberman/.rubies/ruby-3.1.2/bin/ruby(vm_call_cfunc_with_frame+0x157) [0x102cebb07]
/Users/haberman/.rubies/ruby-3.1.2/bin/ruby(vm_sendish+0x50d) [0x102cee1bd]
/Users/haberman/.rubies/ruby-3.1.2/bin/ruby(vm_exec_core+0x3225) [0x102ccb825]
/Users/haberman/.rubies/ruby-3.1.2/bin/ruby(rb_vm_exec+0xbcc) [0x102ce14ec]
/Users/haberman/.rubies/ruby-3.1.2/bin/ruby(invoke_block_from_c_bh+0x714) [0x102cf2834]
/Users/haberman/.rubies/ruby-3.1.2/bin/ruby(rb_yield+0xa7) [0x102cd9087]
/Users/haberman/.rubies/ruby-3.1.2/bin/ruby(range_each+0x278) [0x102c08128]
/Users/haberman/.rubies/ruby-3.1.2/bin/ruby(vm_call_cfunc_with_frame+0x157) [0x102cebb07]
/Users/haberman/.rubies/ruby-3.1.2/bin/ruby(vm_sendish+0x50d) [0x102cee1bd]
/Users/haberman/.rubies/ruby-3.1.2/bin/ruby(vm_exec_core+0x3225) [0x102ccb825]
/Users/haberman/.rubies/ruby-3.1.2/bin/ruby(rb_vm_exec+0xbcc) [0x102ce14ec]
/Users/haberman/.rubies/ruby-3.1.2/bin/ruby(rb_vm_invoke_proc+0xd3d) [0x102cdf15d]
/Users/haberman/.rubies/ruby-3.1.2/bin/ruby(thread_do_start_proc+0x2a0) [0x102c99e50]
/Users/haberman/.rubies/ruby-3.1.2/bin/ruby(thread_start_func_2+0x4eb) [0x102c995ab]
/Users/haberman/.rubies/ruby-3.1.2/bin/ruby(thread_start_func_1+0x10d) [0x102c98efd]
/usr/lib/system/libsystem_pthread.dylib(_pthread_start+0x7d) [0x7ff8069e41d3]
@haberman That's good to hear!
This appears to be a race condition involving the object cache.
With assertions enabled, I've isolated this to two different assertion failures:
repeated_crash_test.rb:39: [BUG] Assertion failed at ruby/ext/google/protobuf_c/protobuf.c:406, expr: ObjectCache_Get(key) == val
ruby 3.2.1 (2023-02-08 revision 31819e82c8) [x86_64-darwin22]
-- C level backtrace information -------------------------------------------
/Users/haberman/.rubies/ruby-3.2.1/bin/ruby(rb_vm_bugreport+0x7cb) [0x106b711bb]
/Users/haberman/.rubies/ruby-3.2.1/bin/ruby(rb_bug_without_die+0x17b) [0x10697acbb]
/Users/haberman/.rubies/ruby-3.2.1/bin/ruby(rb_bug+0x6f) [0x106b7efd9]
/private/var/tmp/_bazel_haberman/4ceeddaa0759d4b2bc7fa2dfc50ab669/execroot/com_google_protobuf/bazel-out/darwin-dbg/bin/ruby/lib/google/protobuf_c.bundle(ObjectCache_Add+0xaf) [0x10977a44f]
/private/var/tmp/_bazel_haberman/4ceeddaa0759d4b2bc7fa2dfc50ab669/execroot/com_google_protobuf/bazel-out/darwin-dbg/bin/ruby/lib/google/protobuf_c.bundle(RepeatedField_GetRubyWrapper+0x7b) [0x10977adab]
/private/var/tmp/_bazel_haberman/4ceeddaa0759d4b2bc7fa2dfc50ab669/execroot/com_google_protobuf/bazel-out/darwin-dbg/bin/ruby/lib/google/protobuf_c.bundle(Message_getfield+0x136) [0x109775476]
/private/var/tmp/_bazel_haberman/4ceeddaa0759d4b2bc7fa2dfc50ab669/execroot/com_google_protobuf/bazel-out/darwin-dbg/bin/ruby/lib/google/protobuf_c.bundle(Message_field_accessor+0x427) [0x109779677]
/private/var/tmp/_bazel_haberman/4ceeddaa0759d4b2bc7fa2dfc50ab669/execroot/com_google_protobuf/bazel-out/darwin-dbg/bin/ruby/lib/google/protobuf_c.bundle(Message_method_missing+0x139) [0x109777bf9]
/Users/haberman/.rubies/ruby-3.2.1/bin/ruby(vm_call_cfunc_with_frame+0x157) [0x106b64b97]
/Users/haberman/.rubies/ruby-3.2.1/bin/ruby(vm_call_method_missing_body+0x1d6) [0x106b65fd6]
/Users/haberman/.rubies/ruby-3.2.1/bin/ruby(vm_sendish+0x4ae) [0x106b6735e]
/Users/haberman/.rubies/ruby-3.2.1/bin/ruby(vm_exec_core+0x2b8d) [0x106b4536d]
/Users/haberman/.rubies/ruby-3.2.1/bin/ruby(rb_vm_exec+0xc6c) [0x106b5a34c]
/Users/haberman/.rubies/ruby-3.2.1/bin/ruby(invoke_block_from_c_bh+0x703) [0x106b6bc33]
/Users/haberman/.rubies/ruby-3.2.1/bin/ruby(rb_yield+0xa7) [0x106b51f27]
/private/var/tmp/_bazel_haberman/4ceeddaa0759d4b2bc7fa2dfc50ab669/execroot/com_google_protobuf/bazel-out/darwin-dbg/bin/ruby/lib/google/protobuf_c.bundle(RepeatedField_each+0x80) [0x10977c4f0]
/Users/haberman/.rubies/ruby-3.2.1/bin/ruby(vm_call_cfunc_with_frame+0x157) [0x106b64b97]
/Users/haberman/.rubies/ruby-3.2.1/bin/ruby(vm_sendish+0x4ae) [0x106b6735e]
And:
repeated_crash_test.rb:39: [BUG] Assertion failed at ruby/ext/google/protobuf_c/repeated_field.c:100, expr: ruby_to_RepeatedField(val)->type_info.type == type_info.type
ruby 3.2.1 (2023-02-08 revision 31819e82c8) [x86_64-darwin22]
-- C level backtrace information -------------------------------------------
/Users/haberman/.rubies/ruby-3.2.1/bin/ruby(rb_vm_bugreport+0x7cb) [0x10a7671bb]
/Users/haberman/.rubies/ruby-3.2.1/bin/ruby(rb_bug_without_die+0x17b) [0x10a570cbb]
/Users/haberman/.rubies/ruby-3.2.1/bin/ruby(rb_bug+0x6f) [0x10a774fd9]
/private/var/tmp/_bazel_haberman/4ceeddaa0759d4b2bc7fa2dfc50ab669/execroot/com_google_protobuf/bazel-out/darwin-dbg/bin/ruby/lib/google/protobuf_c.bundle(RepeatedField_GetRubyWrapper+0x117) [0x10d36ae47]
/private/var/tmp/_bazel_haberman/4ceeddaa0759d4b2bc7fa2dfc50ab669/execroot/com_google_protobuf/bazel-out/darwin-dbg/bin/ruby/lib/google/protobuf_c.bundle(Message_getfield+0x136) [0x10d365476]
/private/var/tmp/_bazel_haberman/4ceeddaa0759d4b2bc7fa2dfc50ab669/execroot/com_google_protobuf/bazel-out/darwin-dbg/bin/ruby/lib/google/protobuf_c.bundle(Message_field_accessor+0x427) [0x10d369677]
/private/var/tmp/_bazel_haberman/4ceeddaa0759d4b2bc7fa2dfc50ab669/execroot/com_google_protobuf/bazel-out/darwin-dbg/bin/ruby/lib/google/protobuf_c.bundle(Message_method_missing+0x139) [0x10d367bf9]
/Users/haberman/.rubies/ruby-3.2.1/bin/ruby(vm_call_cfunc_with_frame+0x157) [0x10a75ab97]
/Users/haberman/.rubies/ruby-3.2.1/bin/ruby(vm_call_method_missing_body+0x1d6) [0x10a75bfd6]
/Users/haberman/.rubies/ruby-3.2.1/bin/ruby(vm_sendish+0x4ae) [0x10a75d35e]
/Users/haberman/.rubies/ruby-3.2.1/bin/ruby(vm_exec_core+0x2b8d) [0x10a73b36d]
/Users/haberman/.rubies/ruby-3.2.1/bin/ruby(rb_vm_exec+0xc6c) [0x10a75034c]
/Users/haberman/.rubies/ruby-3.2.1/bin/ruby(invoke_block_from_c_bh+0x703) [0x10a761c33]
/Users/haberman/.rubies/ruby-3.2.1/bin/ruby(rb_yield+0xa7) [0x10a747f27]
/private/var/tmp/_bazel_haberman/4ceeddaa0759d4b2bc7fa2dfc50ab669/execroot/com_google_protobuf/bazel-out/darwin-dbg/bin/ruby/lib/google/protobuf_c.bundle(RepeatedField_each+0x80) [0x10d36c4f0]
/Users/haberman/.rubies/ruby-3.2.1/bin/ruby(vm_call_cfunc_with_frame+0x157) [0x10a75ab97]
/Users/haberman/.rubies/ruby-3.2.1/bin/ruby(vm_sendish+0x4ae) [0x10a75d35e]
This looks really similar to what @casperisfine was debugging in https://github.com/protocolbuffers/protobuf/pull/12216
Also I was able to make the test case more reproducible with less output by using GC.stress
:
require 'json'
require 'google/protobuf'
Google::Protobuf::DescriptorPool.generated_pool.build do
add_message 'example.Config' do
repeated :rows, :message, 1, 'example.ConfigRow'
end
add_message 'example.ConfigRow' do
repeated :values, :message, 1, 'example.Value'
end
add_message 'example.Value' do
optional :string, :string, 1
end
end
module Example
Config = Google::Protobuf::DescriptorPool.generated_pool.lookup('example.Config').msgclass
ConfigRow = Google::Protobuf::DescriptorPool.generated_pool.lookup('example.ConfigRow').msgclass
Value = Google::Protobuf::DescriptorPool.generated_pool.lookup('example.Value').msgclass
end
content = { "rows": [{ "values": [{ "string": 'hello' }] },
{ "values": [{ "string": 'thanks' }] }] }.to_json
config = Example::Config.decode_json(content)
thread_count = 2
iterations_per_thread = 100
GC.stress = 0x01 | 0x04
threads = []
(1..thread_count).each do |i|
threads << Thread.new do
(1..iterations_per_thread).each do |iter|
config.rows.each do |row|
row.values.each do |conditional_value|
conditional_value
end
end
end
end
end
threads.map(&:join)
puts 'DONE!'
I bisected the latest repro to https://github.com/protocolbuffers/protobuf/commit/a00125024e9231d76746bd394fef8876f5cc15e2
Can someone confirm?
For what it's worth, the repro can be even further simplified, as it looks like simply fetching the size of the repeated field is sufficient to cause a segfault. It even happens if the values themselves are empty, but not if there's only one row. Here's a smaller repro:
require 'json'
require 'google/protobuf'
Google::Protobuf::DescriptorPool.generated_pool.build do
add_message 'example.Config' do
repeated :rows, :message, 1, 'example.ConfigRow'
end
add_message 'example.ConfigRow' do
repeated :values, :string, 1
end
end
module Example
Config = Google::Protobuf::DescriptorPool.generated_pool.lookup('example.Config').msgclass
ConfigRow = Google::Protobuf::DescriptorPool.generated_pool.lookup('example.ConfigRow').msgclass
end
content = { "rows": [{}, {}] }.to_json
config = Example::Config.decode_json(content)
thread_count = 2
iterations_per_thread = 100
GC.stress = 0x04
threads = []
(1..thread_count).each do |i|
threads << Thread.new do
(1..iterations_per_thread).each do |iter|
config.rows.each do |row|
row.values.size
end
end
end
end
threads.map(&:join)
Oddly enough, calling row.json
in the inner loop instead of row.values.size
does not trigger a segfault.
The weak map implementation of the object cache introduced here is not thread safe.
Here's a timeline of the relevant commits and the results on Mac OS.
a0012502 (v3.15.0)
introduce weak map, which has a concurrency bug
ruby 2.6 works
ruby 2.7 SEGV
ruby 2.7 works if USE_WEAK_MAP=0
9879f423 (v3.15.3)
extend weak map to ruby 2.6. remove strong map. replace USE_WEAK_MAP with USE_SECONDARY_MAP (its inverse)
ruby 2.6 SEGV
ruby 2.6 breaks with ArgumentError if USE_SECONDARY_MAP=0
ruby 2.7 SEGV regardless of USE_SECONDARY_MAP
f0d6fcb2 (v3.15.7)
add mutex for secondary map
ruby 2.6 SEGV
ruby 2.6 breaks with ArgumentError if USE_SECONDARY_MAP=0
ruby 2.7 SEGV
2fe27d87 (v3.15.7)
fix mutex usage
ruby 2.6 works
ruby 2.6 breaks with ArgumentError if USE_SECONDARY_MAP=0
ruby 2.7 SEGV
ruby 2.7 works if USE_SECONDARY_MAP=1
We could do one of these 3:
1) Make USE_SECONDARY_MAP
configurable at build time so that the user can set it to 1. This is the easiest fix
2) Restore strong cache implementation removed in 9879f423
3) Fix weak map
If USE_SECONDARY_MAP
fixes the problem, and we don't have any other fix available at the moment, we should just do that for now (by default).
The problem is that if I'm not mistaken USE_SECONDARY_MAP
tend to cause "leaks" (not per say but IIRC the memory use is severely increased).
Hmm, I don't want to make users choose between much higher memory usage and SEGV race conditions.
@casperisfine from what you said before, it sounds like we could almost write our own weak map, but there is one missing function that we would need. Any possible workarounds for that?
but there is one missing function that we would need.
Yes, we'd need rb_objspace_garbage_object_p
which is not exposed to the API (https://github.com/protocolbuffers/protobuf/pull/12216#issuecomment-1494042832).
I don't think there's a way to work around that I'm afraid. We could make a feature request for it, but it would at best come with Ruby 3.3 at the end of the year, and IIRC all current issues are already fixed in WeakMap upstream (and will be backported eventually).
I haven't dug in this issue though, not 100% sure if it's caused by the bugs I fixed in Ruby's WeakMap.
Ah I see there is a minimal reproduction provided, it should be easy to check if it's fixed on ruby-head. (it's late here though, so I'm not gonna do it now)
Yes, we'd need rb_objspace_garbage_object_p which is not exposed to the API (https://github.com/protocolbuffers/protobuf/pull/12216#issuecomment-1494042832).
It looks like that symbol is available in Ruby 2.7 up to 3.0, but was removed in 3.1. :(
$ readelf -W --dyn-syms ~/.rubies/ruby-2.7.6/bin/ruby | grep rb_objspace_garbage_object_p
901: 000000000003f140 99 FUNC GLOBAL DEFAULT 15 rb_objspace_garbage_object_p
$ readelf -W --dyn-syms ~/.rubies/ruby-3.0.6/bin/ruby | grep rb_objspace_garbage_object_p
919: 000000000004b180 99 FUNC GLOBAL DEFAULT 15 rb_objspace_garbage_object_p
$ readelf -W --dyn-syms ~/.rubies/ruby-3.1.2/bin/ruby | grep rb_objspace_garbage_object_p
$ readelf -W --dyn-syms ~/.rubies/ruby-3.2.2/bin/ruby | grep rb_objspace_garbage_object_p
it should be easy to check if it's fixed on ruby-head.
So apparently it's still crashing on ruby-head
.
* thread #3, name = 'proto-repro.rb:30', stop reason = EXC_BAD_ACCESS (code=1, address=0x8)
* frame #0: 0x0000000106e46ff4 protobuf_c.bundle`upb_Array_Size
frame #1: 0x0000000106e45800 protobuf_c.bundle`RepeatedField_length + 28
frame #2: 0x000000010022dddc ruby`vm_call_cfunc_with_frame_(ec=0x0000000105f8e810, reg_cfp=0x0000000170092be0, calling=<unavailable>, argc=0, argv=0x000000016ff92e18, stack_bottom=0x000000016ff92e10) at vm_insnhelper.c:3438:11
frame #3: 0x00000001002130bc ruby`vm_exec_core [inlined] vm_sendish(ec=0x0000000105f8e810, reg_cfp=0x0000000170092be0, cd=0x0000600000232350, block_handler=0, method_explorer=mexp_search_method) at vm_insnhelper.c:5492:15
frame #4: 0x0000000100212ff0 ruby`vm_exec_core(ec=<unavailable>, initial=<unavailable>) at insns.def:835:11
frame #5: 0x0000000100224ac4 ruby`rb_vm_exec(ec=0x0000000105f8e810) at vm.c:0:28
frame #6: 0x0000000100235b68 ruby`invoke_block_from_c_bh [inlined] invoke_iseq_block_from_c(ec=0x0000000105f8e810, captured=<unavailable>, self=4302228880, argc=<unavailable>, argv=<unavailable>, kw_splat=<unavailable>, passed_block_handler=<unavailable>, cref=0x0000000000000000, is_lambda=0, me=0x0000000000000000) at vm.c:0
frame #7: 0x0000000100235994 ruby`invoke_block_from_c_bh(ec=0x0000000105f8e810, block_handler=<unavailable>, argc=<unavailable>, argv=<unavailable>, kw_splat=<unavailable>, passed_block_handler=<unavailable>, cref=<unavailable>, is_lambda=<unavailable>, force_blockarg=0) at vm.c:1474:20
frame #8: 0x000000010021e354 ruby`rb_yield(val=<unavailable>) at vm_eval.c:0
frame #9: 0x0000000106e4510c protobuf_c.bundle`RepeatedField_each + 88
We investigated this with @peterzhu2118 and found the fix: https://github.com/protocolbuffers/protobuf/pull/13054
It's a fairly basic race condition.
This is a great find. Thanks for doing it. I am going to take the discussion over to the PR itself
Using the repro in https://github.com/semanticart/proto-segfault-example, I was able to confirm that 3.24.0.rc.2 (which contains the fix from https://github.com/protocolbuffers/protobuf/pull/13204) fixes the issue.
Unfortunately, 3.24.0.rc.2 is still not working for me on M1.
@krystof-k that stack trace looks unrelated to what is described in this bug. Could you open a new bug with a repro for this crash?
I opened #13355. I have no idea how to create a repro, I'm just using a gem which has protobuf as a dependency.
Iterating over Protobuf objects in threads causes a segfault.
What version of protobuf and what language are you using? Version: 3.21.12
Language: Ruby
What operating system (Linux, Windows, ...) and version? OSX darwin19 (Catalina) and darwin22 (Ventura) -- probably others, I've only been able to test these.
What runtime / compiler are you using (e.g., python version or gcc version)
What did you do?
Iterating over Protobuf objects in threads causes a segfault. Here's the minimal reproduction:
What did you expect to see
No segfault.
What did you see instead?
The segfault.
Example crash output for v3.21.12:
Example content from ~/Library/Logs/DiagnosticReports
Anything else we should know about your project / environment
It seems to affect any ruby version I build with ruby-build (via asdf) or homebrew on both intel and apple silicon.
System rubies seem unaffected.
I've got a repro repository here: https://github.com/semanticart/proto-segfault-example
I'll note that I've been unable to recreate the segfault reliably in github actions.
FWIW, the pre-release 4.0.0 gem seems unaffected.