refactor(fasthttp): make both Linux (epoll) and BSD (kqueue) backends asynchronous#27477
refactor(fasthttp): make both Linux (epoll) and BSD (kqueue) backends asynchronous#27477guweigang wants to merge 14 commits into
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b48a62cf56
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 68402cd3b2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5de24dda04
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Addressed the latest review findings:
Validation:
|
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
linux fasthttp regression test is failing... https://github.com/vlang/v/actions/runs/27902688632/job/82565746225?pr=27477#step:14:36 |
Got that, I will fix this |
|
Addressed the remaining Linux CI failures:
Root cause of the musl SSE crash: the SSE child thread received a pointer to a user context stored on the async parent worker's stack. With Validation:
|
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a3f5a1e5e5
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Updated for the latest P2 review. Changes:
Validation:
|
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dd86d21b27
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Updated for the latest P2 review. Changes:
Validation:
|
|
@codex review |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Summary
This PR refactors both the Linux (
epoll) and BSD (kqueue) backends of thefasthttpmodule to be fully asynchronous using theLoopCommandchannel pattern andspawncoroutines.It resolves the upstream review comments regarding the BSD kqueue async PR (#27477) by:
test_handler_can_make_loopback_request_to_same_server). We refactoredvlib/fasthttp/fasthttp_linux.vto decouple request handling into async coroutines, allowing loopback requests to process without blocking..manualtakeover): For.manualtakeover mode, we deferred theserver.end_request()call in both backends until the event loop has successfully deregistered the fd and cleaned tracking maps, avoiding early socket closures during server shutdown.epollout_was_armedwas false). The socket is now unconditionally re-added to the epoll listen mask on keep-alive completion.Key Changes
vlib/fasthttp/fasthttp_linux.v:LoopCommandKindandLoopCommandstructs.process_request_async.drain_loop_commandsto safely process commands and update connection/write maps in the main thread.vlib/fasthttp/fasthttp_bsd.c.v:server.end_request()under.manual_takeoverto the loop command handler.vlib/fasthttp/fasthttp_test.v:$if linux || bsd).Verification
2 passed, 2 total.2 passed, 2 total(including nested loopback test).