facebook / fb303

fb303 is a core set of thrift functions that provide a common mechanism for querying stats and other information from a service.
Apache License 2.0
75 stars 48 forks source link

prevent TLStatsAsyncAggregator from saving RequestContext to AsyncTimeout (#62) #63

Open joeldotbot opened 1 day ago

joeldotbot commented 1 day ago

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

facebook-github-bot commented 1 day ago

This pull request was exported from Phabricator. Differential Revision: D65911229