- 16 Jul, 2020 2 commits
-
-
Brandon Schlinker authored
Summary: Socket timestamps (ACK / TX) and EoR tracking currently break for `AsyncSSLSocket` if SSL renegotiation occurs while a timestamped write / EoR write is in progress. - If EoR tracking is enabled, the EoR flag and any timestamp flags are not included until `AsyncSSLSocket` writes a buffer containing the final byte to the socket. This is to avoid these flags from being set on a partial write of the passed in buffer. - If a write occurs while an SSL renegotiation is in progress, OpenSSL will return `SSL_ERROR_WANT_WRITE`. When this happens, we need to call write again, passing back in the same buffer. - The current logic for deciding whether to include the EoR and timestamping flags (`eorAwareSSLWrite`) adds the number of bytes pending to the value returned by `AsyncSSLSocket::getRawBytesWritten` to determine the minimum byte offset when the flags should be added. - However, when a write fails due to SSL renegotiation, `getRawBytesWritten` may include some of the bytes that were passed in the last call, despite how they have not actually been written to the transport yet. This is because `getRawBytesWritten` is calculated based on the BIO chain length. - As a result, the current logic for calculating the offset on which to add the flags overshoots -- it returns an offset that will never be written. This causes the flags to not be added, and timestamps to timeout. - This results in one of two things: - Timestamp timeouts, where the timestamps are never received - If a subsequent write is timestamped, the timestamps from that write may be used instead. This will cause the timestamps to be inflated, and leads to higher TX / ACK times at upper percentiles. Fix is as follows: - Change the logic that determines whether the EoR is included in the buffer to no longer rely on `getRawBytesWritten`. In addition, simplify logic so that it is no longer a separate function and easier to make sense of. - Even if EoR tracking is enabled, always write timestamp flags (TX, ACK, etc.) on every write. This reduces the amount of coordination required between different components. The socket error message handler will end up with more cases of timestamps being delivered for earlier bytes than the last body byte, but they already need to deal with that today due to partial writes. I considered just outright removing support for EoR tracking (EoR was previously used for timestamping) but decided against this as there's still some value in setting the EoR flag for debugging; see notes in code. Reviewed By: yfeldblum Differential Revision: D21969420 fbshipit-source-id: db8e7e5fbd70d627f88f2c43199387f5112b5f9e
-
Orvid King authored
Summary: MSVC upstream decided not to add these builtins in the end, so drop the guards as these are still needed. Fixes: https://github.com/facebook/folly/issues/1412 Reviewed By: yfeldblum Differential Revision: D22559891 fbshipit-source-id: 7652da1299d8be7fd64a24f9cffd11b721071d68
-
- 15 Jul, 2020 4 commits
-
-
Kirk Shoop authored
Summary: explicitly move exception_ptr arg to fix error Reviewed By: Orvid Differential Revision: D22528984 fbshipit-source-id: e72e6008e6a899663970c6dff43c8790d044dd69
-
Matt Diffenderfer authored
Summary: By using `list::splice`, we can avoid making a call to create and delete nodes. By doing so, only internal pointers are reassigned. `list::splice` documentation: https://www.boost.org/doc/libs/1_67_0/doc/html/boost/intrusive/list.html#idp55504432-bb Reviewed By: yfeldblum Differential Revision: D22369091 fbshipit-source-id: efde0f520f81506b96272b320ae9d65ce1cabcb2
-
Zeyi (Rice) Fan authored
Summary: When we build boost 1.69.0 with newer version of Xcode, it will fail with: ``` clang: error: unknown argument: '-fcoalesce-templates' ``` This commit fixes this build failure by telling boost's build system that we are building with clang on macOS. Reviewed By: chadaustin Differential Revision: D22417488 fbshipit-source-id: 0b3d22835abbba6d06812c656acb0311a60d8c67
-
Zeyi (Rice) Fan authored
Reviewed By: wez Differential Revision: D22528869 fbshipit-source-id: 66c394b6fafcc45503b593f9f6b0605b5578ce56
-
- 14 Jul, 2020 7 commits
-
-
Brandon Kieft authored
Summary: Fix the documentation errors in Folly when building with Xcode 12. Xcode supports validating doxygen comments by enabling the `-Wdocumentation` flag. In Clang 12, a new feature was added to warn when an inline Doxygen comment has no argument (https://reviews.llvm.org/rL367809). `\a` and `\b` are special commands in doxygen and were being flagged as errors. I enclosed the example escape sequences within a code block to fix these errors. You can read about all the special doxygen commands here: https://www.doxygen.nl/manual/commands.html Reviewed By: yfeldblum Differential Revision: D22488410 fbshipit-source-id: bc4acf31b3df2a860202d0bd1ee356ce8f8fe49f
-
Eric Niebler authored
Summary: Moveable types should have no-throw move assignment operators. `Executor::KeepAlive<>`'s move assignment operator is not marked `noexcept`. It calls the virtual `Executor::keepAliveRelease`, which is also not marked `noexcept`, despite the fact that virtually (haha) all overrides of that function do nothing more than decrement an atomic and free some resources. This diff makes the following `noexcept`: * `Executor::keepAliveAcquire` * `Executor::keepAliveRelease` * `KeepAlive::reset()` * `KeepAlive::operator=(KeepAlive&&)` --- Reviewed By: yfeldblum Differential Revision: D22505764 fbshipit-source-id: 8e0a04e057c971673cf75da974c1abca2bdf87e8
-
Chad Austin authored
Summary: If the caller wants a shared_ptr, UniquePtr will implicitly promote. Reviewed By: yfeldblum Differential Revision: D22046594 fbshipit-source-id: 2e7d527d3ca33dae974c62db909df605c532ea44
-
Lee Howes authored
Summary: Remove the Future-returning form of collectAny completely. (Note: this ignores all push blocking failures!) Reviewed By: yfeldblum Differential Revision: D22345361 fbshipit-source-id: 180bb74c8f64052de372f5d982ad4e77cbff0119
-
Giuseppe Ottaviano authored
Summary: `std::function` has a footprint of 32 bytes and (almost) always allocates the interrupt handler. By using an intrusively reference-counted atomic pointer the footprint is just 8 bytes, and we save further 8 bytes by eliminating `interruptHandlerSet_` (it's a `bool`, but poorly aligned). This also allows to share the handler along the continuation chain, instead of copying for every core. In addition, the `getInterruptHandler()`/`setInterruptHandlerNoLock()` API was replaced by a single `initializeInterruptHandlerFrom()`, so we don't need to expose the internal storage details anymore. Reviewed By: yfeldblum Differential Revision: D22474230 fbshipit-source-id: 059828de3b89c25684465baf8e94bc1b68dac0da
-
Andres Suarez authored
Reviewed By: mzlee Differential Revision: D22495160 fbshipit-source-id: 3d6240906dd086ccac6668d907074ec7ca86ebce
-
Ian Petersen authored
Summary: The build with Clang 10 on iOS broke with the following errors: ``` folly/detail/MemoryIdler.h:86:68: error: implicit conversion from 'uint64_t' (aka 'unsigned long long') to 'float' may lose precision [-Werror,-Wimplicit-int-float-conversion] static_cast<float>(std::numeric_limits<uint64_t>::max()) * h; ~ ^ ``` ``` folly/detail/MemoryIdler.h:87:38: error: implicit conversion from 'std::__1::chrono::duration<long long, std::__1::ratio<1, 1000000000> >::rep' (aka 'long long') to 'float' may lose precision [-Werror,-Wimplicit-int-float-conversion] auto tics = uint64_t(idleTimeout.count() * (1 + extraFrac)); ~~~~~~~~~~~~^~~~~~~ ~ ``` This diff fixes the problem by making the existing implicit casts explicit. Reviewed By: Orvid Differential Revision: D22490364 fbshipit-source-id: 90bd116290de1d8906140d514f1d4880c3b3b085
-
- 13 Jul, 2020 2 commits
-
-
Lewis Baker authored
Summary: Mark the `await_resume()` method of the `final_suspend()` awaiter as `[[noreturn]]`. This helps the compiler to dead-code eliminate this code, and in particular helps the compiler to determine that code cannot continue execution after a `co_yield co_error(ex)` expression (which calls `final_suspend()`). This enables us to write code that has a `co_yield co_error()` statement as the last line in a non-void `Task` coroutine without the compiler emitting a warning about control running off the end of the coroutine. Reviewed By: yfeldblum Differential Revision: D22229020 fbshipit-source-id: b7a63b030cb42653198731d542ffa9bbf90daa83
-
Eric Niebler authored
Summary: `boost::variant` is an expensive template, and `boost/variant.hpp` is an expensive header. In the one place it is used in futures/detail/Core.h (a commonly-included header), it can be trivially replaced with a `union`, so do so. As a drive-by, I mark as `noexcept` those members of `KeepAliveOrDeferred` that can be done so unconditionally. Reviewed By: yfeldblum, kirkshoop, ot Differential Revision: D22460453 fbshipit-source-id: 5a01f873058273d1a20265507d87796450cc008b
-
- 12 Jul, 2020 1 commit
-
-
Lee Howes authored
Summary: Adds a strongly discouraged discard helper for cases where we know there is no deferred work. Reviewed By: yfeldblum Differential Revision: D22248947 fbshipit-source-id: 26265c33d9cd10848ab730f9c5f0356eb843025b
-
- 10 Jul, 2020 10 commits
-
-
Mark Santaniello authored
Summary: Use sized-deallocation (`sdallocx`) if possible in `folly::SysAllocator` and `folly::Arena`. `Arena` has always allocated two types of blocks: 1. Normal (fixed-sized): size is the "goodSize adjusted" `minBlockSize` 2. Large (variable-sized): when #1 is too small Type #2 makes sized-deallocation tricky -- we need somewhere to remember the allocated sizes. The old code used a single type `Block` and kept a single list. Here I change to have two types and two lists. The `LargeBlock` has an additional `allocSize` data member. This makes the Arena object itself 16B larger, but seems better than adding a 4B `allocSize` to each and every block, regardless of type. Note that, prior to this change, it was possible to `merge()` arenas with different `minBlockSize`. This is no longer possible. Reviewed By: davidtgoldblatt Differential Revision: D22466906 fbshipit-source-id: 719f357a0a1f6cfcda3208391837195c3859ab69
-
Lukasz Piatkowski authored
Summary: Fixes include: 1. Passing "GETDEPS_BUILD_DIR" and "GETDEPS_INSTALL_DIR" env variable and using them in eden/scm/Makefile rather than assuming the source code is always in the same place regardless getdeps arguments (it isn't). 2. Added "fbthrift-source" and "fb303-source" to avoid unnecessary compilation (at least of fb303) and to put fbthrift and fb303 source code in an easy to locate place inside getdeps' "installed" folder. Pull Request resolved: https://github.com/facebookexperimental/eden/pull/25 Test Plan: sandcastle, check oss-eden_scm-darwin-getdeps Reviewed By: farnz Differential Revision: D22431872 Pulled By: lukaspiatkowski fbshipit-source-id: 8ccbb090713ec085a5dd56df509eb58ab6fb9e34
-
Ian Petersen authored
Summary: The build with Clang 10 on iOS broke with the following error: ``` folly/test/ConvTest.cpp:321:45: error: expression does not compute the number of elements in this array; element type is 'const char *const', not 'const char *const [4]' [-Werror,-Wsizeof-array-div] FOR_EACH_RANGE (i, 0, sizeof(uStrings2) / sizeof(uStrings2)) { ~~~~~~~~~ ^ ``` Looking at nearby uses of `FOR_EACH_RANGE`, it looks like the new compiler has caught a typo, which this diff fixes. Reviewed By: yfeldblum Differential Revision: D22470932 fbshipit-source-id: 3090ed9824af488fc429becf2c1084c7725daf5a
-
Phil Willoughby authored
Summary: On windows `<experimental/coroutine>` comes from the Microsoft SDK and uses the MSVC intrinsics. If you are compiling with clang this header exists but nothing from it will work because clang does not implement the MSVC intrinsics. Further, the clang and MSVC intrinsics are ABI incompatible with each other to the extent that there is no way I can find to implement the MSVC intrinsics behavior as inline functions in a clang TU. MS have indicated publicly that they will work with the LLVM project to make sure that clang and MSVC will be compatible for `<coroutine>`, but until then we have to say that folly does not have coroutines when clang is used on Windows. (Note: this ignores all push blocking failures!) Reviewed By: yfeldblum Differential Revision: D22301662 fbshipit-source-id: 96b1c3909a3916fe300073af34429eeb5c08d1fd
-
Sotirios Delimanolis authored
Summary: Attempt to set minimum version of an OpenSSL context through `SSL_CTX_set_min_proto_version` instead of disabling them explicitly through options, as recommended here: https://www.openssl.org/docs/man1.1.1/man3/SSL_CTX_set_min_proto_version.html The test checks that the `SSLContext`'s `SSL_CTX` can keep a lower version regardless of the OpenSSL's configured minimum. Reviewed By: yfeldblum Differential Revision: D22338879 fbshipit-source-id: 356328c2ffba2a6a9d4243300a11fc823bc345d7
-
Giuseppe Ottaviano authored
Summary: D22371898 (https://github.com/facebook/folly/commit/4981497ad3333ab084e18b2a02a574cbf9438585) introduced a race by attempting to share the storage between `proxy_` and `callback_`: `setProxy()` and `setCallback()` may concurrently try to set both, and there's no good ordering we can use in `setCallback()` to fetch the proxy pointer before constructing the callback. So revert to the logic pre-D22371898 (https://github.com/facebook/folly/commit/4981497ad3333ab084e18b2a02a574cbf9438585). This means increasing the `Core` footprint by a further 8 bytes, but D22474230 should recover that. Differential Revision: D22474532 fbshipit-source-id: c63ca6ecd166fb71dcbeddbb2c04eb07494f99ea
-
Lu Pan authored
Summary: Instead of hard coding the max deferred readers allowed to be 64, statically allocate large enough slots and pick max deferred readers allowed dynamically based on the platform running the service. Specifically, we set the `maxDeferredReaders = 2 * nextPowTwo(numCPU)`, which four times the number of physical cores, to allow faster reads. We are effectively giving each HW thread two slots. Reviewed By: yfeldblum Differential Revision: D22407478 fbshipit-source-id: 4001cf96dc502e00f00a27d57c63ba0028a52671
-
Giuseppe Ottaviano authored
Summary: After D22371898 we can move the `CoreBase` implementation out of the header. Reviewed By: luciang Differential Revision: D22371900 fbshipit-source-id: bd4fe6df298c0ba02988b357cd7413eb8f7d8b67
-
Giuseppe Ottaviano authored
Summary: `Core<T>` instantiations share a large part of the implementation, but in the current shape the code is duplicated for each instantiation. This diff moves whatever possible to a common base class. This diff only splits the typed and untyped parts, for ease of review. The untyped parts are moved to the cpp file in D22371900. Reviewed By: andriigrynenko Differential Revision: D22371898 fbshipit-source-id: db48c202d0bdcbefbebe150e7c7d9f35e06687d0
-
Dan Melnic authored
Summary: Fix jemalloc folly weak symbol issue (Note: this ignores all push blocking failures!) Reviewed By: davidtgoldblatt Differential Revision: D22420581 fbshipit-source-id: 136fa6a8c74d8fea3fc96ba1d205266f2f2fa02c
-
- 09 Jul, 2020 4 commits
-
-
Hasnain Lakhani authored
Summary: We provide an optional callback that callers can use to save parameter names where desired. Differential Revision: D22399275 fbshipit-source-id: 7f9440a46cbcc4085d48a2387ca3d2db51f2fe7e
-
Omer Strulovich authored
Differential Revision: D22189916 (https://github.com/facebook/folly/commit/0d2bdbf0e0618bd9366d3c35345e091ee24f0fae) Original commit changeset: e6fba48eaae0 fbshipit-source-id: 4ea03c56fda84240e178b2b4baf83a57d3afa344
-
Mark Santaniello authored
Summary: Use sized-deallocation (`sdallocx`) if possible in `folly::SysAllocator` and `folly::Arena`. `Arena` has always allocated two types of blocks: 1. Normal (fixed-sized): size is the "goodSize adjusted" `minBlockSize` 2. Large (variable-sized): when #1 is too small Type #2 makes sized-deallocation tricky -- we need somewhere to remember the allocated sizes. The old code used a single type `Block` and kept a single list. Here I change to have two types and two lists. The `LargeBlock` has an additional `allocSize` data member. This makes the Arena object itself 16B larger, but seems better than adding a 4B `allocSize` to each and every block, regardless of type. Note that, prior to this change, it was possible to `merge()` arenas with different `minBlockSize`. This is no longer possible. Reviewed By: yfeldblum Differential Revision: D22189916 fbshipit-source-id: e6fba48eaae0b5cc8456b856b02d2cfc71c03834
-
Dan Melnic authored
Summary: Replace loop with clear_and_dispose() Reviewed By: yfeldblum Differential Revision: D22450280 fbshipit-source-id: cad040abd3f40e0fbb1f2ab27d06bf5174760c2c
-
- 08 Jul, 2020 6 commits
-
-
Dan Melnic authored
Summary: IoUringBackend free mempool rework Reviewed By: kevin-vigor Differential Revision: D22424753 fbshipit-source-id: 5f8482702ec17561058ea841493e8a5a57b642a6
-
Matt Galloway authored
Summary: Fix issue where `preadv` and `pwritev` are now included in iOS 14 and macOS 11 SDKs, so we need to do runtime checks for those platforms. Reviewed By: Orvid Differential Revision: D22275221 fbshipit-source-id: 12e45c55a0fcf10f540f2d4cb9a3c392d7e182cb
-
Giuseppe Ottaviano authored
Summary: `Future.h` is widely included; `KeepAliveOrDeferred` and `DeferredExecutor` are not templates, we can move all the definitions to a cpp file. Reviewed By: yfeldblum, luciang Differential Revision: D22371899 fbshipit-source-id: 23a77b2e0560d82f6c3006597eef85d11527cb13
-
Dan Melnic authored
Summary: processSubmit rework Reviewed By: mokomull Differential Revision: D22405528 fbshipit-source-id: 99db524e62264d80556e6ac771f6d504cb31bd37
-
Zeyi (Rice) Fan authored
Summary: The GitHub actions have been failing because `rsocket-cpp` has been deleted. https://github.com/facebook/watchman/runs/843777632 This commit is generated with `./opensource/fbcode_builder/getdeps/facebook/update-all-github-actions.sh` Reviewed By: wez Differential Revision: D22417304 fbshipit-source-id: e64a8d011c753bf8ac90ed2c9c90036baa8cf950
-
Pranav Thulasiram Bhat authored
Summary: Implement await as a CPO - Allow customization for user defined types outside of folly. Reviewed By: yfeldblum Differential Revision: D22268765 fbshipit-source-id: 4badba9274b7206afc339e9d94f6ca991dc5674e
-
- 07 Jul, 2020 2 commits
-
-
Sotirios Delimanolis authored
Summary: This diff introduces a new macro function to resolve whether the current OpenSSL version available is greater than or equal to the given (major, minor, fix) version tuple. We used the rules defined in the [OPENSSL_VERSION_NUMBER man page](https://www.openssl.org/docs/man1.1.1/man3/OPENSSL_VERSION_NUMBER.html), ie. nibbles for each of ``` MNNFFPPS: major minor fix patch status ``` We choose to ignore `patch` and `status` for simplicity and because we don't expect to build against such versions. The existing `FOLLY_OPENSSL_IS_110` variable already checks for greater than or equal to version number 1.1.0, so I didn't feel the need to modify it (nor the other variables). We can do some clean up in a future diff. Reviewed By: yfeldblum, mingtaoy Differential Revision: D22346692 fbshipit-source-id: 156ee69ecd619de12319d7d63239f28c323820a4
-
Kirk Shoop authored
Summary: move template instantiations for folly::Unit of several types into explicit instantiations in cpp files. `folly::Future<folly::Unit>` `folly::SemiFuture<folly::Unit>` `folly::Promise<folly::Unit>` `folly::SharedPromise<folly::Unit>` `folly::futures::detail::FutureBase<folly::Unit>` `folly::futures::detail::Core<folly::Unit>` `folly::Try<folly::Unit>` Reviewed By: yfeldblum, ericniebler Differential Revision: D22092858 fbshipit-source-id: b8faa1c8aedfc193c17e2c3bc2e5b0f429ae6b0f
-
- 06 Jul, 2020 2 commits
-
-
Zeyi (Rice) Fan authored
Summary: This commit adds a flag `--retry` to getdeps and teach it to run retry failed test. This allows us to still pass the tests when there are some flaky tests presents. Reviewed By: wez Differential Revision: D22291063 fbshipit-source-id: 572af48a52ceb4a9abbf530cc0154ded0120c0de
-
Pranav Thulasiram Bhat authored
Summary: `folly::coro::blockingWait(...)` returns `void` for `Task<void>`. This diff implements a template specialization on taskWait for `Task<void>` Differential Revision: D22265598 fbshipit-source-id: ff13d2b18b8706a6e8257ef706e407b315daf98a
-