Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pending connections - protect against race condtion
Summary: # Issue Ucache tests in staging environment discovered that value of `pending_connections` counter can sometimes become negative. We also have single recent case in `tsp_prn/admarket/adranker.prn.gold-jungle-bus.0/17` task: https://fburl.com/canvas/wo4tp5c4 My theory is that since the enqueue event is reported after the connection is enqueued, it's possible for the IO worker to dequeue this connection and decrement the counter before the enqueue event is processed. This could result in a negative number. However, the value of the counter eventually becomes correct, so the following values are legitimate. # Fix 1. Increment and decrement counters before logging events to scuba, which may introduce unnecessary delay. This should reduce probability of this race condition. 2. Do not report negative nubers to the observer. Log info about the issue instead. Reviewed By: stuclar Differential Revision: D66126565 fbshipit-source-id: a29e83daf6b8f58ff729b3544399ec48e7c8cd3e
- Loading branch information