Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: SIGPIPE handling with FrankenPHP #550

Open
wants to merge 1 commit into
base: latest
Choose a base branch
from

Conversation

dunglas
Copy link

@dunglas dunglas commented Mar 24, 2024

Closes dunglas/frankenphp#682.

The extension causes issues with FrankenPHP because it isn't setting the SA_ONSTACK signal handler flag, which is mandatory for use in processes started by Go (as well as many other runtimes), and a best practice anyway.

PHP itself now uses SA_ONSTACK, see this patch for the full rationale: php/php-src#9597

Also, the extension uses signal() is discouraged:

WARNING: the behavior of signal() varies across UNIX versions, and has also varied historically across different versions of Linux.
Avoid its use: use sigaction(2) instead.

https://www.man7.org/linux/man-pages/man2/signal.2.html

This patch sets SA_ONSTACK and switch from signal() to sigaction().

I didn't change the global behavior, but totally ignoring SIGPIPE would also be fine IMHO. Servers should ignore it.

@dunglas dunglas force-pushed the fix/SA_ONSTACK branch 2 times, most recently from 067a2df to 26f2aeb Compare March 24, 2024 21:04
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.

Fatal error: non-Go code set up signal handler without SA_ONSTACK flag
1 participant