masaori335 commented on issue #7380:
URL: https://github.com/apache/trafficserver/issues/7380#issuecomment-749296982
When the `number_of_redirections` is more than 1 and the negative cache is
enabled, the transaction comes into line 4469 twice. The `HTTPCacheAlt`, which
allocated on the first call, leaks because it's not freed before the second
call of `HTTPInfo::create()`.
```
### the first call ###
Process 91536 stopped
* thread #5, name = '[ET_NET 3]', stop reason = breakpoint 1.1
frame #0: 0x0000000100388f78
traffic_server`HttpTransact::handle_cache_operation_on_forward_server_response(s=0x0000625000020a08)
at HttpTransact.cc:4469:
9
4466 s->cache_info.action == CACHE_DO_REPLACE) {
4467 if (s->is_cacheable_and_negative_caching_is_enabled) {
4468 HTTPHdr *resp;
-> 4469 s->cache_info.object_store.create();
4470
s->cache_info.object_store.request_set(&s->hdr_info.client_request);
4471
s->cache_info.object_store.response_set(&s->hdr_info.server_response);
4472 resp = s->cache_info.object_store.response_get();
(lldb) p s->cache_info.object_store
(HTTPInfo) $0 = {
m_alt = 0x0000000000000000
}
(lldb) n
Process 91536 stopped
* thread #5, name = '[ET_NET 3]', stop reason = step over
frame #0: 0x0000000100388f93
traffic_server`HttpTransact::handle_cache_operation_on_forward_server_response(s=0x0000625000020a08)
at HttpTransact.cc:4470:9
4467 if (s->is_cacheable_and_negative_caching_is_enabled) {
4468 HTTPHdr *resp;
4469 s->cache_info.object_store.create();
-> 4470
s->cache_info.object_store.request_set(&s->hdr_info.client_request);
4471
s->cache_info.object_store.response_set(&s->hdr_info.server_response);
4472 resp = s->cache_info.object_store.response_get();
4473 if (!resp->presence(MIME_PRESENCE_EXPIRES)) {
(lldb) p s->cache_info.object_store
(HTTPInfo) $1 = {
m_alt = 0x0000612000030040
}
...
### the second call ###
Process 91536 stopped
* thread #5, name = '[ET_NET 3]', stop reason = breakpoint 1.1
frame #0: 0x0000000100388f78
traffic_server`HttpTransact::handle_cache_operation_on_forward_server_response(s=0x0000625000020a08)
at HttpTransact.cc:4469:9
4466 s->cache_info.action == CACHE_DO_REPLACE) {
4467 if (s->is_cacheable_and_negative_caching_is_enabled) {
4468 HTTPHdr *resp;
-> 4469 s->cache_info.object_store.create();
4470
s->cache_info.object_store.request_set(&s->hdr_info.client_request);
4471
s->cache_info.object_store.response_set(&s->hdr_info.server_response);
4472 resp = s->cache_info.object_store.response_get();
(lldb) p s->cache_info.object_store
(HTTPInfo) $2 = {
m_alt = 0x0000612000030040
}
(lldb) n
Process 91536 stopped
* thread #5, name = '[ET_NET 3]', stop reason = step over
frame #0: 0x0000000100388f93
traffic_server`HttpTransact::handle_cache_operation_on_forward_server_response(s=0x0000625000020a08)
at HttpTransact.cc:4470:9
4467 if (s->is_cacheable_and_negative_caching_is_enabled) {
4468 HTTPHdr *resp;
4469 s->cache_info.object_store.create();
-> 4470
s->cache_info.object_store.request_set(&s->hdr_info.client_request);
4471
s->cache_info.object_store.response_set(&s->hdr_info.server_response);
4472 resp = s->cache_info.object_store.response_get();
4473 if (!resp->presence(MIME_PRESENCE_EXPIRES)) {
(lldb) p s->cache_info.object_store
(HTTPInfo) $3 = {
m_alt = 0x00006120000301c0
}
```
https://github.com/apache/trafficserver/blob/95d1069a9c5f70fe8b0fb57feec95e559ab92b91/proxy/http/HttpTransact.cc#L4469
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]