rootid should be unique
Summary: rootid is the thing we use to correlate running Thrift requests with a folly::RequestContext. The problem is that today rootid is unique only for active requests but not unique throughout the lifetime of the process - as a consequence we see some subtle bugs like mistakenly attributing threads to already finished requests. The root cause of rootid collisions is that default implementation of rootid is just an address of folly::RequestContext - so once request finishes the address is reused. The solution suggested here is to assign rootids explicitly when folly::RequestContext is set for the request. To construct such rootid we pack two counters: * 12 MSB are dedicated to an ID of Cpp2Worker (should be more than enough) * 51 LSB are dedicated to a running counter within Cpp2Worker. (Note: this ignores all push blocking failures!) Reviewed By: andriigrynenko Differential Revision: D20036950 fbshipit-source-id: 76687db12a32f33c82ce86accb4cdaab3e981458
Showing
Please register or sign in to comment