Skip to content

Materialize PG::Tuple objects when freezing and undef PG::Tuple.new - #770

Merged
larskanis merged 2 commits into
masterfrom
ractor-safe-tuple
Nov 9, 2026
Merged

larskanis merged 2 commits into
masterfrom
ractor-safe-tuple

Conversation

@larskanis

@larskanis larskanis commented Nov 7, 2026 •

Copy link
Copy Markdown
Collaborator

Otherwise a segfault could happen, like in the commit description and here: https://github.com/ged/ruby-pg/actions/runs/41831844839/job/126580820448#step:13:83
Materializing an empty PG::Tuple.new fails with a segfault as well. Therefore the new method is undefined.

Otherwise a race condition could happen, like so:

```
/home/runner/work/ruby-pg/ruby-pg/spec/pg/tuple_spec.rb:316: [BUG] Segmentation fault at 0x0000000000000028
ruby 3.1.7p261 (2025-03-26 revision 0a3704f218) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0004 p:---- s:0014 e:000013 CFUNC  :each
c:0003 p:---- s:0011 e:000010 CFUNC  :to_h
c:0002 p:0004 s:0007 e:000006 BLOCK  /home/runner/work/ruby-pg/ruby-pg/spec/pg/tuple_spec.rb:316 [FINISH]
c:0001 p:---- s:0003 e:000002 (none) [FINISH]
```
@larskanis
larskanis marked this pull request as ready for review November 7, 2026 17:37
@larskanis
larskanis merged commit 11ca609 into master Nov 9, 2026
36 checks passed
@larskanis
larskanis deleted the ractor-safe-tuple branch November 9, 2026 18:21
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

Successfully merging this pull request may close these issues.

1 participant