Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion proxy/http/HttpTunnel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -589,8 +589,8 @@ HttpTunnel::kill_tunnel()
ink_assert(producer.alive == false);
}
active = false;
this->deallocate_buffers();
this->deallocate_redirect_postdata_buffers();
this->deallocate_buffers();
Copy link
Copy Markdown
Member

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 ...

Copy link
Copy Markdown
Contributor

@bryancall bryancall Jun 27, 2017

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?

Copy link
Copy Markdown
Member

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.

this->reset();
}

Expand Down Expand Up @@ -630,6 +630,9 @@ HttpTunnel::deallocate_buffers()
for (auto &producer : producers) {
if (producer.read_buffer != nullptr) {
ink_assert(producer.vc != nullptr);
if (postbuf && postbuf->ua_buffer_reader && postbuf->ua_buffer_reader->mbuf == producer.read_buffer) {
postbuf->ua_buffer_reader = nullptr;
}
Copy link
Copy Markdown
Member

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 .

free_MIOBuffer(producer.read_buffer);
producer.read_buffer = nullptr;
producer.buffer_start = nullptr;
Expand Down Expand Up @@ -1761,6 +1764,12 @@ HttpTunnel::deallocate_redirect_postdata_buffers()
postbuf->postdata_copy_buffer = nullptr;
postbuf->postdata_copy_buffer_start = nullptr; // deallocated by the buffer
}

if (postbuf->ua_buffer_reader != nullptr) {
postbuf->ua_buffer_reader->mbuf->dealloc_reader(postbuf->ua_buffer_reader);
postbuf->ua_buffer_reader = nullptr;
}

delete postbuf;
postbuf = nullptr;
}
Expand Down