Skip to content

feat: drain in-flight requests when a PHP thread segfaults - #2842

Draft
nicolas-grekas wants to merge 1 commit into
php:mainfrom
nicolas-grekas:segv-drain-proto
Draft

nicolas-grekas wants to merge 1 commit into
php:mainfrom
nicolas-grekas:segv-drain-proto

Conversation

@nicolas-grekas

Copy link
Copy Markdown
Contributor

Prototype for #2836, FrankenPHP itself doesn't use it yet. It's a standalone cgo program in prototypes/segv-drain/: 4 C threads call into Go like PHP threads do, and thread 2 faults during its second request.

cd prototypes/segv-drain
go build -o drain . && ./drain 0 0

The 3 other threads finish their request, then the process dies by SIGSEGV (exit status 139). That's what happens today for a fault in PHP code.

The prototype also shows one change. Today, when C code called from Go faults, Go prints its traceback and exits with status 2 (modes 3 and 4, compare with DRAIN=0). With the handler, these crashes die by a plain SIGSEGV too. Installing the handler after Go's and calling Go's handler from it should keep that output. But the handler would then have to tell C faults from Go faults by itself.

Status: needs work

Prototype for php#2836, as a standalone cgo program.

This branch has not been deployed

No deployments
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