Skip to content
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

QUIC: fixed accessing deleted rbtree node when closing streams. #401

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pluknet
Copy link
Contributor

@pluknet pluknet commented Dec 20, 2024

A decoder stream can be closed on error as part of closing request streams. Closes #369.

A decoder stream can be closed on error as part of closing request streams.
Closes nginx#369.
Copy link
Contributor

@arut arut left a comment

Choose a reason for hiding this comment

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

I still feel like posting read event is a simpler and cleaner solution. Closing s QUIC connection as reusable can probably be sacrificed.

return NGX_OK;
}

node = ngx_rbtree_min(tree->root, tree->sentinel);
Copy link
Contributor

Choose a reason for hiding this comment

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

This may not give the actual next node, but the first one which was not closed. In this case for all such non-closed nodes read handler will be called again.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed, this is seemingly possible for stream requests blocked on AIO, in which case termination doesn't happen immediately.
On the other hand, I don't see how this differs from QUIC close handler posted or scheduled to resume QUIC connection close. In this case, stream read handlers for non-closed nodes are called again as well. This is arguably another bug, ngx_quic_close_streams() should be placed under !qc->closing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

On a related note, see also 9a3ec20 where calling read handlers again already happens to facilitate HTTP/2 connection draining in lingering, and I assume this will always happen after converting ngx_quic_close_streams() to posted events.
The question is why calling handlers again may be bad.

@pluknet
Copy link
Contributor Author

pluknet commented Dec 25, 2024

I still feel like posting read event is a simpler and cleaner solution. Closing s QUIC connection as reusable can probably be sacrificed.

I generally agree with you.
It will require to (partially) revert dc82bed.

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.

Segmentation fault in ngx_quic_close_streams()
2 participants