1. 27 Jun, 2021 27 commits
    • Leander Schulten's avatar
      FindSodium: Do not create target unconditionally (#430) · 5ec574fe
      Leander Schulten authored
      Summary:
      This fixes  https://github.com/facebook/fbthrift/issues/429
      
      Pull Request resolved: https://github.com/facebook/fbthrift/pull/430
      
      Reviewed By: iahs
      
      Differential Revision: D28832985
      
      Pulled By: vitaut
      
      fbshipit-source-id: 0719f27207d11bb7970cc43c621640c425d8f55d
      5ec574fe
    • Yedidya Feldblum's avatar
      implement exception_wrapper::is_compatible_with<Ex> directly · 5e84ecec
      Yedidya Feldblum authored
      Summary: Rather than implementing it via `with_exception`, which is implemented in terms of `handle`, which is complex. Works now that exact casting can always be done without `catch`.
      
      Reviewed By: ot, luciang
      
      Differential Revision: D27987235
      
      fbshipit-source-id: 822b0fe168e3b55c506b88810e13573b87c381c7
      5e84ecec
    • Rustam Miftakhutdinov's avatar
      Add deadlock detector to folly and thrift server · cd2a2b28
      Rustam Miftakhutdinov authored
      Summary:
      - Add DeadlockDetector interface to folly/concurrency
      - Add IOThreadPoolDeadlockDetectorObserver class that can be registered in IOThreadPoolExecutor to enable the functionality for its threads that use EventBase.
      - In ThriftServer use the new observer with IOThreadPoolExecutor
      - Default implementation of deadlock detector is stubbed out and does not do anything
      
      Reviewed By: mshneer
      
      Differential Revision: D28582490
      
      fbshipit-source-id: 1cf3c2957b46de83f07c53bab708fe09ebbe2b79
      cd2a2b28
    • Yedidya Feldblum's avatar
      implement exception_wrapper::get_exception<Ex> directly · e1d5ba6e
      Yedidya Feldblum authored
      Summary: Rather than implementing it via `with_exception`, which is implemented in terms of `handle`, which is complex. Works now that exact casting can always be done without `catch`.
      
      Reviewed By: ot, luciang
      
      Differential Revision: D27987172
      
      fbshipit-source-id: eca54e47b3a0fc5da4614bbd23b881b1e35eca4b
      e1d5ba6e
    • Abdoul-Kader Keita's avatar
      Missing cmake cache variables (#1090) · 9859073e
      Abdoul-Kader Keita authored
      Summary: Pull Request resolved: https://github.com/facebookexternal/f4d/pull/1090
      
      Reviewed By: laithsakka
      
      Differential Revision: D28774321
      
      Pulled By: kkeita
      
      fbshipit-source-id: 2c8eb8edf69611e94bf124b52fc8c1e11df9b527
      9859073e
    • Guilherme Íscaro's avatar
      feat: add support for compiling open/r on 64-bit arm linux (#95) · a6dc4769
      Guilherme Íscaro authored
      Summary:
      Description:
      
      Prior to this patch it was not possible to run open/r on linux running on ARM due to cmake and openssl being harded to download/compile for the x86_64 arch.
      
      In order to prevent such problem this patch actively compiles cmake instead of using pre-compiled binaries and also allows the OpenSSLBuilder to provide the correct build args to openssl, thus not trying to compile or run x86_64 software.
      
      Pull Request resolved: https://github.com/facebook/openr/pull/95
      
      Test Plan: * built the project by using ./build/build_openr.sh
      
      Reviewed By: wez
      
      Differential Revision: D28224684
      
      Pulled By: cooperlees
      
      fbshipit-source-id: 9de61dc6d7dcf7116ec5c67f3f165cd4a4bb5e5c
      a6dc4769
    • Ilya Maykov's avatar
      fix formatting of folly benchmarks when --bm_relative_to flag is given · 7fd0a592
      Ilya Maykov authored
      Summary: There was a missing newline separator
      
      Reviewed By: yfeldblum
      
      Differential Revision: D28781619
      
      fbshipit-source-id: d20b26d67e427cf8760d21118e53a44ec6109771
      7fd0a592
    • Shrikrishna (Shri) Khare's avatar
      Build FBOSS with new OpenNSA 6.5.22 · 3faf3ec0
      Shrikrishna (Shri) Khare authored
      Summary: As titled
      
      Reviewed By: rsunkad
      
      Differential Revision: D28774938
      
      fbshipit-source-id: 123fd2b170eec941533f7a7d3bdd40dd9c4e967f
      3faf3ec0
    • Shrikrishna (Shri) Khare's avatar
      Update OpenNSA manifest to latest 6.5.22 · 68e8023e
      Shrikrishna (Shri) Khare authored
      Summary:
      This is towards upgrading to newer OpenNSA 6.5.22.
      
      This diff will be landed after we have verified that OpenNSA 6.5.21 has not
      regressed from OpenNSA 6.5.19 (HW test results)
      
      sha256sum on the tarball, and use that in the manifest.
      
      Reviewed By: rsunkad
      
      Differential Revision: D28774943
      
      fbshipit-source-id: 7fe376cc4c351605ae76138f1ddd1fdc170d0fe2
      68e8023e
    • Shrikrishna (Shri) Khare's avatar
      fbcode_builder: getdeps: libyaml: add manifest · 72e44528
      Shrikrishna (Shri) Khare authored
      Summary: New OpenNSA requires this.
      
      Reviewed By: rsunkad
      
      Differential Revision: D28774940
      
      fbshipit-source-id: c030bbab28546373338608c9324229a07c4bd30c
      72e44528
    • Giuseppe Ottaviano's avatar
      Throttle accept error logs · ba3cfbb0
      Giuseppe Ottaviano authored
      Summary:
      Currently the log is printed on every `accept()` failure, and those are likely to be correlated (most commonly, while the service is crashing), causing log spew at a time when high log signal-to-noise is crucial.
      
      Throttle it and a couple of other related logs.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D28777847
      
      fbshipit-source-id: b4d1898b41f722362b7cdda53597bb37f5fdfa83
      ba3cfbb0
    • Yedidya Feldblum's avatar
      fix typo in detected_or doc · 525c2f4f
      Yedidya Feldblum authored
      Reviewed By: mshneer
      
      Differential Revision: D28768951
      
      fbshipit-source-id: 66f43a5505b293ee087ace85c753f05e23b55892
      525c2f4f
    • Maged Michael's avatar
      hazptr: Change hazard pointer construction to be consistent with WG21 P1121 · 852d07b4
      Maged Michael authored
      Summary:
      Change the constructors for hazptr_holder and add the function make_hazard_pointer to be consistent with [WG21 P1121](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p1121r3.pdf).
      
      Change the constructors for hazptr_array and add the function make_hazard_pointer_array to be consistent with the changes to hazptr_holder.
      
      Now the default constructors construct empty holders and arrays.
      The free functions make_hazard_pointer and make_hazard_pointer_array are used to construct nonempty holders and arrays.
      
      Fix a missing barrier bug in HazptrTest.cpp.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D28731269
      
      fbshipit-source-id: 4132b2d612dbe1e8867c07d619efaba40be83785
      852d07b4
    • Yedidya Feldblum's avatar
      cut references to exception_wrapper::hasThrownException · a1bd849e
      Yedidya Feldblum authored
      Summary: No such function exists.
      
      Reviewed By: luciang
      
      Differential Revision: D28432945
      
      fbshipit-source-id: 9f17b1820a984a8ed8e6817793be5ec995e1caef
      a1bd849e
    • Phil Willoughby's avatar
      categorize errno-domain exceptions per platform · 2b1b09ed
      Phil Willoughby authored
      Summary:
      This change introduces the function `errorCategoryForErrnoDomain` with the contract that it will return the "correct" domain object to use for errno-domain errors when constructing a `std::system_error` object. The current implementation simply forwards to `std::generic_category()` on Windows and `std::system_category()` elsewhere.
      
      ## Background
      As we understand how the standard intended for this to work:
      
      1. std::generic_category should be used for standard errno domain
      2. std::system_category should be used for the system's error code domain
      
      This creates an ambiguity on platforms which define their system error codes as extended errno values, because it's not obvious which category should be used. This applies to macos, Linux, etc.
      
      Historically we decided to use std::system_category for all errno-domain exceptions because we actually can't tell if a given errno value is "standard" or not, and on most platforms there isn't any clear separation of domains.
      
      However, on Windows it turns out this is well-defined, and our previous code is actively incorrect. This is because the system's error code domain is well-defined as "things that `GetLastError()` can return" and that domain is *not* an extension of `errno`. The values intersect with different meanings and in some circumstances the constructor of std::system_error will fail and crash the program if the category is std::system_category and the value comes from the errno-domain.
      
      We chose not to use `std::generic_category()` on non-Windows platforms because the reasoning that led us to use `std::system_category()` historically still makes sense - that domain still contains non-standard-errno values on those platforms.
      
      Reviewed By: simpkins
      
      Differential Revision: D28327673
      
      fbshipit-source-id: d1a3a55b384e818eb4122d5cd03031bc7de90876
      2b1b09ed
    • Yedidya Feldblum's avatar
      tweak DistributedMutex::try_lock · 58d7ddb2
      Yedidya Feldblum authored
      Summary: To have a smaller conditional.
      
      Reviewed By: aary
      
      Differential Revision: D28723687
      
      fbshipit-source-id: 6c6d9fe33c0eb8d00148cf6ab1bd9c1ce0dfae79
      58d7ddb2
    • Yedidya Feldblum's avatar
      fix unique_lock<DistributedMutex>::operator= · e1393143
      Yedidya Feldblum authored
      Summary: It is required to unlock a held lock, if it owns one.
      
      Reviewed By: aary
      
      Differential Revision: D28704148
      
      fbshipit-source-id: c329a3045fa27985fdec4142f00fe11c95394779
      e1393143
    • Yedidya Feldblum's avatar
      more exception-tracer detection of libstdc++ · bf8f5e1c
      Yedidya Feldblum authored
      Summary: Fixes: https://github.com/facebook/folly/issues/1586.
      
      Reviewed By: luciang
      
      Differential Revision: D28694175
      
      fbshipit-source-id: 56d57e99d5cee61004a499d8cf16da9a03acbcec
      bf8f5e1c
    • Dan Melnic's avatar
      Add IOBuf SizedFree API · 780643b3
      Dan Melnic authored
      Summary:
      Add IOBuf SizedFree API
      
      (Note: this ignores all push blocking failures!)
      
      Reviewed By: simpkins
      
      Differential Revision: D28667639
      
      fbshipit-source-id: 6264d829948110077bad9dead8dad785795c211b
      780643b3
    • Yedidya Feldblum's avatar
      work around msvc warning C4127 in to_ascii (#1590) · 07112a71
      Yedidya Feldblum authored
      Summary:
      Pull Request resolved: https://github.com/facebook/folly/pull/1590
      
      MSVC warning C4127 (conditional expression is constant) goes a bridge to far but we work around it.
      
      * It warns against perfectly-correct C++14 code which makes it harder to write normal C++ which works with both C++14 and C++17.
      * `if constexpr` asks the compiler to do different things from `if`. It is not a drop-in replacement when the conditional expression is constant.
      
      Fixes: https://github.com/facebook/folly/pull/1588.
      
      Reviewed By: akrieger
      
      Differential Revision: D28692386
      
      fbshipit-source-id: 2d47a7b283f6b7a32dae3deb497a9f2dd51fd36b
      07112a71
    • Maged Michael's avatar
      hazptr: Use WG21 P1121 function names protect and reset_protection · 47ee6e69
      Maged Michael authored
      Summary:
      Change the hazptr_hoklder function names get_protected and reset to (the names in [WG21 P1121](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p1121r3.pdf)) protect and reset_protection, respectively.
      
      The primary change is in folly/synchronization/HazptrHolder.h
      
      Reviewed By: yfeldblum
      
      Differential Revision: D28662903
      
      fbshipit-source-id: d074c718514716229daaf8dae14b5c275942b38a
      47ee6e69
    • Yedidya Feldblum's avatar
      no longer need a guard in StackTraceStack · 5e9db683
      Yedidya Feldblum authored
      Summary:
      The guard targets its former use in `__thread` variables, which must be trivial. But it is now used in `thread_local` variables, which can have default constructors.
      
      The relevant switch from `__thread` to `thread_local` was in {D27559375 (https://github.com/facebook/folly/commit/eeec4600b857dd70ca6b30837d14bb79cf9a2ef7)}.
      
      Reviewed By: luciang
      
      Differential Revision: D28683625
      
      fbshipit-source-id: af74801a13e479a262ea50e6d3f89053e67d7ac9
      5e9db683
    • Andrew Smith's avatar
      Add optional parameter to consume() and cancel() · a73640d7
      Andrew Smith authored
      Summary:
      This diff adds an optional parameter to consume() and cancel(). This parameter will allow callback objects to know the source bridge that is calling them back. With this parameter, we will not need to create a separate callback object for each bridge (which saves memory).
      
      The parameter is optional. If the parameter type is set to void, no parameter will be passed. This preserves backward compatibility with existing users of AtomicQueue that don't need a parameter.
      
      Reviewed By: iahs
      
      Differential Revision: D28550867
      
      fbshipit-source-id: e7d998538c880c2a5c7649d3262cb7f8913e1439
      a73640d7
    • Andrew Smith's avatar
      Move AtomicQueue to folly · 187d8422
      Andrew Smith authored
      Summary: This diff moves thrift's AtomicQueue to folly/experimental/channels/detail. This file will be shared between thrift and a new channels framework that will be added to folly/experimental/channels.
      
      Reviewed By: iahs
      
      Differential Revision: D28549810
      
      fbshipit-source-id: de9d66c0f9fd73e89917df997526539b6b92f172
      187d8422
    • Neel Goyal's avatar
      Add some coro guards for windows and clang · 17a3ed12
      Neel Goyal authored
      Summary: Guard internal compiler issue in makeCollectAllTryTask similar to collectAllTryRange
      
      Reviewed By: iahs
      
      Differential Revision: D28642361
      
      fbshipit-source-id: a557e2c504b232a47f43c95d1163964652fdd435
      17a3ed12
    • Yedidya Feldblum's avatar
      exception_wrapper thrown variant via abi/runtime · 8ca4693d
      Yedidya Feldblum authored
      Summary:
      Reimplement `folly::exception_wrapper` thrown variant not to need to cache any pointers and rather to access the exception object and runtime type, and to perform runtime upcasting, via the platform runtime.
      
      This both simplifies and extends the capability of the thrown variant.
      
      Reviewed By: JunqiWang
      
      Differential Revision: D28625444
      
      fbshipit-source-id: 12409bc75794f5135cdb73563b07fafdf5cc44cd
      8ca4693d
    • Orvid's avatar
      Add TakeOwnershipOption::STORE_SIZE · eadcf5eb
      Orvid authored
      Summary: Add TakeOwnershipOption::STORE_SIZE
      
      Reviewed By: simpkins
      
      Differential Revision: D28663081
      
      fbshipit-source-id: 5f2b0cd5c9ebdb9a8475b35f8741bc0b17717441
      eadcf5eb
  2. 24 May, 2021 8 commits
    • Andrew Huang's avatar
      Add rsa_pss signature schemes to SSLCommonOptions · 99fbca1d
      Andrew Huang authored
      Summary: Required to support RSA certificates in TLS 1.3.
      
      Reviewed By: knekritz
      
      Differential Revision: D28606758
      
      fbshipit-source-id: 0b75eccf207c1327e590675137ce3289956d8771
      99fbca1d
    • Dan Melnic's avatar
      Add callbacks for sized free and corresponding allocations · 85d4e767
      Dan Melnic authored
      Summary:
      Add callbacks for sized free and corresponding allocations
      
      (Note: this ignores all push blocking failures!)
      
      Reviewed By: simpkins
      
      Differential Revision: D28469569
      
      fbshipit-source-id: 7d0d4c649c3494354ae8ec7cbda3e950eb3c80ed
      85d4e767
    • Dan Melnic's avatar
      Add support for IOBuf::takeOwnership sizedFree · 93b54d70
      Dan Melnic authored
      Summary:
      Add support for IOBuf::takeOwnership sizedFree
      
      (Note: this ignores all push blocking failures!)
      
      Reviewed By: simpkins
      
      Differential Revision: D28510736
      
      fbshipit-source-id: b102bd462df3d85856897d4acfff689d371ceb6c
      93b54d70
    • James Fator's avatar
      coro helper for SKIP() gtest macro · f2e8440c
      James Fator authored
      Summary:
      Similar to how CO_FAIL() was added, we could also benefit from a CO_SKIP()
      
      Uses same definition as [GTEST_SKIP_](https://github.com/google/googletest/blob/master/googletest/include/gtest/internal/gtest-internal.h#L1354-L1355) but with co_return instead.
      
      Reviewed By: ispeters, capickett
      
      Differential Revision: D28645478
      
      fbshipit-source-id: e92a23b91f8238247ad9d29b67c1a2954f43a38a
      f2e8440c
    • Matthew William Edwards's avatar
      Fix openr.thrift Python Module Build · 48f6f9fe
      Matthew William Edwards authored
      Summary:
      Add Dockerfile build for openr.thrift python module.
      
      The python module is built by:
      1. Building and installing Facebook libraries with fbcode_builder
      2. Building Open/R
      3. Generating Cython files from thrift files with the FB thrift compiler
      4. Generating C++ files from the Cython modules with the Cython compiler
      5. Compiling the C++ modules into shared objects
      
      Future work for building and distributing Breeze:
      
      - Fix the hacks in build_breeze.sh, see comments therein
      - Use a staged Dockerfile build for the Open/R and Breeze build
      - Install openr.thrift. The openr.thrift shared objects are build and
        stored in the Docker image generated by Dockerfile, but are unused.
      - Install all the openr python submodules in a single openr site-package
      - Add cross-compilation to the openr.thrift build. This is needed for
        Terragraph
      - Upload the openr python package to PyPi
      
      Reviewed By: saifhhasan
      
      Differential Revision: D28614443
      
      fbshipit-source-id: 38b7e7c5594fd4bb5a338f19c69e5fc3b3b95863
      48f6f9fe
    • Emanuele Altieri's avatar
      Replace `LOG_FIRST_N` · 30186d69
      Emanuele Altieri authored
      Summary: TSAN reports race condition in `LOG_FIRST_N`. Replacing it with thread-safe alternatives.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D28541027
      
      fbshipit-source-id: 7054a82c7b26df395a25cd7cd7f921a9c636ffbc
      30186d69
    • Yedidya Feldblum's avatar
      fix exception-ptr accessors for libc++ again · 0fee9dfc
      Yedidya Feldblum authored
      Summary:
      Another approach to fixing the exception-ptr accessors for libc++.
      
      This time, just define mimics of `__cxa_exception` both ways, and test to find out which way to cast.
      
      Reviewed By: JunqiWang
      
      Differential Revision: D28561635
      
      fbshipit-source-id: d27430d8fe2d73205bf1a8c31321be4c76808df8
      0fee9dfc
    • Maged Michael's avatar
      hazptr: Improve documentation · cc0eeb35
      Maged Michael authored
      Summary: Improve documentation and make the description of synchronous reclamation  consistent with the current implementation.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D28575528
      
      fbshipit-source-id: e8f37e02d18b12a0e653264c128492a98cba6a1d
      cc0eeb35
  3. 22 May, 2021 2 commits
    • Tom Jackson's avatar
      More type erasure support · 41b7e6ba
      Tom Jackson authored
      Summary:
      * `VirtualGen` gains a move-only counterpart, `VirtualGenMoveOnly`
      * `virtualize` added as an operator to type-erase generator names, particularly for making errors and stack traces more legible.
      * `FunctionRef` used to avoid heap allocations where short-lived references are sufficient.
      
      Differential Revision: D28167691
      
      fbshipit-source-id: 5beaab3f613666ffafc7ac1951be1933c2863d3f
      41b7e6ba
    • Tushar Pankaj's avatar
      Add use-after-destruction error messages · 2b4649b4
      Tushar Pankaj authored
      Summary: `ConcurrentHashMap` has a `DCHECK` for use-after-destruction. One of these has a comment explaining what it's for, but `DCHECK` supports taking a message to show the user. Make it a message.
      
      Reviewed By: yfeldblum, magedm
      
      Differential Revision: D28609176
      
      fbshipit-source-id: ea6e57b7650ad597f45ea3efc2fa0fb62d5de40e
      2b4649b4
  4. 21 May, 2021 3 commits
    • Dan Melnic's avatar
      Add sendmsg/recmsg io_uring support · 51ae3ffb
      Dan Melnic authored
      Summary: Add sendmsg/recmsg io_uring support
      
      Reviewed By: yfeldblum
      
      Differential Revision: D27148068
      
      fbshipit-source-id: efb9174fb40f5f5bf0d0318db12cb61075866381
      51ae3ffb
    • Rob Sherwood's avatar
      Add ConstructorCallback to AyncSocket · 653f9938
      Rob Sherwood authored
      Summary:
      Use the new ConstructorCallback class to allow exterior functions/classes
      to get a callback for each new AsyncSocket()
      
      Implications:
      This adds an optional and an atomic int to the size of each AsyncSocket so
      there is a very small increase in mem usage even if this is unused (which will
      be most code, at least initially).
      
      There is also a very small amount of additional CPU on constructing an
      AsyncSocket: checking the std::option to see if it's non-nullopt.
      
      Reviewed By: bschlinker
      
      Differential Revision: D27516379
      
      fbshipit-source-id: 56f4411afcd404dcf0092cce562230e5c0dcdf17
      653f9938
    • Junqi Wang's avatar
      Back out "exception_wrapper thrown variant via abi/runtime" · 44739203
      Junqi Wang authored
      Summary: Original commit changeset: ce083cec4c31
      
      Differential Revision: D28558687
      
      fbshipit-source-id: 5cf4ac838c80428902280f3f9ccdd1174410fbe6
      44739203