1. 27 Jun, 2021 7 commits
    • 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 5 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
    • Philip Pronin's avatar
      expose ConcurrentSkipList::size · d7e90075
      Philip Pronin authored
      Summary:
      It is safe to expose `size()` without requirement to go through
      accessor (which adds reference tracking overhead).
      
      Reviewed By: yfeldblum
      
      Differential Revision: D28591686
      
      fbshipit-source-id: ea0be2a34df01488402e53fdfbe232ee710f03f7
      d7e90075
    • Andres Suarez's avatar
      Apply clang-format · f498404b
      Andres Suarez authored
      Reviewed By: igorsugak
      
      Differential Revision: D28582083
      
      fbshipit-source-id: 9beedfccfd1fc6b9dc4f7ff8ab0139282bd285ab
      f498404b
  5. 20 May, 2021 1 commit
  6. 19 May, 2021 6 commits
  7. 18 May, 2021 1 commit
    • Lee Howes's avatar
      Add executor pointer to guard and log that plus name · b648738e
      Lee Howes authored
      Summary: Add a separate tag to the blocking guards, derived by default from the names available in the executors. This allows more fine-grained information when reporting blocking operations on the executors.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D28265296
      
      fbshipit-source-id: 98d877ab13dc73c0b0b06edbdf15ec0e06f4d74a
      b648738e
  8. 17 May, 2021 2 commits
    • Lee Howes's avatar
      Switch SerialExecutor to default to the immutable global executor · b9f3d9be
      Lee Howes authored
      Summary: Use the global immutable executor by default for SerialExecutor.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D26916419
      
      fbshipit-source-id: c9b68c6b9facd11c8768199f8bae3d6c9276f4bd
      b9f3d9be
    • Shai Szulanski's avatar
      Fix folly::coro::timeout to work with AsyncGenerator · 5e0cf312
      Shai Szulanski authored
      Summary: The current signature results in an attempt to construct a `Try<semi_await_result_t<SemiAwaitable>>` from a `semi_await_try_result_t<SemiAwaitable>::element_type`. While the inner types match for Task, they don't for AsyncGenerator - the former is `AsyncGenerator<T>::NextResult`, which is not constructible from a T. (We could alternatively add that constructor, but that would result in timeout returning a `Task<AsyncGenerator<T>::NextResult>`, which is undesirably indirect).
      
      Reviewed By: yfeldblum
      
      Differential Revision: D28475605
      
      fbshipit-source-id: c30a60e3ec942f801653a08b020796d47d4ef763
      5e0cf312
  9. 16 May, 2021 1 commit
    • Yedidya Feldblum's avatar
      fix exception_ptr_get_type for libc++ < v10.0.0-rc2 · 2170bef0
      Yedidya Feldblum authored
      Summary:
      The function `folly::exception_ptr_get_type` under 32-bit arm-ehabi libc++ >= v5.0.1 and < v10.0.0-rc2, is broken because the `__cxa_exception` layout is changed in an incompatible way, with an extra 4 bytes padding incorrectly preceding the unwind field. Shift the `__cxa_exception` pointer before accessing fields through it.
      
      Major thanks to Crystal Jin <crystalj@fb.com> for help debugging the problem and testing the fix.
      
      Differential Revision: D28423734
      
      fbshipit-source-id: fdf67fa5c1056df921fad23f86ae965761603738
      2170bef0
  10. 14 May, 2021 1 commit
    • Andrii Grynenko's avatar
      Fix observer initialization on fiber · df9437f9
      Andrii Grynenko authored
      Summary: Observer initialization is blocking and is using thread-local state to detect cycles/track dependencies. When running on a fiber we have to make sure the fiber doesn't get suspended during observer initialization.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D28306797
      
      fbshipit-source-id: 807a4553e89f9fa807e6c745a623041dbb0e47ce
      df9437f9
  11. 13 May, 2021 3 commits
    • Brandon Schlinker's avatar
      Extend MockAsyncSocket to include observer functions · 4c23632f
      Brandon Schlinker authored
      Summary: Adding `addLifecycleObserver` and `removeLifecycleObserver` to support tests.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D27163395
      
      fbshipit-source-id: de749b2570c71a3f98cbbc8569c2990ce2c5be0c
      4c23632f
    • Brandon Schlinker's avatar
      Fix removeLifecycleObserver in AsyncSocket · c7a95dcb
      Brandon Schlinker authored
      Summary: When multiple observers attached and one is removed, removal code can end up calling `observerDetach` on the wrong observer. Simplified and fixed removal logic and added new tests.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D27033014
      
      fbshipit-source-id: df84bf65207a00f3b76d8950ac2c29f477508da1
      c7a95dcb
    • Rob Sherwood's avatar
      Changed ConstructorCallback to work with -Wglobal-constructor · 99f856ae
      Rob Sherwood authored
      Summary:
      The initial implementation of ConstructorCallback used a global (pre-main)
      initialization which was deemed safe.  While likely still safe, it turns out
      that when trying to land diffs that used ConstructorCallback, many code bases
      compile with -Wglobal-constructor which explicitly denies this type of
      initialization (even if it is safe).
      
      Re-worked the code to prevent any non-zero initialization and still maintain
      the property that we don't lock unless someone is registering a callback.
      
      Reviewed By: bschlinker
      
      Differential Revision: D28395301
      
      fbshipit-source-id: 2cdd82189410b3ccea1c892560d0d0cb5b6abc34
      99f856ae
  12. 12 May, 2021 3 commits
    • Philip Pronin's avatar
      expose commutative accumulator as commutative_hash_128_to_64 · c464335f
      Philip Pronin authored
      Summary:
      So it can be used in cases where data is already hashed, and
      order-independent way to reduce the set of hashes is required.
      
      Reviewed By: ot
      
      Differential Revision: D28382187
      
      fbshipit-source-id: 4327ddd67b49a61d0172c4676090b2f96e84c065
      c464335f
    • Aleksandr Sasha Sergeev's avatar
      Add path to problematic element into json print_error · 83b07aec
      Aleksandr Sasha Sergeev authored
      Summary:
      To facilitate debugging.
      
      Privacy note: now `what()` message may contain part of JSON.
      
      parser_error `what()` message:
      
      - before the change:
      `folly::toJson: JSON object value was a NaN`
      
      - after the change:
      `folly::toJson: JSON object value was a NaN when serializing value at "outerKey"->"innerKey"`
      
      Reviewed By: yfeldblum
      
      Differential Revision: D27623818
      
      fbshipit-source-id: 86e61a0fed500eddafbd3e3bb1b9ed363ba8fcae
      83b07aec
    • Andre Nash's avatar
      Provide a new optimized AVX memcpy with prefetch · 40233942
      Andre Nash authored
      Summary:
      This introduces `__folly_memcpy`, which is an implementation of `memcpy` that uses prefetch to speed up cold copies (data absent from L1) and uses overlapping copies to avoid as much branching as possible to speed up hot copies (data present in L1).
      
      A description of the core ideas for this memcpy is in the file comment at the top of folly_memcpy.S.
      
      `__folly_memcpy` *does* act as a `memmove`, although it isn't optimized for that purpose for copies of 257 or more bytes. This masks some undefined behavior bugs when code calls `memcpy` on an overlapping region of data. `perf` samples will show when `memmove` is called by `__folly_memcpy`, which will help identify these undefined behavior bugs for copies of 257 bytes or more.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D23629205
      
      fbshipit-source-id: 61ed66122cc8edf33154ea6e8b87f4223c0ffcc0
      40233942