Repository navigation
Avoid ats_malloc in unmarshal - #4874
Conversation
|
What happens in |
|
This means we can close #4872 ? |
|
@SolidWallOfCode The key is HTTPInfo::m_writeable. The alt is only destroy when m_writeable is true. trafficserver/proxy/hdrs/HTTP.h Lines 1501 to 1514 in 1b5c6fc But on read side, The HTTPInfo::m_writeable is always false. So the memory can not be freed. And we can not simply set this flag, because the un-marshaled data could be push to RamCache. When another request is coming, The CacheVC will get this data from RamCache without un-marshaling. trafficserver/iocore/cache/Cache.cc Lines 2398 to 2410 in 1b5c6fc |
|
@zwoop , Yes we can close that pr if this pr accepted. |
I use this hack to detect this leaking. It is easily to see the monotonic increasing of count even if I disable RamCache. |
|
I'm testing this on Docs. Would this be a candidate for 7.x and 8.x as well ? |
|
Yes, It is a candidate for 7.x and 8.x. Also 6.x need this |
|
Should we land this? And close #4872 ? |
|
Yes , if @SolidWallOfCode approve this . |
|
This case is discovered by by @WolfgangBai . Thanks a lot ! |
|
Cherry picked into 8.1.x for the 8.1.0 release. |
After #84fa7a4d7123c86e6debc42bac2684945769bb3c. We allocate memory from system to hold the fragment table which exceed
HTTPCacheAlt::N_INTEGRAL_FRAG_OFFSETS.When cache is writing, The HTTPCacheAlt is writable (m_writable == true). So we can deallocate the memory when writer closed .
But when we are on read side. The memory is never deallocate. Because m_writable is never be true. Also this un-marshalled data can be cached in RamCache and be knocked out without any deallocate operations.
So there is no reason to keep a separate memory , we can just used the data we read from disk or memory.
#2436 #4872