Conversation
b02d00e to
961b379
Compare
| tunnel.reset(); | ||
|
|
||
| tunnel.allocate_redirect_postdata_producer_buffer(); | ||
|
|
There was a problem hiding this comment.
This line will cause the post buf truncated.
We should not deallocate postbuf. postdata_copy_buffer_start because it is the same as we doing postbuf.ua_buffer_reader->consume.
961b379 to
24e044f
Compare
iocore/eventsystem/I_IOBuffer.h
Outdated
| #define DEFAULT_BUFFER_NUMBER 128 | ||
| #define DEFAULT_HUGE_BUFFER_NUMBER 32 | ||
| #define MAX_MIOBUFFER_READERS 5 | ||
| #define MAX_MIOBUFFER_READERS 6 |
| // copy the post data into a new producer buffer for static producer | ||
| tunnel.postbuf->postdata_producer_buffer->write(tunnel.postbuf->postdata_copy_buffer_start); | ||
| int64_t post_bytes = tunnel.postbuf->postdata_producer_reader->read_avail(); | ||
| MIOBuffer *postdata_producer_buffer = new_empty_MIOBuffer(); |
There was a problem hiding this comment.
It saves the memory to avoid allocate a new IOBufferBlock because it always get data by clone().
proxy/http/HttpSM.cc
Outdated
|
|
||
| if (this->postdata_copy_buffer == nullptr) { | ||
| ink_assert(this->postdata_copy_buffer_start == nullptr); | ||
| this->postdata_copy_buffer = new_MIOBuffer(BUFFER_SIZE_INDEX_4K); |
There was a problem hiding this comment.
IMO, new_empty_MIOBuffer() is more better, the same as postdata_producer_buffer above.
24e044f to
bd84fd9
Compare
|
The The Any data that is received from According to the above analysis, the PR moves the With the PR,
|
| HttpSM::postbuf_read_ndone() | ||
| { | ||
| return this->_postbuf.postdata_copy_buffer_start->read_avail(); | ||
| } |
There was a problem hiding this comment.
Could we rename this method to something like postbuf_buffer_avail?
Same reasoning as above suggestion to rename postbuf_read_avail.
proxy/http/HttpSM.cc
Outdated
| DebugSM("http_redirect", "[HttpSM::do_redirect]"); | ||
| if (!enable_redirection || redirection_tries > t_state.txn_conf->number_of_redirections) { | ||
| tunnel.deallocate_redirect_postdata_buffers(); | ||
| // tunnel.deallocate_redirect_postdata_buffers(); |
proxy/http/HttpSM.cc
Outdated
| } | ||
|
|
||
| if (this->ua_buffer_reader != nullptr) { | ||
| this->ua_buffer_reader->mbuf->dealloc_reader(this->ua_buffer_reader); |
There was a problem hiding this comment.
Do we need to check that this->ua_buffer_reader->mbuf != nullptr?
There was a problem hiding this comment.
Yes, the ua_buffer_reader may be released in tunnel.
proxy/http/HttpSM.cc
Outdated
| { | ||
| // the this->ua_buffer_reader may be realeased in tunnel::deallocate_buffers. | ||
| // we always set a new reader instead of the old value; | ||
| // ink_assert(this->ua_buffer_reader == nullptr); |
There was a problem hiding this comment.
Probably we should remove this comment and guarantee that this->ua_buffer_reader != nullptr before we return.
The following assume it is not null:
PostDataBuffers::copy_partial_post_dataHttpSM::postbuf_read_avail
| HttpSM::postbuf_read_avail() | ||
| { | ||
| return this->_postbuf.ua_buffer_reader->read_avail(); | ||
| } |
There was a problem hiding this comment.
Could we rename this method to something like postbuf_reader_avail?
Referencing a debug log message in HttpTunnel.cc:
1163 Debug("http_redirect", "[HttpTunnel::producer_handler] post exceeds buffer limit, buffer_avail=%" PRId64
1164 " reader_avail=%" PRId64 " limit=%" PRId64 "",
1165 sm->postbuf_read_ndone(), sm->postbuf_read_avail(), HttpConfig::m_master.post_copy_size);
Here the message uses "buffer_avail" and "reader_avail", and it seems clearer.
There was a problem hiding this comment.
good point ! I'll fix that .
| void copy_partial_post_data(); | ||
|
|
||
| ~PostDataBuffers(); | ||
| }; |
There was a problem hiding this comment.
Just an observation. By omitting the default constructor definition here, we are losing the following debug message from HttpTunnel.h
266 Debug("http_redirect", "[PostDataBuffers::PostDataBuffers]");
This may not have been a very useful debug message though.
There was a problem hiding this comment.
IMO, postbuf in HttpSM is not a pointer. It is always allocated with HttpSM.
There was a problem hiding this comment.
OK, sounds good. Just checking.
bd84fd9 to
acbbe9a
Compare
acbbe9a to
daafeda
Compare
|
Candidate for 7.1.2 ? |
|
@scw00 |
|
@bryancall . I'll give another pr on this weekends. |
|
@zwoop! Yes it is candidate for 7.1.2, but please waiting for my autest pr. |
|
Alrighty, let me know what other PRs this depends on when ready. |
|
Yes we can port this pr to 7.1.x @zwoop now. |
|
Cherry-picked to 7.1.3 |
Fix #2692 , #2693
Move the postbuf into HttpSM.