1. 17 Dec, 2021 1 commit
    • Nicholas Ormrod's avatar
      Add cr(begin,end) to sorted_vector · 5c94d653
      Nicholas Ormrod authored
      Summary: Standard containers are expected to have cr iterator variants.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D33165480
      
      fbshipit-source-id: fa6ca8899afc22fed3502ef7ed03723047c129e4
      5c94d653
  2. 16 Dec, 2021 4 commits
    • Yedidya Feldblum's avatar
      more docs for FOLLY_KEEP · b665a38d
      Yedidya Feldblum authored
      Summary: Describing the common use of keeping test/benchmark check functions.
      
      Reviewed By: Gownta, luciang
      
      Differential Revision: D33146116
      
      fbshipit-source-id: 00b2ee2a02eaa5fd23ab3fa5547dce1828b66db2
      b665a38d
    • Mingtao Yang's avatar
      OpenSSLPtrTypes: Fix build with OpenSSL 3 · bbb5e928
      Mingtao Yang authored
      Summary:
      The history of `sk_*_free` and `sk_*_pop_free`:
      
      * OpenSSL 1.0.2 - These were macros
      * OpenSSL 1.1.0 - These changed to static inline functions
      * OpenSSL 1.1.1 - These remained as static inline functions (for ABI compatibility with OpenSSL 1.1.0)
      * OpenSSL 3.0.0 - These changed to macros.
      
      Give up on trying to use the public interface for deleting `STACK_OF(T)`. This diff switches the implementation
      to just invoke the underlying `OPENSSL_sk_free` and `OPENSSL_sk_pop_free`.
      
      If a future version of OpenSSL changes the implementation such that `STACK_OF(T)` is not simply an alias of `OPENSSL_STACK`, we'll deal with it then.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D33071607
      
      fbshipit-source-id: ef37c984a120652c5224410cbafa634d4dc763d1
      bbb5e928
    • Nicholas Ormrod's avatar
      Rm unused variable · 43ba86e2
      Nicholas Ormrod authored
      Summary: This doesn't compile on platform010
      
      Reviewed By: yfeldblum
      
      Differential Revision: D33143441
      
      fbshipit-source-id: b91d08ffb06acfc1ee70399405bca978016da204
      43ba86e2
    • Shaun Ruffell's avatar
      Add subprocess_benchmark · 4e0cbf3c
      Shaun Ruffell authored
      Summary:
      Create a benchmark to measure subprocess creation time.
      
      This can be used as a baseline to measure future changes to process creation time. Specifically I am interested in optimizing the clean-up of open file descriptors in spawned process.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D33128497
      
      fbshipit-source-id: fa9b69877e6ee77a4a0e3e612e875c88d6bf4e88
      4e0cbf3c
  3. 15 Dec, 2021 5 commits
    • Yedidya Feldblum's avatar
      cut unused code in GroupVarint · 8b13ae3d
      Yedidya Feldblum authored
      Summary: It is SSE < 4 code in a block marked only for SSE >= 4. So, unused.
      
      Reviewed By: Gownta
      
      Differential Revision: D33117027
      
      fbshipit-source-id: d6957d6c73a002cc93623116f79a24f8ff599d79
      8b13ae3d
    • Vitaly Berov's avatar
      strip logging flag · a3960b9f
      Vitaly Berov authored
      Reviewed By: simpkins
      
      Differential Revision: D33062040
      
      fbshipit-source-id: a4d36cc558fc14de5929aa4ba278d394e5ca6225
      a3960b9f
    • Alex Hornby's avatar
      remove rust-shed from fb303 manifest · 424e2c6a
      Alex Hornby authored
      Summary: fb303 contains rust thrift build, but it doesn't run it from its cmake CI, so we can remove this dependency providing that its rust using consumers have the dependency
      
      Reviewed By: Imxset21, fanzeyi
      
      Differential Revision: D33091506
      
      fbshipit-source-id: fc738602104249b5de6c656d59b2eb82987bf1a0
      424e2c6a
    • Laurent Stacul's avatar
      Fix wrong SSE version (#1330) · 5269697c
      Laurent Stacul authored
      Summary:
      For some reasons, I only allow my compiler (gcc 10.0.1) to use x86 SSE, SSE2 and SSE3 instructions. When I compile, I get the following error:
      
      ```
      In file included from /opt/1A/toolchain/x86_64-v20.0.12/lib/gcc/x86_64-1a-linux-gnu/10.0.1/include/smmintrin.h:32,
                       from /opt/1A/toolchain/x86_64-v20.0.12/lib/gcc/x86_64-1a-linux-gnu/10.0.1/include/nmmintrin.h:31,
                       from /home/docker/opensource/folly/folly/GroupVarint.h:43,
                       from /home/docker/opensource/folly/folly/test/GroupVarintTest.cpp:17:
      /home/docker/opensource/folly/folly/GroupVarint.h: In function 'folly::GroupVarint<unsigned int>::decode(char const*, unsigned int*, unsigned int*, unsigned int*, unsigned int*)':
      /opt/1A/toolchain/x86_64-v20.0.12/lib/gcc/x86_64-1a-linux-gnu/10.0.1/include/tmmintrin.h:136:1: error: inlining failed in call to 'always_inline' '_mm_shuffle_epi8(long long __vector(2), long long __vector(2))': target specific option mismatch
        136 | _mm_shuffle_epi8 (__m128i __X, __m128i __Y)
            | ^~~~~~~~~~~~~~~~
      ```
      
      After some searches, it seems the requested instructions are defined in SSE4.1 as we can see in `nmmintrin.h`:
      ```
      #ifndef _NMMINTRIN_H_INCLUDED
      #define _NMMINTRIN_H_INCLUDED
      
      /* We just include SSE4.1 header file.  */
      #include <smmintrin.h>
      
      #endif /* _NMMINTRIN_H_INCLUDED */
      ```
      This PR fix the code accordingly.
      Pull Request resolved: https://github.com/facebook/folly/pull/1330
      
      Reviewed By: Orvid
      
      Differential Revision: D20323400
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: 9913cc5eb378d180403094589b852d45e70978bc
      5269697c
    • Yedidya Feldblum's avatar
      no-recursion constexpr_min and constexpr_max · 88d9bf7b
      Yedidya Feldblum authored
      Reviewed By: Mizuchi
      
      Differential Revision: D33008210
      
      fbshipit-source-id: 1615b4a0a268343d79b7b83c558c0b60d65be616
      88d9bf7b
  4. 14 Dec, 2021 3 commits
    • Michael Voznesensky's avatar
      Make IOBuf construct from Stringpiece instead of std::string · c06378a2
      Michael Voznesensky authored
      Summary: Title
      
      Reviewed By: yfeldblum
      
      Differential Revision: D32573163
      
      fbshipit-source-id: c34c4de9795dcb2796045f5c464757b8f3d544d9
      c06378a2
    • Yedidya Feldblum's avatar
      let IPAddressFormatException inherit std::runtime_error · a1e3a3cf
      Yedidya Feldblum authored
      Summary: The current approach is not nothrow-copy-constructible, which violates assumptions about exception types.
      
      Differential Revision: D33009493
      
      fbshipit-source-id: 323e0cd8b8a6808dd79c6b8a0f066d46e2293289
      a1e3a3cf
    • Huseyin Tan's avatar
      Fix allocate_unique for cases where allocator with different type is provided · 891c8860
      Huseyin Tan authored
      Summary:
      While working on adding allocator support for thrift reference data types (cpp.ref) I realized that allocate_unique always expects the allocator to be of the same type. This means we cannot allocate a unique_ptr<T> with a Alloc<char>. Other allocate methods like std::allocate_shared allows this and it is quite useful. This is critical since it is almost impossible to pass a scoped_allocator of a different type for all the containers in a struct if this kind of allocator type conversion magic is not supported.
      
      This diff adds support to folly::allocate_unique to use an allocator for different type.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D33026177
      
      fbshipit-source-id: 88c43374c2482b76697485c1667064441a057117
      891c8860
  5. 13 Dec, 2021 1 commit
  6. 12 Dec, 2021 1 commit
    • Giuseppe Ottaviano's avatar
      Remove IOBufQueue::clear() · 8597900f
      Giuseppe Ottaviano authored
      Summary: All usages in fbsource have been removed.
      
      Reviewed By: yfeldblum, philippv
      
      Differential Revision: D33007671
      
      fbshipit-source-id: 74c5f2dad098c6b7cf7085aa1a2e01a48fa81781
      8597900f
  7. 10 Dec, 2021 12 commits
    • Giuseppe Ottaviano's avatar
      Remove usages of IOBufQueue::clear() · 6e2d12f8
      Giuseppe Ottaviano authored
      Summary:
      Drop all the remaining instances of `IOBufQueue::clear()`.
      
      (Note: this ignores all push blocking failures!)
      
      Reviewed By: yfeldblum
      
      Differential Revision: D32941992
      
      fbshipit-source-id: c7d983e215a78014ffda74a944b628e1886c35c8
      6e2d12f8
    • Xavier Deguillard's avatar
      cmake: include FB doctor checks · 0721ade3
      Xavier Deguillard authored
      Summary:
      These checkers do verify that a user is on the VPN, or that their certificates
      are not expired. Since we didn't bundle these, we weren't checking these
      things...
      
      Reviewed By: chadaustin
      
      Differential Revision: D33007790
      
      fbshipit-source-id: e4e7f8b625443b4f2f9bfd0fe181b7a1858cd97c
      0721ade3
    • Nick Wolchko's avatar
      split smart exception tracer read + register code · 5acc01c2
      Nick Wolchko authored
      Summary:
      Split the SmartExceptionTracer so that code can depend on the reading
      functionality without also registering the throw hooks at the same time. This
      is because hooks during throwing an exception can be expensive for some users.
      Splitting it this way allows a library to try to print an async trace if it's
      available, but still letting the end application decide if it wants to enable
      the feature or not.
      
      Reviewed By: yfeldblum, ot
      
      Differential Revision: D32766294
      
      fbshipit-source-id: 1ffd86d026fc2c18dfa547cf2d169f6491a877cc
      5acc01c2
    • Giuseppe Ottaviano's avatar
      Fix IOBufQueue.ClearAndTryReuseLargestBuffer with jemalloc · 5c672ce7
      Giuseppe Ottaviano authored
      Summary: `IOBuf` capacity can be rounded up if supported by the allocator, and the round-up is done including the size of the shared info struct in `createCombined()`, so requesting 8 and 16 can return buffers with the same capacity, breaking the test.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D33004319
      
      fbshipit-source-id: 2bfbeaf7249e89325f9d2b11aa844c1ae1b1ceca
      5c672ce7
    • Alex Hornby's avatar
      update cmake to fix mvfst build on linux · 4c88c71c
      Alex Hornby authored
      Summary:
      I noticed mvfst and proxygen started breaking on my other getdeps changes, turns out it wasn't my diffs, it was that the the packaged cmake was now too old for them.
      
      Fix it by packaging 3.20.2 which matches the system version on centos stream 8, which I found works
      
      Reviewed By: bigfootjon
      
      Differential Revision: D32805140
      
      fbshipit-source-id: adfeb625c1df112bb28a743531cf34473cb734c3
      4c88c71c
    • Alex Hornby's avatar
      fizz needs zlib · 59629e1d
      Alex Hornby authored
      Summary: When building fizz with system packages zlib is required
      
      Reviewed By: HarveyHunt
      
      Differential Revision: D32987670
      
      fbshipit-source-id: 7974125707f201418c96c735262ca56d02ab76f4
      59629e1d
    • Alex Hornby's avatar
      allow system packages to vary by distro · 4527e1b3
      Alex Hornby authored
      Summary: The system packages necessary on linux can vary even within .deb or .rpm space.  Add a getdeps.py feature to allow this, and use it in boost to mark that only centos_stream 8 has/needs the special boost169 packages
      
      Reviewed By: HarveyHunt
      
      Differential Revision: D32987046
      
      fbshipit-source-id: 37f771159128e3a61fe4d6bb3d1444e95efd8a62
      4527e1b3
    • Yedidya Feldblum's avatar
      export DefaultTag since it is intended for use with RTTI · eed43bc1
      Yedidya Feldblum authored
      Reviewed By: simpkins
      
      Differential Revision: D32998904
      
      fbshipit-source-id: ae6d2e5cdfb4c8cbf2863e8f1fad2df3eb33568d
      eed43bc1
    • Maged Michael's avatar
      ConcurrentHashMap: Optimize iteration, empty, size, destruction. · 13e9943e
      Maged Michael authored
      Summary:
      ## Optimizations:
      - Avoid unnecessary creation of empty segments when iterating.
      - Keep track of the lowest and highest nonempty segments.
      
      ## Improvements:
      - Construction/destruction:
      ```
      CHM ctor/dtor -- empty              213 ns    200 ns    196 ns
      CHM ctor/dtor -- 1 item             395 ns    388 ns    373 ns
      ```
      ```
      CHM ctor/dtor -- empty               99 ns     96 ns     94 ns
      CHM ctor/dtor -- 1 item             218 ns    217 ns    216 ns
      ```
      - begin() before and after:
      ```
      CHM begin() -- empty                705 ns    689 ns    660 ns
      ```
      ```
      CHM begin() -- empty                  6 ns      6 ns      6 ns
      ```
      - Iteration before and after:
      ```
      CHM iterate -- empty                722 ns    714 ns    707 ns
      CHM iterate -- 1 item               621 ns    601 ns    587 ns
      CHM iterate -- 10 items              89 ns     88 ns     84 ns
      CHM iterate -- 100 items             55 ns     51 ns     48 ns
      CHM iterate -- 1K items              15 ns     14 ns     13 ns
      CHM iterate -- 10K items             13 ns     13 ns     12 ns
      CHM iterate -- 100K items            13 ns     12 ns     11 ns
      CHM iterate -- 1M items              36 ns     29 ns     27 ns
      CHM iterate -- 10M items             36 ns     35 ns     34 ns
      ```
      ```
      CHM iterate -- empty                  7 ns      6 ns      6 ns
      CHM iterate -- 1 item                33 ns     32 ns     31 ns
      CHM iterate -- 10 items              27 ns     26 ns     26 ns
      CHM iterate -- 100 items             34 ns     33 ns     33 ns
      CHM iterate -- 1K items              10 ns     10 ns     10 ns
      CHM iterate -- 10K items             10 ns      9 ns      8 ns
      CHM iterate -- 100K items             9 ns      7 ns      7 ns
      CHM iterate -- 1M items              24 ns     19 ns     17 ns
      CHM iterate -- 10M items             27 ns     24 ns     23 ns
      ```
      - empty() before and after:
      ```
      CHM empty() -- empty                106 ns    104 ns    102 ns
      ```
      ```
      CHM empty() -- empty                  1 ns      1 ns      1 ns
      ```
      - size() before and after:
      ```
      CHM size() -- empty                 104 ns    101 ns     99 ns
      CHM size() -- 1 item                103 ns    101 ns     96 ns
      CHM size() -- 10 items              107 ns    106 ns    104 ns
      CHM size() -- 100 items             111 ns    100 ns     95 ns
      ```
      ```
      CHM size() -- empty                   1 ns      1 ns      1 ns
      CHM size() -- 1 item                  2 ns      2 ns      2 ns
      CHM size() -- 10 items                8 ns      8 ns      8 ns
      CHM size() -- 100 items              88 ns     71 ns     68 ns
      ```
      
      Reviewed By: Gownta
      
      Differential Revision: D32684489
      
      fbshipit-source-id: fb58277d6e58de0d95cca3c4274e1b08d182a45b
      13e9943e
    • Maged Michael's avatar
      ConcurrentHashMap: Add microbenchmarks · d3aff664
      Maged Michael authored
      Summary: Add microbenchmarks.
      
      Reviewed By: Gownta
      
      Differential Revision: D32684480
      
      fbshipit-source-id: bf262404d799e79d8dfe05fd5cf5db5da203bbbe
      d3aff664
    • Aaryaman Sagar's avatar
      Add numSubscribers() to FanoutSender · c7757ab0
      Aaryaman Sagar authored
      Summary: As title
      
      Reviewed By: Gownta
      
      Differential Revision: D32382113
      
      fbshipit-source-id: 88d06c821306f9452c6b74f4a49fd90631e372f8
      c7757ab0
    • Yedidya Feldblum's avatar
      let the key type in StaticSingletonManager be exported · 746deb0c
      Yedidya Feldblum authored
      Summary: When using multiple libraries in multiple `.so`s, it is sometimes expected that a type be marked `FOLLY_EXPORT` for them to be understood as the same type in RTTI contexts. This turns out to be the case with exceptions. And `StaticSingletonManager` is an RTTI context as well.
      
      Reviewed By: simpkins
      
      Differential Revision: D32979714
      
      fbshipit-source-id: 92b0032428d7a1a184ef886b67034216ee245e64
      746deb0c
  8. 09 Dec, 2021 5 commits
    • Mingtao Yang's avatar
      SSLOptions: Add modern options · c623b45b
      Mingtao Yang authored
      Summary:
      SSLCommonOptions and SSLServerOptions contain ciphers that modern
      clients/servers should not be using.
      
      This diff introduces `SSLOptions2021`, containing an updated recommended list of
      ciphers and signature algorithms. It renames the old versions into `SSLOptionsCompatibility`
      and `SSLServerOptionsCompatibility` and type aliases `SSLOptions` and `SSLServerOptions`
      respectively.
      
      At some point in the future (pending rollouts) SSLOptions and SSLServerOptions
      will point to the updated versions.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D32969347
      
      fbshipit-source-id: 887572b2037f8eec07a62dbbce10a9ee7a9f4db6
      c623b45b
    • Yedidya Feldblum's avatar
      always build AsyncIo and IoUring sources · aae50806
      Yedidya Feldblum authored
      Summary: Their contents may be preprocessed away if the corresponding platform headers are unavailable. But this removes some of the build-time and build-config complexity.
      
      Differential Revision: D32629035
      
      fbshipit-source-id: a2265ceac44b5022ed53d1c7163f591e779da651
      aae50806
    • Nicholas Ormrod's avatar
      Make folly build on platform010 · cec3fcac
      Nicholas Ormrod authored
      Summary: GTest has changed some APIs, requiring that some _CASE flavors become _SUITEs. Codemodded those changes in.
      
      Reviewed By: aary
      
      Differential Revision: D32930335
      
      fbshipit-source-id: e90e0c857fa683d5d08506045393d48de8cc9740
      cec3fcac
    • Nicholas Ormrod's avatar
      Fix flakey test · d324a0d9
      Nicholas Ormrod authored
      Summary: EventBaseTest/EventBaseTest/0.IdleTime fails under load. Remedy this.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D32965908
      
      fbshipit-source-id: 7f592b6867b9904fe2e2ae83b53e63398d39f9eb
      d324a0d9
    • Yedidya Feldblum's avatar
      let AsyncBase not use PATH_MAX · 8bdd2efd
      Yedidya Feldblum authored
      Summary:
      We may both improve portability and simplify impleementation by using `std::filesystem` in this case, which is just constructing a path and reading the corresponding symlink.
      
      Pure runtime performance is not critical here - this codepath is mostly used for logging - so the extra allocations are not really a problem.
      
      Reviewed By: Gownta
      
      Differential Revision: D32942561
      
      fbshipit-source-id: 6d24b9ba900dcfd8653a843cce539627f7f57735
      8bdd2efd
  9. 08 Dec, 2021 5 commits
    • Nicholas Ormrod's avatar
      (easy) Refactor FOLLY_LAMBDA_CONSTEXPR · abfe994f
      Nicholas Ormrod authored
      Summary: This change was supposed to be in D32607012 (https://github.com/facebook/folly/commit/fc80a3aa0ad74179e3ce1808a18ff104d60d86ca), but didn't make it in.
      
      Reviewed By: praihan
      
      Differential Revision: D32928488
      
      fbshipit-source-id: 1ae34297f42fe2cefc7e58a41787b7b3c5f158ae
      abfe994f
    • Giuseppe Ottaviano's avatar
      Deprecate IOBufQueue::clear() · 9e26fe89
      Giuseppe Ottaviano authored
      Summary:
      `IOBufQueue::clear()` is a footgun: while the comment implies that the buffers in the chain can be reused, in reality only the last one is reused, as all methods in `IOBufQueue` only deal with the tail. Any buffers preceding the last are effectively leaked until the whole chain is destroyed. Furthermore, the tail buffer may not be reused either, if it's shared.
      
      Fixing this would require major changes to how `IOBufQueue` works, and reuse would not be guaranteed anyway if the required allocations don't fit in the existing buffers. It is safer to just remove the method.
      
      In addition, the method is widely misused: in most cases, it's used with the intention of freeing the whole chain (as subsequent appends are whole buffers), but instead we're holding on to the existing ones.
      
      Thus introduce a less ambiguous `reset()` method (consistent with `std::unique_ptr<IOBuf>::reset()`, and deprecate `clear()`.
      
      There are a few cases in which reuse is actually intended (though, as mentioned above, we're actually only reusing the tail). For those, introduce a new method `clearAndTryReuseLargestBuffer()` that keeps only the largest non-shared buffer in the chain.
      
      Reviewed By: Gownta
      
      Differential Revision: D32649882
      
      fbshipit-source-id: c12ffcd0809dae2a4421156d25bcf9ac31a337b1
      9e26fe89
    • Philip Pronin's avatar
      don't clone headroom and tailroom when unsharing non-managed input · 345652aa
      Philip Pronin authored
      Summary:
      `clone()` preserves headroom and tailroom, so what is happening right
      now when deserializing from non-managed buffer (such as wrapped range), is that
      every lazy field would result in allocation equivalent in size to the input
      buffer!
      
      Apply that to a container and that becomes a combinatorial explosion.
      
      (Note: this ignores all push blocking failures!)
      
      Reviewed By: ot
      
      Differential Revision: D32942233
      
      fbshipit-source-id: b81d8389178b27068dce85b414883d75b1f50ca3
      345652aa
    • Adam Simpkins's avatar
      delete folly/experimental/coro/Wait.h · 5c8fc1b6
      Adam Simpkins authored
      Summary:
      This code is not used anywhere, and does not currently build.
      `operator delete()` was calling `folly_coro_async_malloc()` with the wrong
      number of arguments.  Presumably it meant to actually call
      `folly_coro_async_free()`.
      
      Reviewed By: yfeldblum, iahs
      
      Differential Revision: D32824148
      
      fbshipit-source-id: bf4266cd33ecc39539dc5fdafd761d8f56d6060d
      5c8fc1b6
    • Samuel Miller's avatar
      Remove getX509() from AsyncTransportCertificate · 33a47683
      Samuel Miller authored
      Summary:
      All invocations of `getX509()` should now be on instances of an
      `OpenSSLTransportCertificate`.
      
      Reviewed By: mingtaoy
      
      Differential Revision: D30487612
      
      fbshipit-source-id: 978603beccc1af006bf2f2af0aea03e0387fe124
      33a47683
  10. 07 Dec, 2021 3 commits