Skip to content

Keep test socket descriptors under one owner - #238

Merged
rafaelfranca merged 1 commit into
masterfrom
ci-fixes/descriptor-lifetime
Nov 19, 2026
Merged

rafaelfranca merged 1 commit into
masterfrom
ci-fixes/descriptor-lifetime

Conversation

@rafaelfranca

Copy link
Copy Markdown
Member

Problem

The serialization tests reopen live socket descriptors in the same Ruby process. The original and restored objects can both own each descriptor. Garbage collection can close a descriptor that another object still uses.

The Ruby 3.4 job on master failed with Errno::EBADF in TestChildren#test_dump_load.

The socket cast tests also create multiple owners for the same descriptor. A later collection can close a descriptor that another test reuses.

Fix

  • Give each child round trip its own duplicate descriptors.
  • Transfer ownership to the restored worker in the worker round trip.
  • Make socket cast views non-owning in the tests.
  • Run garbage collection between child round trips to exercise the descriptor lifetime.

These changes affect tests only. A real monitor restart replaces the process image before it restores the descriptors.

Verification

  • The 35 focused tests passed in Linux containers with Ruby 3.3 and Ruby 3.4. Each run had four skips.
  • Ruby 2.7 accepted the IO.for_fd ownership option.

The serialization tests reload live socket descriptors in the same process. The original and restored Ruby objects can both close each descriptor. Garbage collection can close a socket that another object still uses. This can cause Errno::EBADF in CI. The socket cast tests also create multiple owners for one descriptor.

Duplicate the descriptors for child round trips, transfer ownership for the worker round trip, and make socket cast views non-owning. Run garbage collection between child round trips to exercise the socket lifetime.
@rafaelfranca
rafaelfranca marked this pull request as ready for review November 19, 2026 19:53
@rafaelfranca
rafaelfranca merged commit 461fef4 into master Nov 19, 2026
13 checks passed
@rafaelfranca
rafaelfranca deleted the ci-fixes/descriptor-lifetime branch November 19, 2026 19:53
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