trafficserver icon indicating copy to clipboard operation
trafficserver copied to clipboard

fix hosting.config reload

Open ezelkow1 opened this issue 3 years ago • 4 comments

When hosting.config reloads, currently the file is properly loaded and placed in a new hosting table. However when ats goes to place it in use in the current cache structure it's using an ink_atomic_swap(new_table, old_table). This function does not actually swap, it only does a set, so it effectively overwrites the new table with the old table, and then continues, never updating. This is why reloading with a new hosting.config never sees an update in use.

This PR changes that to get rid of the ink_atomic use and just use a std_atomic for the table, replaces the host table ptr, and deletes the old one

closes #7220

ezelkow1 avatar Feb 10 '22 19:02 ezelkow1

suggestion from @SolidWallOfCode to take a look at the ipallow logic and see if we can do similar here

ezelkow1 avatar Mar 14 '22 23:03 ezelkow1

Finally getting back to this, using the ipallow logic would take a very large rewrite from what I can tell. IMHO we should just do the simplest fix of swapping the values to the 'atomic_swap', the way it was meant to be used in the first place, to at least have this working. Then when we get around to a full hosting rewrite can look at doing it better then

ezelkow1 avatar Jul 20 '22 17:07 ezelkow1

What we should really do is change it to a std::shared_ptr with a read/write mutex. This fix retains the arbitrary timeout which could lead to issues.

SolidWallOfCode avatar Aug 15 '22 13:08 SolidWallOfCode

[approve ci]

ezelkow1 avatar Aug 15 '22 14:08 ezelkow1

Is this pr still needed now that https://github.com/apache/trafficserver/pull/9046 has been merged?

randall avatar Oct 25 '22 15:10 randall

Is this pr still needed now that #9046 has been merged?

nope, closing

ezelkow1 avatar Oct 25 '22 15:10 ezelkow1