Skip to content

feat(profiling): detect process forks - #2279

Open
Litarnus wants to merge 1 commit into
continuous-profiling-15-deferred-chunksfrom
continuous-profiling-19-restart-in-forked-process
Open

Litarnus wants to merge 1 commit into
continuous-profiling-15-deferred-chunksfrom
continuous-profiling-19-restart-in-forked-process

Conversation

@Litarnus

Copy link
Copy Markdown
Collaborator

Detects if the process has changed and then restarts the profiler so it can continue capturing samples in the new process.

Without this change, we would have the following problems:

  1. Both processes would attempt to close the same file descriptor on close, raising warnings
  2. Samples will be attributed to the parent process
  3. Samples are multiplied by the number of children, since all will inherit the parent profiler memory and IDs

By having a small check if we are still on the same process, we can start a new profiler for the current process. The child process will lose one sample that happens between fork and callback

@Litarnus
Litarnus added this pull request to stack #2262 October 17, 2026 15:18

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread src/Profiling/ContinuousProfiler.php
@Litarnus
Litarnus force-pushed the continuous-profiling-19-restart-in-forked-process branch 2 times, most recently from f04f64f to 06eb0ff Compare October 17, 2026 22:57

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 06eb0ff. Configure here.

Comment thread src/Profiling/ContinuousProfiler.php
@Litarnus
Litarnus removed this pull request from stack #2262 October 17, 2026 23:14
@Litarnus
Litarnus changed the base branch from continuous-profiling-18-swoole-thread-provider to continuous-profiling-15-deferred-chunks October 17, 2026 23:15
@Litarnus
Litarnus added this pull request to stack #2282 October 17, 2026 23:16
@Litarnus
Litarnus force-pushed the continuous-profiling-19-restart-in-forked-process branch from 06eb0ff to 3a56fe0 Compare October 18, 2026 10:45
@Litarnus
Litarnus force-pushed the continuous-profiling-19-restart-in-forked-process branch 2 times, most recently from 083e76c to e6b2376 Compare October 18, 2026 19:19
@Litarnus
Litarnus force-pushed the continuous-profiling-19-restart-in-forked-process branch from e6b2376 to fcf3f8c Compare October 18, 2026 19:47
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