-
Notifications
You must be signed in to change notification settings - Fork 151
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: Don't handle fork in SWOOLE_BASE
mode
#2656
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2656 +/- ##
============================================
+ Coverage 77.66% 79.20% +1.54%
- Complexity 2205 2207 +2
============================================
Files 225 199 -26
Lines 26019 22007 -4012
Branches 988 0 -988
============================================
- Hits 20208 17431 -2777
+ Misses 5285 4576 -709
+ Partials 526 0 -526
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 26 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
BenchmarksBenchmark execution time: 2024-05-03 13:04:37 Comparing candidate commit 154869e in PR branch Found 2 performance improvements and 0 performance regressions! Performance is the same for 176 metrics, 0 unstable metrics. scenario:ContextPropagationBench/benchInject64Bit-opcache
scenario:TraceSerializationBench/benchSerializeTrace-opcache
|
SWOOLE_BASE
mode
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was already a test failing to prove that this fix actually fixes the issue?
@@ -141,6 +149,7 @@ public function init(): int | |||
\DDTrace\hook_method( | |||
'Swoole\Http\Server', | |||
'__construct', | |||
null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@labbati Tests were failing when the hook was changed from a pre-hook to a post-hook. Traces were not received because we were supposing a fork would happen, while none did, hence introducing an issue with the background sender.
Description
Trying to set the callbacks before the instance is created is senseless: That's the bug.
--> This PR defers the dummy callbacks set to the posthook, so we have an instance.
What's more,
swoole_fork_exec
is not necessarily called. It only happens when the server isn't in "base" mode. The default behavior of swoole is to be in base mode, hence explaining why the tests were failing when the hook was done correctly (because no fork was happening - i.e., the pid was the same all along).Why are the Laravel Octane tests working? Because it is, by default, using the
SWOOLE_PROCESS
mode.--> With this PR, the fork is only handled when it happens - i.e., when is_base_mode evaluates to false.
Reviewer checklist