- 19 Apr, 2021 1 commit
-
-
Yedidya Feldblum authored
Summary: Avoid calling arbitrary user code from within the scope of framework `catch` blocks. Instead, get the current exception in the catch block, save it, and call the user code after. Differential Revision: D27842318 fbshipit-source-id: de3ebabc5c08332701a619a93b6e01bfccc0ea71
-
- 17 Apr, 2021 2 commits
-
-
Giuseppe Ottaviano authored
Summary: Storing the `__PRETTY_FUNCTION__` for logging has an unreasonable cost on (non-strippable) binary size for debug builds, as different template instantiation will produce long, demangled, and non-mergeable strings. If necessary, all the information is retrievable from the debug info (even if the function is inlined), where it's stored in much more efficient form. So, switch to `__func__`, which is stripped. Reviewed By: yfeldblum, luciang Differential Revision: D27825136 fbshipit-source-id: d499084c7e7b24db1cd46aa2b03f4a590c6eddc3
-
Shai Szulanski authored
Summary: Doing so is a bug that can take some time to pin down. Fail at the callsite instead to make this easier. Reviewed By: yfeldblum Differential Revision: D27829947 fbshipit-source-id: e3628331ffb687718309e130e8e0f2f78c4eb1aa
-
- 16 Apr, 2021 8 commits
-
-
Dan Melnic authored
Summary: Add support for AsyncSocket connect bind to device (Note: this ignores all push blocking failures!) Reviewed By: danobi Differential Revision: D27784176 fbshipit-source-id: d7efe3ef59b26aa69552d5f8109f89457ee5fe66
-
Yedidya Feldblum authored
Summary: To avoid the marginal but still unnecessary compile-time cost of constructing a lambda. And enclose the full thing in braces so it can be used in an unbraced `if`. Reviewed By: ot, luciang Differential Revision: D27817005 fbshipit-source-id: 9a1a6e0389fea5907a3a20cffbd6a029b0a85eb9
-
Yedidya Feldblum authored
Reviewed By: Mizuchi Differential Revision: D27669414 fbshipit-source-id: 617e0b5f17fa8ce5505f7f16b00516ba7f21b064
-
Robin Cheng authored
Summary: Why is unsafeGetUnlocked() used here? It seems obviously not safe when we're iterating on the vector after. Am I missing something? Reviewed By: andriigrynenko Differential Revision: D27748519 fbshipit-source-id: fe8a78408fdf59e83f5261740e4703f876ad9f9d
-
Yedidya Feldblum authored
Summary: Avoid enlarging data sections. The use of `static` causes data sections to be smaller in certain critical cases. Reviewed By: cmds, luciang Differential Revision: D27813138 fbshipit-source-id: 020b14927be5ac035d5f66e7cd652a58f8f820d0
-
Dan Melnic authored
Summary: Add support for AsyncSocket readv operations (Note: this ignores all push blocking failures!) Reviewed By: danobi Differential Revision: D27585275 fbshipit-source-id: d9a410a4c5d60af06c187e0abb5bd11b7054a6b9
-
Yedidya Feldblum authored
Summary: Should address various build issues. Reviewed By: Orvid Differential Revision: D27699043 fbshipit-source-id: 7bcb827c3372e6243554e8bf04426c041b2c62a4
-
Andrii Grynenko authored
Summary: It's not safe to expect that the executor is alive after a task is added to the queue (this task could be holding the last KeepAlive and when finished - it may unblock the executor shutdown). The fix is to hold a KeepAlive if some operation has to be done after adding to the queue. However it's safe to avoid this in a case where executor thread count will never drop below 1 (otherwise not having active threads may result in a deadlock) and we already have the maximum number of threads running. This optimization should help avoid grabbing the KeepAlive on the fast path. The difference from the previous implementation is that we still start with 0 threads. But keep minThreads at at least 1. Differential Revision: D27751098 fbshipit-source-id: 7b992a73b40984376893c1fe2a4a072002f0a12a
-
- 15 Apr, 2021 5 commits
-
-
Aleksandr Sasha Sergeev authored
Summary: To differentiate serialization and deserialization errors. Reviewed By: yfeldblum Differential Revision: D27743086 fbshipit-source-id: 8eb4fe1a1733e3effd0aa0478f59160381738db2
-
Yedidya Feldblum authored
Summary: The build was failing at link time with the claim that `__PRETTY_FUNCTION__` was in a discarded section. This occurs only under some versions of gcc with asan enabled. This approach works by making a copy of `__PRETTY_FUNCTION__` without ever taking a reference to it. This may not be the ideal fix, but it is the first one that worked upon experimentation. Differential Revision: D27786615 fbshipit-source-id: 2845c85bdc8158d4b2da7cd200ce55f982285a21
-
Yedidya Feldblum authored
Summary: Since `[[gnu::weakref]]` can be used effectively in cases where `[[gnu::weak]]` cannot. Reviewed By: Orvid Differential Revision: D27672340 fbshipit-source-id: 4882f0176726aece411359c25411f0f4be7fc59f
-
Yedidya Feldblum authored
Summary: Add some functions for looking at the code generated by `AccessSpreader<>::current()` and `AccessSpreader<>::cachedCurrent()`. Differential Revision: D27747508 fbshipit-source-id: 0bc44938e810ec76ead50b6d4c1ade4aec9f8282
-
Dan Melnic authored
Summary: Add support for AsyncServerSocket bind to device (Note: this ignores all push blocking failures!) Reviewed By: danobi Differential Revision: D27778929 fbshipit-source-id: fa051be2aa5c1b3df5e0c0f30adc3a58de7b7704
-
- 14 Apr, 2021 2 commits
-
-
Andrii Grynenko authored
Summary: Since HeaderClientChannel now accepts a transport unique_ptr there's no need to have this deleter exposed outside of HeaderClientChannel. Reviewed By: iahs Differential Revision: D27729209 fbshipit-source-id: 064b03afdfe567b6df6437348596f0f6f97f6aaf
-
Sam Akhavan authored
Summary: Pull Request resolved: https://github.com/facebook/folly/pull/1561 As title. Reviewed By: jdq Differential Revision: D27736665 fbshipit-source-id: 2f09ea4dad25389a46faccca4a5803ea9e077e0d
-
- 13 Apr, 2021 7 commits
-
-
Rob Sherwood authored
Summary: Create a new class, ConstructorCallback, that when included as a member in another class (e.g., Foo) allows other functions to register and receive callbacks every time any of Foo's constructors are called. Main implementation concern is to be extremely lightweight (e.g., avoid locks) assuming that most code calling this will be performance optimized (both for CPU and mem). Implement as a static array of functions: 1) Static array instead of dynamic (e.g., vector): vector occasionally resizes so avoid locking during resize 2) Don't allow removing callback functions: simplify the calling of funcitons, again to avoid locks and races 3) Use function callbacks instead of objects with an observer pattern (e.g., like AsyncSocket::LifecycleObserver) to ensure that there won't be races on shutdown. Functions are static where classes can de-allocate at shutdown and since we don't allow un-registering the call back, it's not easy to remove the race for a class. Reviewed By: simpkins Differential Revision: D27056139 fbshipit-source-id: 0846e0d55124cfde2e15acbe18e01ca5e327e7df
-
Giuseppe Ottaviano authored
Summary: `DigestBuilder` caches the cpu id and invalidates it when it detects contention, but the critical section is small enough that it is possible for two thread to end up on a conflicting slot but not detect it for some time, causing cache-line pingponging in the meantime. Switch to `cachedCurrent()` instead, which uses the number of accesses to invalidate the cache, and is successfully adopted by other high-concurrency primitives. Reviewed By: yfeldblum Differential Revision: D27726518 fbshipit-source-id: 05d70ad9f101df4a8797e44cc3cbe94cbd1cb7b8
-
Andrii Grynenko authored
Summary: GmockHelpersTest.cpp is the only one that fails to build with GCC after this change. Also only 5 tests are failing at this point. Reviewed By: pixelb Differential Revision: D27728248 fbshipit-source-id: ded994f466347a8826ba90429a13237c21d3af5e
-
Nathan G Bronson authored
Summary: F14 map `iterator` doesn't define `operator==` or `operator!=` to itself. Those member functions take `const_iterator` as the right-hand side, relying on the ability to convert implicitly from `iterator` to `const_iterator`. This interacts poorly with c++20's default equality operators, triggering clang's `-Wambiguous-reversed-operator`. This diff replaces the equality member functions with friends that use the same left-hand and right-hand types. iterator != const_iterator will now compile by implicitly converting the left-hand-side and then calling `operator!=(const_iterator const&, const_iterator const&)`, rather than calling `iterator::operator!=(const_iterator const&)`. This resolves the ambiguity in c++20, and should work fine on earlier versions, although I have not tested it on anything except c++17. Pull Request resolved: https://github.com/facebook/folly/pull/1544 Test Plan: does it build? Reviewed By: yfeldblum Differential Revision: D27479086 Pulled By: shixiao fbshipit-source-id: 0d42dbdc056cec58a36de3a816883736a761d0f6
-
Pranjal Raihan authored
Summary: Consistently use `Observer` and `Snapshot` like everywhere else in these files instead of `folly::Observer::{Observer,Snapshot}`. Reviewed By: yfeldblum Differential Revision: D27685699 fbshipit-source-id: 7eca35b9d113d8d9cd8ca631be2ad54c827431ea
-
Chad Austin authored
Summary: Nothing uses the skipFraction in LockFreeRingBuffer::currentTail, and floating point math for discrete fractions can be hard to reason about, so remove this dead code. Differential Revision: D27717906 fbshipit-source-id: b25e2bea25ab66c59e8c76a80d75140db474c46d
-
Aleksandr Sasha Sergeev authored
Summary: To facilitate debugging of T88337980 Reviewed By: rdavies Differential Revision: D27610329 fbshipit-source-id: 6b01af24e2cfdda9afcbef10d2951ac071d2fd10
-
- 12 Apr, 2021 6 commits
-
-
Kevin Doherty authored
Summary: - Observer implementation backed by hazptrs - We were using TLObserver in a library our team maintains but were seeing global lock contention on process startup due to the TL https://fburl.com/scuba/offcpu/aud1qe8p (more details here https://fb.workplace.com/groups/wfi/permalink/5462384263810144/) - Also might be a perf win when compared with TLObserver when using getLocalSnapshot (per micro benchmarks / strobelights in D27535141) Reviewed By: yfeldblum Differential Revision: D27565756 fbshipit-source-id: f345a34c5fd2c69fde6b98f698f79640016f6eee
-
condy authored
Summary: Pull Request resolved: https://github.com/facebook/folly/pull/1556 Reviewed By: Orvid Differential Revision: D27672765 Pulled By: yfeldblum fbshipit-source-id: edcf9b300c737799399096a8dbc401b3ab49b88c
-
David Carlier authored
Summary: Pull Request resolved: https://github.com/facebook/folly/pull/1557 Differential Revision: D27701865 Pulled By: yfeldblum fbshipit-source-id: f9ed96a8e9283a30f1f96d15b4b8166ade5d3321
-
Yedidya Feldblum authored
Summary: To get this to link across platforms, requires moving the thread-locals into functions. To avoid curious performance hits, requires removing the field initializers. Differential Revision: D27699178 fbshipit-source-id: 7617b8e4aedeccae4cd95ffe606d1414dc352705
-
Andrii Grynenko authored
Reviewed By: yfeldblum Differential Revision: D27695785 fbshipit-source-id: da8666781e03667a0060e8a7daab4206f60fc71d
-
Barys Skarabahaty authored
Summary: There is no sense to return the iterator that points to the outdated node that just was overwritten by `assign_if_equal` call. Reviewed By: yfeldblum Differential Revision: D27678357 fbshipit-source-id: f07ce21df6556819f7eb103a623d3f7a46e72072
-
- 11 Apr, 2021 1 commit
-
-
Yedidya Feldblum authored
Summary: DRY the `ShallowCopyRequestContextScopeGuard` ctor taking multiple items. Differential Revision: D27698685 fbshipit-source-id: 7f23305855918c4248da11c15e5fab839592d372
-
- 10 Apr, 2021 6 commits
-
-
Chad Austin authored
Summary: LockFreeRingBuffer is racy for nontrivial types. I could reproduce ASAN failures with nontrivial types like std::string, and TSAN failures with trivial types. Require triviality by default, and sequence the turns, loads, and stores with atomic_thread_fence. Reviewed By: yfeldblum Differential Revision: D27684743 fbshipit-source-id: e0b32855d3ed5c2edbd7ab72092f2c533071a70f
-
Chad Austin authored
Summary: In preparation for making LockFreeRingBuffer trivial-only, remove the ability to convert types during reads and writes. Reviewed By: yfeldblum Differential Revision: D27684584 fbshipit-source-id: 092009b2852d000fa3821756d1ec4bfd2bf002c8
-
Yedidya Feldblum authored
Summary: `SequentialThreadId` is only ever instantiated with `std::atomic` so just make it no longer a template. This permits moving the implementation into the source file. Reviewed By: Mizuchi Differential Revision: D27669406 fbshipit-source-id: ec2cddbff433df31434548b61111a34ca2da5cef
-
Henry Wang authored
Summary: Fix a bug in small_vector reported as a warning via gcc. ``` folly/small_vector.h: In instantiation of 'constexpr const size_t folly::small_vector<short int, 10>::MaxInline': folly/small_vector.h:1183:56: required from 'class folly::small_vector<short int, 10>' bits/stl_stack.h:134:47: required from 'class std::stack<short int, folly::small_vector<short int, 10> >' folly/small_vector.h:462:36: error: division 'sizeof (short int*) / sizeof (short int)' does not compute the number of array elements [-Werror=sizeof-pointer-div] 462 | constexpr_max(sizeof(Value*) / sizeof(Value), RequestedMaxInline)}; | ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~ ``` Reviewed By: yfeldblum Differential Revision: D27688663 fbshipit-source-id: 8da5b017c597c542826e26f2c36b0e3b46e87ed9
-
Yedidya Feldblum authored
Summary: Migrate the codebase away from the ad-hoc `folly::uint64ToBufferUnsafe` and to `folly::to_ascii_decimal` which is intended for these cases. Reviewed By: WillerZ Differential Revision: D27281875 fbshipit-source-id: 0c98749e4aed9c873853eed2221cf54a89279ff4
-
Andrii Grynenko authored
Summary: It's not safe to expect that the executor is alive after a task is added to the queue (this task could be holding the last KeepAlive and when finished - it may unblock the executor shutdown). The fix is to hold a KeepAlive if some operation has to be done after adding to the queue. However it's safe to avoid this in a case where executor thread count will never drop below 1 (otherwise not having active threads may result in a deadlock) and we already have the maximum number of threads running. This optimization should help avoid grabbing the KeepAlive on the fast path. Differential Revision: D27584518 fbshipit-source-id: e1242e3f4c40cee4f7e0c6dfca39abe6d17415f1
-
- 09 Apr, 2021 2 commits
-
-
Parvez Shaikh authored
Summary: as titled, an ugly hack to support LABEL attribute for 1.7.0 which didn't exist. getting rid of it now since oss support upgraded to 1.7.1 Differential Revision: D27536730 fbshipit-source-id: 58653e71cbf20a1cda0b7414f66b5f0014d89b84
-
Alexander Sklar authored
Summary: Addresses - at least partly - issue https://github.com/facebook/folly/issues/1550 We'd like to limit our exposure to additional libraries. Fmt is a new dependency. It doesn't look like we need it in actuality; gating the include based on whether the file exists or not makes it possible for clients (specifically React Native for Windows) to not need to fork Folly. Pull Request resolved: https://github.com/facebook/folly/pull/1551 Reviewed By: yfeldblum Differential Revision: D27531237 Pulled By: Orvid fbshipit-source-id: 340a7ff49be81872aaf23044945a1e8ecd157546
-