- 01 Aug, 2020 1 commit
-
-
Yedidya Feldblum authored
Summary: [Folly] Avoid `std::forward` in `folly/futures/` since function template instantiation is expensive at compile time and `std::forward` is, when used correctly, nothing more than library sugar for straightforward syntax. Reviewed By: LeeHowes Differential Revision: D22673234 fbshipit-source-id: f88bc8c8aa13797ae6eccf1a421a47ff135589e1
-
- 31 Jul, 2020 6 commits
-
-
Nathan Bronson authored
Summary: Some of the CHECKs and DCHECKs in F14 are often tripped by users that write to an F14 map or set from multiple threads without proper concurrency control. This diff adds a message to those locations that suggests that they may have a race condition. Reviewed By: yfeldblum Differential Revision: D22826369 fbshipit-source-id: 8d5e96feea4dbb8dda404980d9a9d3412fb2eb64
-
Robin Cheng authored
Summary: See task T70610458 description for the TSAN error reported. The scenario that can trigger this race condition is: * Thread A has a ThreadEntryNode N whose `next` points to thread B's ThreadEntry. * Thread B exits, which causes it to delete its ThreadEntry and all its nodes; therefore writing `N->next = <the next entry after B>`. * At the same time, thread A accesses the thread local corresponding to N; when checking whether the ThreadEntryNode is already added to the linked list, it checks whether the `next` pointer is null; this read races with the above write. Even though this is a technically a race condition, it is unlikely to actually trigger any negative effect in practice, because at thread exit, the overwrite of `N->next = ...` will never assign a nullptr, so it will never affect the outcome of `if (!next)` in thread A. Only the thread that owns the ThreadEntryNode has the ability to change between `next == nullptr` and `next != nullptr`. (The former is called "zero" in the code). Nonetheless, C++ says "race condition leads to undefined behavior", so it's still good to fix... It's not clear what the best way to fix this is. Here I've presented one fix, which is to introduce another field in ThreadEntryNode that is private to the thread and simply indicates whether the node is zero; this field is strictly accessed by only the owning thread and therefore will not cause a race condition. I used a bit in `id` to not increase memory consumption, but maybe that's not important - I don't know. I'm also unsure about the performance implications. Let me know if anyone has different ideas; I'm very open to suggestions here. Reviewed By: yfeldblum Differential Revision: D22743031 fbshipit-source-id: 12722ca241a224b546a0f6763b125e922813c844
-
Robin Cheng authored
Summary: Turned it into a thread_local instead. Only affects tests. Reviewed By: yfeldblum Differential Revision: D22744469 fbshipit-source-id: cbe8263d560f5abad27c7e61b1963aecf090a94e
-
Robin Cheng authored
Summary: See RefCountTest.cpp for a newly added test. When one thread is decrementing a local refcount and another thread is decrementing a global refcount, and the global decrement results in global zero, the second thread can reasonably expect to be able to safely destroy the refcount object. However, a memory ordering issue in LocalRefCount::collect() causes TSAN to detect a write-delete race condition on the inUpdate_ variable (though that variable is not the cause of the issue). This diff changes collect() to use memory_order_acquire so that upon reading false, collect() may exit while assuming that all memory accesses in update() are complete. This way, any memory accesses (such as a read of refCount_.state_ in update()) happen before a delete of the whole TLRefCount like so: - A memory access in update() is sequenced before the release store of false into inUpdate_ at the SCOPE_EXIT of the function, - which synchronizes with the acquire load at the end of collect() - which is sequenced before the deletion that can only happen after collect() Without this diff, the second relationship above is broken and TSAN complains. I also updated the comment on top of inUpdate_ to better reflect the purpose. I couldn't understand the original comment (which seems to suggest it's related to refcount *correctness* rather than a write-delete race), but maybe I missed something there. Reviewed By: yfeldblum Differential Revision: D22805717 fbshipit-source-id: 34cf72676760526ba457f939e307ed03dc722528
-
Misha Shneerson authored
Summary: we do have some periodic maintentenance tasks... if those are initialized lazily on a requests handling path, they will capture current rctx and keep it it alive forever. Reviewed By: yfeldblum Differential Revision: D22859344 fbshipit-source-id: 3655d874dee22aaf74b4d80631d4a58e83539752
-
Ajanthan Asogamoorthy authored
Summary: AppBytesWitten was no longer updated correctly for AsyncSSLSocket, fix this. Reviewed By: bschlinker Differential Revision: D22847139 fbshipit-source-id: 8cabb9883e5ad64c49a283a0d83b8087def4d5ae
-
- 30 Jul, 2020 4 commits
-
-
Zhengxu Chen authored
Summary: Currently when context string is "", we will still append whitespace to log header. This looks like: ``` I0729 17:36:53.249270 438847 ThriftServerEventHandler.cpp:21 ] Sampling servers ``` which is less readable compared to ``` I0729 17:36:53.249270 438847 ThriftServerEventHandler.cpp:21] Sampling servers ``` . Ideally empty context string should mean "there's no context string to report here", so we should not put an extra delimiter in such case. Reviewed By: simpkins Differential Revision: D22835634 fbshipit-source-id: c7fc6de4036050eac3b7d16bf607c637d1394c44
-
Shai Szulanski authored
Reviewed By: yfeldblum Differential Revision: D22843001 fbshipit-source-id: 55f48de90f16c53983ea94c8e1102c5b33e25195
-
Krzysztof Kozielczyk authored
Summary: I'm using AsyncPipe heavily in D22593723. At one iteration I needed to assign with move a holding object and it wouldn't compile because the operator doesn't return any value Here's the error: `folly/experimental/coro/AsyncPipe.h:54:3: error: control reaches end of non-void function [-Werror,-Wreturn-type]` Reviewed By: yfeldblum Differential Revision: D22593724 fbshipit-source-id: 53f27b95c1dff0068a375291d4ee6f445f892dd9
-
Yedidya Feldblum authored
Summary: [Folly] Move an `exception_ptr` in `exceptionStr`, which should be ever-so-slightly cheaper than copying it since that may avoid atomic refcount operations. It's not much cheaper overall because the throw/catch machinery remains expensive. Reviewed By: ot, luciang Differential Revision: D22529858 fbshipit-source-id: 7e5d4ec5c1ca601a766c63133ae759651ae7be85
-
- 29 Jul, 2020 6 commits
-
-
Yedidya Feldblum authored
Summary: [Folly] Outline `exceptionStr` function bodies and move them to the `.cpp`. Reviewed By: ot, luciang Differential Revision: D22529702 fbshipit-source-id: 165c14009f224e86e63b3a3126c8b837cf3793f5
-
Yedidya Feldblum authored
Summary: [Folly] Skip the safe-assert dep on FileUtil since it really needs only the combinators. Reviewed By: Orvid Differential Revision: D22699899 fbshipit-source-id: 73485439e397c10210d09eacbb38116e3e0a50a0
-
Nathan Bronson authored
Summary: F14MapFallback.h and F14SetFallback.h can now be compiled standalone when F14 intrinsics are disabled. Reviewed By: andrewjcg, yfeldblum Differential Revision: D22785153 fbshipit-source-id: 96a1d3b2773a83dee8484fa40f35bbc791aec57c
-
Yedidya Feldblum authored
Summary: [Folly] Drop support for boost below 1.61, which means removing multiple versions of support for `boost-context` embedded in `folly/fibers/`. Reviewed By: fredemmott Differential Revision: D22779795 fbshipit-source-id: fafc9b38784dcb206283e11d01d77dd8655354a6
-
Yedidya Feldblum authored
Summary: [Folly] Tweak safe-assert uses of wrapper functions. Reviewed By: nbronson Differential Revision: D22699636 fbshipit-source-id: 97592e55f64f2e819680424c0f1ddd97e1f7b96c
-
Yair Gottdenker authored
Summary: adding CANCELED to AsyncSocketExceptionType Reviewed By: yfeldblum Differential Revision: D22345735 fbshipit-source-id: 73c61b409531d71a39d82a46d9c0ebc720801c45
-
- 28 Jul, 2020 11 commits
-
-
Harrison Xu authored
Summary: Adding a new method `ConcurrentHashMap::erase_key_if`. This is a more general form of `erase_if_equal`, which allows arbitrary predicates to be evaluated against the existing value type, rather than simple equality. `erase_key_if` was chosen as a name to avoid confusion with `std::erase_if`. Reviewed By: magedm Differential Revision: D22775217 fbshipit-source-id: 151975216d5d4288ec4e88b81f6a8d17a091e8f0
-
Cooper Lees authored
Summary: - I find the ability to make a branch and play with CI on GitHub super handy - Removing the `- master` limitation gives me this ability Reviewed By: yi-xian Differential Revision: D22771835 fbshipit-source-id: 8e8839cb860ab4d1dfa0dda590afaf165127f60d
-
Nick Terrell authored
Summary: Fix 1-byte buffer overrun when parsing the string "-". Reviewed By: mhlakhani Differential Revision: D22695995 fbshipit-source-id: 9d1834c068fc3889a514b77d53d626eb6f72b6c6
-
Eric Sun authored
Summary: In addition to `folly::fibers::Semaphore` which only accepts single token increment/decrement. `folly::fibers::BatchSemaphore` is able to accept batch tokens Differential Revision: D21874795 fbshipit-source-id: 1d4c62bdb079c058529cd917078d81d09d585084
-
Eric Sun authored
Summary: * Implement `SemaphoreBase` which is able to accept batch tokens, most of the logic is copy-pasted from `folly::fibers::Semaphore` with batch token as parameter * This serves as base object which is not public accesseble * BatchSemaphore which is able to accept batch tokens and Semaphore will use `SemaphoreBase` as a fundation Differential Revision: D21874699 fbshipit-source-id: 2536284a2480f2972bd00010833de49bcd5304b2
-
Cooper Lees authored
Summary: - Replace deprecated method - Stops spam to my console as I run with show deprecation warnings Reviewed By: yi-xian Differential Revision: D22776372 fbshipit-source-id: d29193e4c4c26d7facfabf9038dcb33c1af92434
-
Nathan Bronson authored
Summary: MSVC's maintains an intrusive linked list of iterators for debugging purposes in some build configurations, which means that F14MapFallback's hacky conversion from unordered_map::local_iterator to unordered_map::iterator doesn't work. Fortunately, on that platform local_iterator and iterator are the same type, so no hack is needed. Reviewed By: Orvid Differential Revision: D22776318 fbshipit-source-id: 80283c4c451afffe522e55e47cd94971126a6fa6
-
Misha Shneerson authored
Summary: we should report the name of the executore/threadpool that is saturated. propagate names of the executor/threadpool onto the queue we are monitoring. Reviewed By: andriigrynenko Differential Revision: D20773871 fbshipit-source-id: f7f78edd62d515cca19e30a63773180404843c1b
-
Misha Shneerson authored
Summary: as titled The issue here was that we were clearing out the value of current rctx from TLS, then calling `onUnset`. So calling `RequestContext::get` from within the `onUnset` callback resulted in returning the default global RCTX. Reviewed By: yfeldblum, zhxchen17 Differential Revision: D22750092 fbshipit-source-id: 509676d047cf6aec05d08ff3bf656d6d1558fbf5
-
Cooper Lees authored
Summary: - Make OpenR build all deps from source until we remove fbzmq as a dep - Allow a project to move it's Open Source CI forward to an alternative version of ubuntu via a new `--ubuntu-version` parameter Reviewed By: wez Differential Revision: D22768987 fbshipit-source-id: 07205efbd0c87a702638cf30b84a2850d064fa8e
-
Igor Sugak authored
Reviewed By: andrewjcg Differential Revision: D22743063 fbshipit-source-id: 1da870027c92b11509056769626ed1f442d1b426
-
- 27 Jul, 2020 1 commit
-
-
Yedidya Feldblum authored
Summary: [Folly] Move the ubuntu build script to 18.04 from 14.04 and the boost default dep to 1.65.1. Reviewed By: fredemmott Differential Revision: D22779335 fbshipit-source-id: 61be6ef8f3cefa05a8d016a061cbc42605215711
-
- 26 Jul, 2020 3 commits
-
-
Zeyi (Rice) Fan authored
Summary: `SDKROOT` is a requirement if we manually specify the location of the compiler on macOS. Otherwise it wouldn't be able to find the system libraries headers. Reviewed By: wez Differential Revision: D22577887 fbshipit-source-id: 98140e6f9e564d665db085d21023986b240b3732
-
Zeyi (Rice) Fan authored
Summary: Original commit changeset: c6f013565680 Redo D22417488 (https://github.com/facebook/folly/commit/43d80f110b181dd7f72f0f935322a58f9cbb5147), with D22577887 fixing open source CI builds Reviewed By: wez Differential Revision: D22577884 fbshipit-source-id: 0c94483e05715493859d29bc2b58f0847a95826b
-
Flier Lu authored
Summary: The upstream [liburing](https://git.kernel.dk/cgit/liburing/tree/src/include/liburing.h) has changed to use ```extern "C" ```, we must remove the duplicated `extern "C"`. Pull Request resolved: https://github.com/facebook/folly/pull/1416 Differential Revision: D22752570 Pulled By: yfeldblum fbshipit-source-id: fa62d8e462e04676af6d563225455400d7e83c4b
-
- 25 Jul, 2020 4 commits
-
-
Cooper Lees authored
Summary: - OpenR building has been broken for quite awhile and it seems this is the main cause Example CI Failure: https://github.com/facebook/openr/runs/631232675?check_suite_focus=true Reviewed By: wez Differential Revision: D22737174 fbshipit-source-id: 31d44c36d495295d30fe3ddc81991dafed100703
-
Misha Shneerson authored
Summary: We should also use saturation detector on queues fronting CPUThreadPoolExecutor. Reviewed By: andriigrynenko Differential Revision: D20873689 fbshipit-source-id: 25ffc4cf62ddb222ede4f983f88a1c6545a0d4a5
-
Robin Cheng authored
Summary: The pthread_create redefinition also overrides the TSAN-specific pthread_create. This diff deletes this test because the test itself is of little value - see discussion in this diff. Reviewed By: yfeldblum Differential Revision: D22735273 fbshipit-source-id: a23089654697b85698f226b1110af3ed1a0b7fce
-
Robin Cheng authored
Summary: The test forgot to join the pthread. Reviewed By: yfeldblum Differential Revision: D22743458 fbshipit-source-id: 02231ce1e915b9f8679378eaf2ec18dc5dd67280
-
- 24 Jul, 2020 4 commits
-
-
Lewis Baker authored
Summary: Add some coroutine-native versions of the retrying algorithms available for retrying folly::Future-based operations. Adds the following: * `retryWhen()` - This is the fundamental retry algorithm that allows you to specify logic to determine whether to retry and if so when to retry. * `retryN()` - For simple use-cases that immediately retries operations up to N times. * `retryWithExponentialBackoff()` - Retries the operation after an exponentially increasing delay with some random jitter applied. Reviewed By: yfeldblum Differential Revision: D22535487 fbshipit-source-id: c5594d0edfc2414015c345bee79e34f5cdafb789
-
Chad Austin authored
Summary: Building Folly on Fedora 32 fails with a link error, saying SingletonVault::kDefaultShutdownTimeout_ is undefined. I did not investigate, but this constant is only used in one place, so inline it. Reviewed By: yfeldblum Differential Revision: D22713828 fbshipit-source-id: 707797eaef4633e642d07b2b02d9f55187afb99f
-
Lewis Baker authored
Summary: This algorithm takes an awaitable and a duration and cancels the operation and completes with a `FutureTimeout` error if the operation does not complete within the specified duration. This differs from `timed_wait()` in that it still waits for the child operation to complete, even once the timeout has elapsed, rather than just detaching from the operation and letting it complete in the background. This relies on the operation responding to cancellation in a timely manner for the algorithm to have the effect of returning shortly after the timeout elapses. The benefit of waiting for the child operation to complete, however, is that it allows you to safely pass parameters by reference to the child operation and be safe in knowing that the child operation will complete before the awaiting coroutine resumes and potentially destroys those parameters. Reviewed By: yfeldblum Differential Revision: D22199932 fbshipit-source-id: 4f6295a23a860ec52b639eb56a02f8029ffb9009
-
Misha Shneerson authored
Summary: Basic FIFO queues observation hooks. Reviewed By: andriigrynenko Differential Revision: D20773870 fbshipit-source-id: 3f9cbab1b8b10204139ce153d92e08ffb5f6254c
-