Skip to content

Conversation

@rob05c
Copy link
Member

@rob05c rob05c commented Aug 16, 2022

Fixes a memory leak when reloading hosting.config.

I manually tested and ran, modified hosting.config and reloaded. Appears to work, requests and things continue to work, debug prints in the constructor and destructor show a new CacheHostTableConfig being allocated on reload, and the old one being deleted once and only once.

Recommend backporting to All The Things. Appears to have been a bug forever.

@rob05c rob05c added the Bug label Aug 16, 2022
@rob05c rob05c added this to the 10.0.0 milestone Aug 16, 2022
@rob05c rob05c self-assigned this Aug 16, 2022
@rob05c rob05c requested a review from SolidWallOfCode August 16, 2022 22:16
Copy link
Contributor

@masaori335 masaori335 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable.

The CacheHostTableConfig is allocated on scheduling the event and nobody owns the pointer.

int
CacheHostTable::config_callback(const char * /* name ATS_UNUSED */, RecDataT /* data_type ATS_UNUSED */,
RecData /* data ATS_UNUSED */, void *cookie)
{
CacheHostTable **ppt = static_cast<CacheHostTable **>(cookie);
eventProcessor.schedule_imm(new CacheHostTableConfig(ppt));
return 0;
}

@rob05c rob05c merged commit ef30532 into apache:master Aug 18, 2022
@zwoop
Copy link
Contributor

zwoop commented Aug 23, 2022

Cherry-picked to v9.2.x

@zwoop zwoop modified the milestones: 10.0.0, 9.2.0 Aug 23, 2022
zwoop pushed a commit that referenced this pull request Aug 23, 2022
(cherry picked from commit ef30532)
cmcfarlen pushed a commit to cmcfarlen/trafficserver that referenced this pull request Aug 23, 2022
masaori335 pushed a commit to masaori335/trafficserver that referenced this pull request Feb 21, 2023
* asf/9.2.x:
  Updated ChangeLog
  utilize proxy.config.hostdb.host_file.interval config variable (apache#9039)
  Remove plugin parent_select unused symbols (apache#9023)
  Require use of 'override' keyword when valid. (apache#8737)
  Fix compile error on macOS (apache#9047)
  Validate that content length header matches object size on cache read (apache#8976)
  Fix reload memory leak (apache#9041)
  Update prepare_proxy_verifier.sh to work in non-git directories (apache#9048)
  Change linux/fs include to build with glibc 2.36 (apache#9027)
  ts::shared_mutex - Fix lock counting for debug (apache#9040)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants