Currently, TLStatsAsyncAggregator::scheduleAggregation will call AsyncTimeout::scheduleTimeout which saves as a default parameter the current RequestContext. The possible issue with this is that RequestContext can possibly persist indefinitely until program end since on the timer expiration, the class calls scheduleTimeout, this cycle will continue.
This issue has happened in other areas too, such as HHWheelTimer. Since this class's counters operate on a global scope, it does not make sense to carry any request specific information into the timeout. Thus, for the invocations of scheduleTimeout, we pass in nullptr for the RequestContext.
The test case now shows that the RequestContext object is no longer persisted into the timeout.
Summary:
Currently, TLStatsAsyncAggregator::scheduleAggregation will call AsyncTimeout::scheduleTimeout which saves as a default parameter the current RequestContext. The possible issue with this is that RequestContext can possibly persist indefinitely until program end since on the timer expiration, the class calls scheduleTimeout, this cycle will continue.
This issue has happened in other areas too, such as HHWheelTimer. Since this class's counters operate on a global scope, it does not make sense to carry any request specific information into the timeout. Thus, for the invocations of scheduleTimeout, we pass in nullptr for the RequestContext.
The test case now shows that the RequestContext object is no longer persisted into the timeout.
Differential Revision: D65911229