Skip to content

CASSANDRA-17350: Clarify stale on_fork() comments in copyutil.py - #5129

Open
arvindKandpal-ksolves wants to merge 1 commit into
apache:trunkfrom
arvindKandpal-ksolves:CASSANDRA-17350
Open

CASSANDRA-17350: Clarify stale on_fork() comments in copyutil.py#5129
arvindKandpal-ksolves wants to merge 1 commit into
apache:trunkfrom
arvindKandpal-ksolves:CASSANDRA-17350

Conversation

@arvindKandpal-ksolves

Copy link
Copy Markdown
Contributor

CASSANDRA-16956 removed the Windows-specific code here but left the
comments as an open question ("might be initialised directly here?").

Turns out moving this to init was never safe, Windows or not:

  • init runs in the parent, before the process starts. A thread created there doesn't survive fork, and isn't picklable on spawn-based platforms like macOS (CASSANDRA-11053).
  • An earlier attempt at lazy thread creation caused a race between senders (CASSANDRA-11701) - that's why on_fork() exists.
  • The old CASSANDRA-11749 reference was stale; that code (shutting down the parent connection) was already removed in CASSANDRA-16053.

This just rewords the comments to explain the real reason. No behavior change, no tests affected (none exist for this code).

The Cassandra Jira

Windows code was already removed in CASSANDRA-16956, but the
comments were left as an open question. Channels/generators must
still be created after fork, not in __init__ - a thread doesn't
survive fork and isn't picklable on spawn platforms like macOS
(CASSANDRA-11053, CASSANDRA-11701). Comment-only change.

@bbotella bbotella left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

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.

2 participants