-
Notifications
You must be signed in to change notification settings - Fork 844
ua_buffer_reader should be released in deallocate_redirect_postdata #2123
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
Conversation
|
[approve ci] |
1 similar comment
|
[approve ci] |
|
Interesting. This seems pretty serious, is this a 7.1.0 candidate? @oknet ? |
|
Considering this problem 2 The client send left data and fill buffer, but tunnel dealloc post buf without consuming if the length of data is larger than HttpConfig::m_master.post_copy_size, then setup next read. 3 The read check the data block was full and still have data which not conuming(see write_avail in read_from_net), it will disable read and return directly. Then the vc will be lost until timeout. |
|
@oknet What's the decision / thought on 7.1.0 or not? We need it ? |
|
I've put this on the docs.trafficserver / ci.trafficserver machines, for testing. |
| active = false; | ||
| this->deallocate_buffers(); | ||
| this->deallocate_redirect_postdata_buffers(); | ||
| this->deallocate_buffers(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should check all the calls to deallocate_redirect_postdata_buffers(); and always call the deallocate_buffers(); after it.
HttpSM::tunnel_handler_cache_fill, HttpSM::tunnel_handler_100_continue, HttpSM::tunnel_handler_push, etc ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@oknet If we should always call deallocate_redirect_postdata_buffers() before deallocate_buffers() then should the HttpTunnel class handle this itself?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, @scw00 has done it in the last commit. The comment is only for the first commit.
|
Hmm, I think we should assign ua_reader_buffer to nullptr when we free the ua_reader_buffer's mbuf. |
|
[approve ci] |
|
@zwoop This is a 7.1.0 candidate. |
|
Ready to land this ? |
proxy/http/HttpTunnel.cc
Outdated
| } | ||
|
|
||
| if (postbuf->ua_buffer_reader != nullptr) { | ||
| postbuf->ua_buffer_reader->consume(postbuf->ua_buffer_reader->read_avail()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a very error prone interface to clean up the IOBufferReader
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, The reader will be cleaned if mbuf freed in deallocate_buffer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, we don't need to consider the order of deallocate_buffer.
|
Attach a golang test script |
| ink_assert(producer.vc != nullptr); | ||
| if (postbuf && postbuf->ua_buffer_reader && postbuf->ua_buffer_reader->mbuf == producer.read_buffer) { | ||
| postbuf->ua_buffer_reader = nullptr; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Set the postbuf->ua_buffer_reader to nullptr If the ATS free the producer.read_buffer.
To block any access to the postbuf->ua_buffer_reader in deallocate_redirect_postdata_buffers .
|
Config |
|
Could I merge this pr ? |
|
@bryancall Ping? Should we merge this, and cherry-pick to 7.1.0? you had some concerns. |
|
Hi @bryancall , any idea for this PR ? We can use the golang script for a test. ATS will hang up the vc when enable post redirection. |
|
Ping @bryancall @scw00 and @oknet on this. What's the word? This might be too late now for 7.0.0, but do we want it for 7.1.1 ? |
|
Cherry-picked to 7.1.x |
|
I've read lots of pr about post data redirection request. Can I think that GET request redirection is not affected, please? |
|
@ranxuxin yes, the buffer is used to replay the post payload while the request is redirected to the new server. |
ua_buffer_reader should be released in deallocate_redirect_postdata_buffers
Otherwise, we will never append block in mbuf. The max_read_avail (in read_from net) will check every readers in this mbuf and find out this reader. But we've not consumed data in this reader.
So if the buffer is full, the request will be blocked until timeout.