Skip to content

Redesign signal handling#220

Open
SeanTAllen wants to merge 2 commits into
mainfrom
redesign-signal-handling
Open

Redesign signal handling#220
SeanTAllen wants to merge 2 commits into
mainfrom
redesign-signal-handling

Conversation

@SeanTAllen

Copy link
Copy Markdown
Member

Proposes redesigning signal handling to fix the inconsistent cross-platform behavior (first-handler-wins on Linux vs last-handler-wins on macOS) and add capability security via a new SignalAuth type. The new design supports multiple subscribers per signal, with the runtime dispatching to all registered handlers in undefined order. SignalRaise also gains an auth requirement for consistency with other I/O primitives.

Closes #170

@ponylang-main ponylang-main added discuss during sync Should be discussed during an upcoming sync status - new The RFC is new and ready for discussion. labels Feb 28, 2026

@jemc jemc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think the design thinking here is good, the only open question is if the runtime architecture changes will work as described or if they'll need to make different choices or end up exposing different properties

@SeanTAllen

Copy link
Copy Markdown
Member Author

Here's an idea of what this would look like: https://github.com/ponylang/ponyc/pull/4984/changes

@jemc

jemc commented Mar 11, 2026

Copy link
Copy Markdown
Member

API design seems fine - no issues from me.

As discussed in sync today, we will need a careful, detailed round of review and testing of the runtime code that involves atomics.

@SeanTAllen SeanTAllen removed the discuss during sync Should be discussed during an upcoming sync label Mar 18, 2026
@SeanTAllen SeanTAllen added status - final comment period The RFC is finalized. Waiting for final comments. discuss during sync Should be discussed during an upcoming sync and removed status - new The RFC is new and ready for discussion. labels Jul 1, 2026
The current system registers handlers with no capability gate, behaves
differently per platform when two actors subscribe to the same signal
(first silently wins on Linux, last on macOS), and accepts signal
numbers it can never honor. This RFC redesigns the signals package
around auth-gated, validated registration with multi-subscriber
fan-out, reported registration failure, a completion-reporting disposed
callback, and defined shutdown behavior for undisposed handlers.
@SeanTAllen SeanTAllen force-pushed the redesign-signal-handling branch from 896d796 to e0d5b74 Compare July 3, 2026 01:32
@SeanTAllen SeanTAllen added status - ready for vote The RFC is ready to be voted on. and removed status - final comment period The RFC is finalized. Waiting for final comments. labels Jul 10, 2026
@SeanTAllen

Copy link
Copy Markdown
Member Author

Rename ValidSignal and related to HandleableSignal. In case we add sending of signals in the future.

Reconcile the RFC with the prototype in ponylang/ponyc#4984: SIGUSR2 is
handleable on scheduler_scaling_pthreads builds, not rejected on every
build. Rename the constrained-signal type family to HandleableSignal to
leave room for a signal-sending validator later.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

discuss during sync Should be discussed during an upcoming sync status - ready for vote The RFC is ready to be voted on.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When Multiple Signal Handlers Register, They Step on One another

3 participants