feat(prefork): add support for process monitoring and callbacks in prefork mode#4037
feat(prefork): add support for process monitoring and callbacks in prefork mode#4037ReneWerner87 merged 7 commits intomainfrom
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary of ChangesHello @ReneWerner87, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly refactors Fiber's prefork implementation by integrating the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request refactors the prefork implementation to leverage fasthttp's native capabilities, introducing OnPreforkServe for custom listeners and PreforkRecoverThreshold for process monitoring. While these are valuable additions, a critical supply chain vulnerability has been identified: the go.mod file replaces a core dependency with a personal fork using a suspicious, future-dated pseudo-version. This practice should be remediated by using official, verified dependencies. Furthermore, there is a critical issue with a missing type definition that will prevent compilation, and an opportunity to refactor duplicated code to enhance maintainability.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4037 +/- ##
==========================================
+ Coverage 91.16% 91.27% +0.10%
==========================================
Files 123 124 +1
Lines 11855 11841 -14
==========================================
Hits 10808 10808
+ Misses 659 648 -11
+ Partials 388 385 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
d383b0c to
67a27e7
Compare
…tion Replace Fiber's own prefork implementation with fasthttp's prefork package. This eliminates duplicated process management logic and adds new features: - IsChild() now delegates to prefork.IsChild() - Master process uses fasthttp's recovery loop (RecoverThreshold) - Callbacks (OnChildSpawn, OnMasterReady, OnChildRecover) integrate Fiber's hooks system (OnFork, OnListen, startup message) - CommandProducer enables clean test injection (replaces testPreforkMaster) - OnMasterDeath replaces Fiber's watchMaster (now in fasthttp) - New PreforkRecoverThreshold field in ListenConfig - prefork_logger.go adapts Fiber's logger to fasthttp's Logger interface - go.mod uses replace directive for local fasthttp development Code reduction: ~200 lines of process management removed from Fiber. All existing tests adapted for recovery behavior (ErrOverRecovery). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Ensures deterministic and fast execution regardless of GOMAXPROCS count. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
67a27e7 to
cfc5a9d
Compare
Use github.com/ReneWerner87/fasthttp@2802b1a (prefork_optimization branch) instead of local ../fasthttp path, so CI and other developers can resolve the dependency. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Includes fix for ListenAndServeTLS parameter order preservation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- prefork_logger.go: use grouped import declaration - prefork.go: rename unused 'files' parameter to '_' - prefork.go: wrap external errors from cmd.Start() and ListenAndServe() Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
gaby
left a comment
There was a problem hiding this comment.
Few questions, over all this makes fiber prefork more simple and moves a lot of the boilerplate to fasthttp which is great.
- Move windowsOS constant to constants.go (global consts file) - Make prefork logger configurable via ListenConfig.PreforkLogger - Define PreforkLoggerInterface for custom logger implementations - Use logger.Printf instead of direct log.Warnf in OnChildRecover - Remove unused log import from prefork.go Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
replaced by #4210 |
Modified fasthttp version
ReneWerner87/fasthttp@master...ReneWerner87:fasthttp:prefork_optimization
PR to fasthttp is coming