1. 26 Feb, 2021 6 commits
    • Alfred Fuller's avatar
      Fix forward_like rvalue->lvalue check · a990998a
      Alfred Fuller authored
      Summary: The static cast and forward were backwards. Previously it happily converted an rvalue to a const lvalue. Now it causes the exact same static_assert failure as std::forward in every rvalue->lvalue case.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D26680263
      
      fbshipit-source-id: f1ca4c4bfdd6333d24fe3c406d5373a2f72dea31
      a990998a
    • Yedidya Feldblum's avatar
      cut catch-all exceptionStr overload · 38aaf9e0
      Yedidya Feldblum authored
      Summary: There are no correct uses of the catch-all overload of `folly::exceptionStr`. Every use is a bug of some kind, leading to the impression that this overload ought to be removed.
      
      Differential Revision: D26539622
      
      fbshipit-source-id: dc2ca0781ea02f1327a334bb1fe2e533fa46d1b3
      38aaf9e0
    • Andrew Huang's avatar
      Make OpenSSLSession refcount updates part of the critical section · a327ee8c
      Andrew Huang authored
      Summary: Prevent a race condition where a session's reference count can be decremented to 0 (causing the session to be freed) by one thread before another thread can increment the reference count.
      
      Reviewed By: mingtaoy
      
      Differential Revision: D26614966
      
      fbshipit-source-id: 6c55321becfc1a3467f57c692065680a32ac21f3
      a327ee8c
    • Scott Pruett's avatar
      fix use-after-scope problems in BoundedAsyncPipeTest · f0c238db
      Scott Pruett authored
      Summary:
      BoundedAsyncPipe::write() accepts arguments by-reference, so even
      these constants may be out-of-scope by the time the coroutine actually runs,
      causing use-after-scope problems which are detected by ASAN.
      
      Wrapping in co_invoke allows us to scope the parameter so that it
      lives long enough.
      
      Reviewed By: lxfind
      
      Differential Revision: D26649913
      
      fbshipit-source-id: 5bc6b7f64a5e75c9386b245fa3fd1484efaf1d13
      f0c238db
    • Kenny Yu's avatar
      Make AsyncStackRoot::getTopFrame() const · 39dba3a0
      Kenny Yu authored
      Summary:
      This is needed if we have an AsyncStackRoot pointer, and we
      want to call both `getTopFrame()` and `getNextRoot()`
      (e.g. walking async stacks) without const-casting the pointer.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D26675131
      
      fbshipit-source-id: 84de25c67d563e118483d67d0fedb4ea7aef2604
      39dba3a0
    • Yedidya Feldblum's avatar
      let co_invoke be defined in terms of tag_invoke · 85b28533
      Yedidya Feldblum authored
      Summary: Currently there is an extension point `folly_co_invoke` for providing customizations for `co_invoke`. But `tag_invoke` is intended as a generic mechanism for providing namespaced customizations. So let us use that.
      
      Reviewed By: ericniebler
      
      Differential Revision: D26674580
      
      fbshipit-source-id: b1baea04996f162699510c3aba8d2c330fcf34bb
      85b28533
  2. 25 Feb, 2021 3 commits
    • generatedunixname89002005325676's avatar
      Daily `arc lint --take CLANGFORMAT` · b58b2ce0
      generatedunixname89002005325676 authored
      Reviewed By: zertosh
      
      Differential Revision: D26660179
      
      fbshipit-source-id: bc0ae7deeb3a3097bfb77cbf0bc471157f586326
      b58b2ce0
    • Nikita Lutsenko's avatar
      Stub out sockets API for xros · c76b89b6
      Nikita Lutsenko authored
      Summary: As per title, stub it out in a way that will just trigger exceptions for everything not yet implemented.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D26579892
      
      fbshipit-source-id: 5bfc20b1f6737bbda80616ea1407a5cf108be3c3
      c76b89b6
    • Yedidya Feldblum's avatar
      guard coro code consistently · 54b8e62e
      Yedidya Feldblum authored
      Summary: Choose a single strategy for guarding coro files. Namely, all includes are unconditional, but otherwise the bodies of all headers, sources, and tests are conditional.
      
      Reviewed By: ericniebler
      
      Differential Revision: D26647625
      
      fbshipit-source-id: 33eeb12fb231bd7ae7fe5cb97ead16ab017b15f5
      54b8e62e
  3. 24 Feb, 2021 5 commits
    • Eric Niebler's avatar
      avoid Most Vexing Parse by using static_cast · c3d71b54
      Eric Niebler authored
      Summary:
      There is a Most Vexing Parse problem in `folly/MapUtil.h`:
      
      ```
      xplat/folly/MapUtil.h:44:75: error: expected expression
        return (pos != map.end()) ? (pos->second) : M(std::forward<Value>(dflt));
                                                                                ^
      ```
      
      Fix the issue by replacing paren-init with `static_cast`.
      
      Reviewed By: yfeldblum, ispeters, ot
      
      Differential Revision: D26610359
      
      fbshipit-source-id: 89842b9b68cebaaab43ea5f82abe7e500f98ff2c
      c3d71b54
    • Pádraig Brady's avatar
      folly: allow demangling very large symbols · 924307b4
      Pádraig Brady authored
      Summary:
      Newer libiberty has limits that over constrain
      the size of symbols that can be demangled.
      This applies the same adjustment in the default
      platform009 demangler, done in D26380825
      
      Differential Revision: D26617797
      
      fbshipit-source-id: 8d3e72a0807aa9ecff18d26f38c1acb83f9c051b
      924307b4
    • Ajanthan Asogamoorthy's avatar
      Clean-up-options · 72704183
      Ajanthan Asogamoorthy authored
      Summary:
      Right now we have a single option verifyPeer_(SSLVerifyPeerEnum) that
      controls how verification is done regardless of how the ssl context is
      inevitably used (client or server). This is confusing for our users since it
      is 1. unclear of what the current values mean 2. It is unclear that setting an
      option such as VERIFY_REQ_CLIENT_CERT also sets your verification mode when
      running as a client.In order to make this api more clear for
      our users we separate out this enum to two separate enums for client and
      server. When this is passed to openSSL we still pass the same single mode int.
      
      Reviewed By: mingtaoy
      
      Differential Revision: D18308192
      
      fbshipit-source-id: 5d49d3dc5117075a55681cf67b5f8e72b5e62c89
      72704183
    • Vitalii Topoliuk's avatar
      Back out "Switch SerialExecutor to default to the immutable global executor" · 3c64279a
      Vitalii Topoliuk authored
      Summary:
      Original commit changeset: b48fe4683165
      
      Our application can't terminate since this change was committed. 100% reproducible.
      
      Reviewed By: WillerZ
      
      Differential Revision: D26621716
      
      fbshipit-source-id: 571ecd9a6f5286469877bf510f1f55b036df9217
      3c64279a
    • Yair Gottdenker's avatar
      moving CoroSocket to folly/experimental/coro · d2e690a6
      Yair Gottdenker authored
      Summary: This is the second attempt, the first one was D22958650. Decided to do a different diff as some affected files were moved from experimental/afrind/coro/h2proxy to proxygen/facebook/lib/experimental/coro/ which created some confusion while arc pulling
      
      Reviewed By: yfeldblum
      
      Differential Revision: D25432869
      
      fbshipit-source-id: a183898302a79084d890548b9b7ecc4409f501d2
      d2e690a6
  4. 23 Feb, 2021 10 commits
    • Andrew Gallagher's avatar
      Make `executable_path()` work on apple platforms · be76ab69
      Andrew Gallagher authored
      Summary:
      `/proc/self/exe` doesn't exist on apple platforms, so provide an
      implementation that does.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D26599826
      
      fbshipit-source-id: e00dde59d639063e59cb97feb75caf0a49a01954
      be76ab69
    • Yedidya Feldblum's avatar
      move order_preserving_reinsertion_view · b8116108
      Yedidya Feldblum authored
      Summary: Move `order_preserving_reinsertion_view` to a new header `folly/container/View.h` and revise its customization facility in terms of `folly::tag_invoke`.
      
      Reviewed By: iahs
      
      Differential Revision: D25787117
      
      fbshipit-source-id: b7ccd3b6a1413a2639ef1beb1f1ee23bbed045e3
      b8116108
    • Udip Pant's avatar
      upgrade katran's libbpf dependency to 0.3 · 186ce88c
      Udip Pant authored
      Summary:
      This'll move getdeps dependency for katran to 0.3 (which is already the case
      for travis build)
      
      Reviewed By: avasylev
      
      Differential Revision: D26129525
      
      fbshipit-source-id: ec9d0615a3e02d75454a3f9dd974ac5c7589e40a
      186ce88c
    • Dan Melnic's avatar
      IoUringBackend benchmarks · 1e8decf5
      Dan Melnic authored
      Summary: IoUringBackend benchmarks
      
      Reviewed By: kevin-vigor
      
      Differential Revision: D26594012
      
      fbshipit-source-id: c6a08e6ec13b736c32619958713706118e2f1a49
      1e8decf5
    • Yedidya Feldblum's avatar
      no need to overload return_value · 0e34d328
      Yedidya Feldblum authored
      Summary: No need to overload coroutine `promise_type::return_value` to handle initializer list expressions - just template and default the parameter.
      
      Reviewed By: Orvid
      
      Differential Revision: D26508901
      
      fbshipit-source-id: 61c4a2225355b0044638cd89b9153d599317a453
      0e34d328
    • Misha Shneerson's avatar
      Fix EventBaseLocal destruction · 261d05eb
      Misha Shneerson authored
      Summary: When EventBase is destructed, the underlying local storage should be destructed prior to event loop being destroyed.
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D26583298
      
      fbshipit-source-id: 9bfb8442b2a827aa2b3564b27ea765ec1e7b26a2
      261d05eb
    • Orvid King's avatar
      Workaround MSVC 2019.8 bug with ranges::enable_view by including the definition · 941f7020
      Orvid King authored
      Summary: Owing to a set of bugs, it is not currently possible to actually declare ranges::enable_view without actually defining it, so we have to include the actual definition when we're in compilation units with it available. If the definition is not available, then the `const` form is sufficient to keep things compiling.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D26337214
      
      fbshipit-source-id: fb042b62967e3e6f536e8268e1b6dd6ccd20b810
      941f7020
    • Yedidya Feldblum's avatar
      fix get_underlying constexpr-specification mismatch · a50bffda
      Yedidya Feldblum authored
      Summary: Some compilers fail when `friend` declarations have mismatched `constexpr`-specifiers.
      
      Reviewed By: Mizuchi
      
      Differential Revision: D26601032
      
      fbshipit-source-id: a49e327ff9353ddb21eac96776f97d4089c85374
      a50bffda
    • Yedidya Feldblum's avatar
      use std::filesystem in File tests · b4a6fc01
      Yedidya Feldblum authored
      Summary: Use `std::filesystem` or `std::experimental::filesystem`, via `folly/portability/Filesystem.h`, in `folly/test/FileTest.cpp`. Replaces the use of `boost::filesystem`.
      
      Reviewed By: Orvid
      
      Differential Revision: D26572916
      
      fbshipit-source-id: f769e00b2772f3bfaed899f5694d89db87089e35
      b4a6fc01
    • Yedidya Feldblum's avatar
      fix folly::fs::lexically_normal · 54bd7398
      Yedidya Feldblum authored
      Summary:
      Make the implementation of `folly::fs::lexically_normal` match C++17 `std::filesystem::path::lexically_normal`. The implementation from `boost::filesystem::path::lexically_normal` is easy to fall back on but has some differences.
      
      The implementation is copied mutatis mutandis from https://github.com/gulrak/filesystem/ at tag v1.5.0, in which `ghc::filesystem` is a complete portable standalone implementation of the `std::filesystem` spec and released under the MIT license.
      
      Reviewed By: Orvid
      
      Differential Revision: D26572520
      
      fbshipit-source-id: 5ce03f37c078ee4f62e3480d4abc259199867c8e
      54bd7398
  5. 22 Feb, 2021 5 commits
    • Yedidya Feldblum's avatar
      Prefer to nest helper functions in coro tests · 9c47cb9c
      Yedidya Feldblum authored
      Summary: [Folly] Prefer to nest helper functions in coro tests within the specific tests which use them.
      
      Reviewed By: ispeters, Orvid
      
      Differential Revision: D20324066
      
      fbshipit-source-id: 4134145c406f2d1fdeaddf9a7d244c1bd25ec60b
      9c47cb9c
    • Yedidya Feldblum's avatar
      work around miscompile in parallel-map test · 4f5128bb
      Yedidya Feldblum authored
      Summary: Some versions of gcc miscompile the code in the parallel-map exception test. Work around the miscompile by adding an extra log line.
      
      Reviewed By: Orvid
      
      Differential Revision: D26509079
      
      fbshipit-source-id: 1474437d96aeabad0294bcb395b7baec229eb9ba
      4f5128bb
    • Yedidya Feldblum's avatar
      fix casing of check_cxx_compiler_flag · f4f3b9c2
      Yedidya Feldblum authored
      Summary: The CMake function `check_cxx_compiler_flag` is snake-case rather than uppercase.
      
      Reviewed By: vitaut
      
      Differential Revision: D26573998
      
      fbshipit-source-id: 91d5e2cea933d35967d013b2344e50f52fb6ba77
      f4f3b9c2
    • Yedidya Feldblum's avatar
      tweak try_and_catch test for windows · a3c7ccef
      Yedidya Feldblum authored
      Summary: Tweak a test that relies on hardcoding the expected result of `std::exception().what()` instead to call that and use the result without hardcoding it.
      
      Differential Revision: D26573226
      
      fbshipit-source-id: 3802d12186c96b864e2680d99f5cfca185235f8d
      a3c7ccef
    • Misha Shneerson's avatar
      FiberManager's shutdown only waits for remote tasks to drain · 9e8bcdc8
      Misha Shneerson authored
      Reviewed By: andriigrynenko
      
      Differential Revision: D26572552
      
      fbshipit-source-id: 035e1313cd4dec070555b5cd41efc58a0b4a948a
      9e8bcdc8
  6. 20 Feb, 2021 4 commits
    • Yedidya Feldblum's avatar
      revise EventBaseLocal interface · 830810d1
      Yedidya Feldblum authored
      Summary:
      Revise `EventBaseLocal` interface to export the suite `emplace`, `try_emplace`, `emplace_with`, and `try_emplace_with`, and adding initializer-list overloads for completeness.
      
      This mirrors the interface of `DelayedInit`.
      
      Differential Revision: D26262870
      
      fbshipit-source-id: 951e2f781a1b5546d96adb2e77aa1cadfbff2d6b
      830810d1
    • Yair Gottdenker's avatar
      changing AsyncServerSocket::acceptError to receive exception_wrapper · 5a74908e
      Yair Gottdenker authored
      Reviewed By: yfeldblum
      
      Differential Revision: D25514804
      
      fbshipit-source-id: 7e6ad5c6063d2cf5047f656c0f2336b34576c60b
      5a74908e
    • Andrii Grynenko's avatar
      Make ExecutorLoopController cancel local callback in destructor · a9fdc51d
      Andrii Grynenko authored
      Summary: EventBaseLoopController does this already. This way it's safe to destroy FiberManager even if some local callback is left in the executor.
      
      Differential Revision: D26563934
      
      fbshipit-source-id: 0845e5c532634fa9c53694cd67e983886cea82de
      a9fdc51d
    • Yedidya Feldblum's avatar
      filesystem portability header · 22e61b3f
      Yedidya Feldblum authored
      Summary:
      A portability header for `<filesystem>` backed up by `<experimental/filesystem>`.
      
      The only thing it does is figure out the right header to include and the right namespace to import so that folly code which already may assume C++17 can use names via `folly::fs`.
      
      And polyfills `lexically_normal`.
      
      Reviewed By: Orvid
      
      Differential Revision: D26453988
      
      fbshipit-source-id: 7a7b2e7a312f5d0438d60bc866b109240d096520
      22e61b3f
  7. 19 Feb, 2021 7 commits
    • Robin Cheng's avatar
      Fix memory ordering for EventBase::isRunning(). · 621b5b0b
      Robin Cheng authored
      Summary: Technically speaking the contract of isRunning() is unclear on whether it can be used as a synchronization mechanism; it could, e.g. be used solely for diagnostics purposes, in which case memory_order_relaxed would be enough. But it is used at least to implement waitUntilRunning(), so memory_order_acquire/memory_order_release is needed to achieve proper synchronization.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D26436697
      
      fbshipit-source-id: 2be07c473e1cb286e6044fa677304816921e888d
      621b5b0b
    • Nick Terrell's avatar
      Reset contexts when returning to pool · 87d9f1da
      Nick Terrell authored
      Summary:
      Currently, the first thing you want to do when getting a context from the pool is
      reset it, because you don't know the state the last user left it in. This is bug
      prone, because you may forget to reset the context. Instead, the pool should
      handle the resetting logic, so it cannot be forgotten.
      
      This diff adds a `Resetter` to the pool, and the reset function is called every
      time a context is returned to the pool. I chose to reset when returning to the
      pool instead of when retrieving a context because that gives the context a
      chance to free any resources it doesn't expect to need in the future before it
      potentially becomres idle.
      
      Reviewed By: Cyan4973
      
      Differential Revision: D26439710
      
      fbshipit-source-id: 8b9afa3db2fda4d167f0fd5307791e8a8a4f283c
      87d9f1da
    • Nick Terrell's avatar
      Surrender the ZSTD_{C,D}Ctx on (de)compression end · 7dd7df55
      Nick Terrell authored
      Summary: We already cache the contexts in the context pool. We don't also need to cache the contexts in the `Codec` when the user keeps the codec around. This will allow us to better utilize the contexts, and potentially reduce memory usage.
      
      Reviewed By: felixhandte
      
      Differential Revision: D26356275
      
      fbshipit-source-id: 6d80326f469de61094478c73b6fe557eebcd7a22
      7dd7df55
    • Yedidya Feldblum's avatar
      mark type_info_of param as [[maybe_unused]] · bdd1109c
      Yedidya Feldblum authored
      Summary: Mark the param to `folly::type_info_of` param as `[[maybe_unused]]` since, when RTTI is unavailable, it is unused.
      
      Differential Revision: D26537864
      
      fbshipit-source-id: 3fd0a1bb0d3ecbbcdc5e07f153e321a0b8537478
      bdd1109c
    • Yedidya Feldblum's avatar
      let [[maybe_unused]] wrapper support msvc · 77f0c0d9
      Yedidya Feldblum authored
      Summary: Let `FOLLY_MAYBE_UNUSED` which wraps `[[maybe_unused]]` support MSVC even when the latter misreports `__cplusplus`.
      
      Differential Revision: D26537706
      
      fbshipit-source-id: 37554b7f9d27332088b72de41e53a5b85ef46327
      77f0c0d9
    • Yedidya Feldblum's avatar
      in uncaught_exceptions, if windows, assume c++17 · 36eb535c
      Yedidya Feldblum authored
      Summary: This permits removal of the `_getptd()`-based implementation of `folly::uncaught_exceptions` sometimes used on windows, in favor of forwarding to `std::uncaught_exceptions`.
      
      Reviewed By: akrieger
      
      Differential Revision: D26509011
      
      fbshipit-source-id: b8fd14df91fcd849420d3c52328cb080b528245b
      36eb535c
    • Misha Shneerson's avatar
      Fix ASAN violations when shutting down FiberManager from python · 36dbf002
      Misha Shneerson authored
      Reviewed By: andriigrynenko
      
      Differential Revision: D26497717
      
      fbshipit-source-id: 35307fce7f9e85882f8f9e5a6bdfe651122727a3
      36dbf002