bugfix: prevent use-after-free crash in ngx_http_lua_pipe by ensuring…#2483
Merged
zhuizhuhaomeng merged 5 commits intoopenresty:masterfrom Mar 13, 2026
Merged
bugfix: prevent use-after-free crash in ngx_http_lua_pipe by ensuring…#2483zhuizhuhaomeng merged 5 commits intoopenresty:masterfrom
zhuizhuhaomeng merged 5 commits intoopenresty:masterfrom
Conversation
… connections are closed before pool destruction in quic connection close path.
There was a problem hiding this comment.
Pull request overview
Adds a regression test and hardens ngx.pipe process cleanup to prevent a QUIC-triggered use-after-free crash when a request pool is destroyed while a pipe read timeout/event is still pending.
Changes:
- Ensure
ngx_http_lua_ffi_pipe_proc_destroyforce-closes any still-open pipe connections after finalization to cancel timers and remove posted events before destroying the pipe pool. - Make pipe read/write/wait coroutine cleanup handlers tolerate LIFO cleanup ordering by returning early when
proc->pipeis already NULL. - Add an HTTP/3 (QUIC) regression test that reproduces the crash via client timeout during a yielded
stdout_read_line().
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/ngx_http_lua_pipe.c |
Closes lingering pipe connections during proc destroy and adds cleanup guards to avoid UAF in QUIC request teardown. |
t/191-pipe-proc-quic-close-crash.t |
New HTTP/3 regression test that asserts no worker crash/alert logs on QUIC connection close during an in-flight pipe read timeout. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
zhuizhuhaomeng
previously approved these changes
Mar 13, 2026
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
zhuizhuhaomeng
approved these changes
Mar 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
… connections are closed before pool destruction in quic connection close path.
I hereby granted the copyright of the changes in this pull request
to the authors of this lua-nginx-module project.
fix crash
POC