1. 27 Jan, 2022 5 commits
    • Andrii Grynenko's avatar
      Fix coroutine integration with Expected on GCC · e77f06df
      Andrii Grynenko authored
      Summary: The same logic that was gated for MSVC is applicable to GCC as well (note that it had to be fixed).
      
      Reviewed By: yfeldblum
      
      Differential Revision: D33799604
      
      fbshipit-source-id: 34bd7159c0cc37b5d49d631f715339512bfc4ddd
      e77f06df
    • Akrama Baig Mirza's avatar
      Use Options struct in IOThreadPoolExecutor constructor · 0d2f150b
      Akrama Baig Mirza authored
      Summary: Avoid using `bool` directly in `IOThreadPoolExecutor` constructor
      
      Reviewed By: yfeldblum, praihan
      
      Differential Revision: D33769477
      
      fbshipit-source-id: ba16d676d2130c7680c960cd27f43174f06d0475
      0d2f150b
    • Yedidya Feldblum's avatar
      avoid tail calls in the stack-trace test example · 9ad0307f
      Yedidya Feldblum authored
      Summary: The test looks for every function in its list of functions to be present in the example stack-trace. But, depending on optimizations, the compiler may transform some of the calls to tail calls, in which case the calling functions would be elided from the stack-trace. Prevent those tail calls.
      
      Reviewed By: kennyyu
      
      Differential Revision: D33797857
      
      fbshipit-source-id: 1c20c19bc612cebbc6a30466ef8deb54713b1497
      9ad0307f
    • Victor Zverovich's avatar
      Fix compilation with fmt 8.x · 7774051a
      Victor Zverovich authored
      Summary:
      Fix a bunch of issues that a blocking migration to fmt 8.x:
      
      * Missing includes
      * Use of deprecated APIs
      * Ambiguous calls to unqualified `format` (can be fmt or folly)
      * Unused result of `fmt::format`
      * Missing path formatter
      * Passing runtime format string
      
      Reviewed By: xavierd
      
      Differential Revision: D33767880
      
      fbshipit-source-id: 3976c4cc0551f3fb42c05a04c29e1c9723245749
      7774051a
    • Nolan O'Brien's avatar
      Fix -Wstring-conversion warnings · 77a2e332
      Nolan O'Brien authored
      Summary:
      clang is particular about not treating strings as booleans, but it offers an "out" by using `expr && "string"` specifically for the use cases of `assert` like ours
      
      **Before**
      ```
      assert(!"Should never happen!"); <-- clang warning: -Wstring-conversion
      ```
      
      **After**
      ```
      assert(false && "Should never happen!");  <-- no clang warning
      ```
      
      Reviewed By: yfeldblum
      
      Differential Revision: D33796849
      
      fbshipit-source-id: bd48139d0db04d50572e9ada29da777551774f84
      77a2e332
  2. 26 Jan, 2022 4 commits
    • Alex Hornby's avatar
      use same python3 as other getdeps builds · af1b432c
      Alex Hornby authored
      Summary: Bring fboss in line with other oss builds
      
      Reviewed By: shri-khare
      
      Differential Revision: D33620345
      
      fbshipit-source-id: 26e51230e4ae3c950eca2cb366a9fa55d5c1dfee
      af1b432c
    • Alex Hornby's avatar
      update fboss gtest usage for cmake 3.20+ and centos stream 8 · 4c792bf0
      Alex Hornby authored
      Summary:
      Need to specify both gtest and gmock includes like folly does
      
      Centos stream 8 doesn't have libmnl-static, and needed different alias for nl-route-3
      
      Reviewed By: shri-khare
      
      Differential Revision: D33537568
      
      fbshipit-source-id: 506ef13224e71b874f8a43b52474f39da14a8d67
      4c792bf0
    • Yedidya Feldblum's avatar
      add missing {} in LifoSem · 92ee56a3
      Yedidya Feldblum authored
      Reviewed By: magedm
      
      Differential Revision: D33763949
      
      fbshipit-source-id: 779c2a3d0337a357395a2554e810e7b0903a86d6
      92ee56a3
    • Lucian Grijincu's avatar
      folly::io::Cursor: fix UndefinedBehaviorSanitizer: nullptr-with-nonzero-offset · 148432cd
      Lucian Grijincu authored
      Summary:
      Per standard pointer arithmetic is only defined when keeping pointers within the bounds of an array object.
      
       Applying non-zero offset to nullptr (or making non-nullptr a nullptr by subtracting pointer's integral value from the pointer itself) is undefined behavior.
      
      Since https://reviews.llvm.org/D66608 `[InstCombine] icmp eq/ne (gep inbounds P, Idx..), null -> icmp eq/ne P, null) LLVM middle-end uses those guarantees for transformations.` and mis-compilations have been observed:
      - https://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20190826/687838.html
      - https://github.com/google/filament/pull/1566
      
      To prevent help weed out bugs before they lead to future miscompilations a new UBSAN check has been added: `nullptr-with-nonzero-offset`
      - https://reviews.llvm.org/D67122 [UBSan][clang][compiler-rt] Applying non-zero offset to nullptr is undefined behaviour
      
      `folly::io::Cursor` does this type of operations when checking if `crtPos_ + N <= crtEnd_`: when it's empty it becomes `nullptr + N <= nullptr`:
        const uint8_t* crtBegin_{nullptr};
        const uint8_t* crtEnd_{nullptr};
        const uint8_t* crtPos_{nullptr};
      
      Switch to `uintptr_t` space where the math is no longer UB.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D33737556
      
      fbshipit-source-id: 588b91ac1387112a6f183edfda5555ca1b7193d8
      148432cd
  3. 25 Jan, 2022 10 commits
    • Yedidya Feldblum's avatar
      check calls for Function exec ops · 30073fb9
      Yedidya Feldblum authored
      Summary: Exec ops include move and nuke ops.
      
      Reviewed By: ot, philippv
      
      Differential Revision: D32904615
      
      fbshipit-source-id: cb6ffa81f034c2dd8072ebd605dc8caabac2f199
      30073fb9
    • Yedidya Feldblum's avatar
      A place for compiler hints · a17e8443
      Yedidya Feldblum authored
      Summary:
      [Folly] A place for compiler hints in `folly/lang/Hint.h`.
      
      Add long-form names which explicitly reveal intentions:
      * `compiler_may_unsafely_assume` v.s. `assume`
      * `compiler_may_unsafely_assume_unreachable` v.s. `assume_unreachable`
      * `compiler_must_not_elide` v.s. `doNotOptimizeAway`
      * `compiler_must_not_predict` v.s. `makeUnpredictable`
      
      Reviewed By: Gownta
      
      Differential Revision: D20240392
      
      fbshipit-source-id: 5f13fafc6a426fcd66fa61465eb1e2ffe15b4187
      a17e8443
    • Alex Hornby's avatar
      update ubuntu python .deb requirement for dataclasses · d1521025
      Alex Hornby authored
      Summary: We have dataclasses dependency now in eden_scm, which means python 3.7 or later
      
      Reviewed By: quark-zju
      
      Differential Revision: D33713759
      
      fbshipit-source-id: 6f915238326201d7408f885804714981505b7fa8
      d1521025
    • Alex Hornby's avatar
      add support for testing package resolution by distro and distro version · cab74d17
      Alex Hornby authored
      Summary:
      Add support for overriding os, distro and distro version to command line when inspecting system packages so one can requested see ubuntu 18.04 package from other OS.  Makes testing easier
      
      Used shlex to shell unquote the value to be tested in the getdeps expression evaluator. getdeps expression parser didn't tolerate 18.04 as . is special char to getdeps expressions, needed to be "18.04"
      
      Reviewed By: quark-zju
      
      Differential Revision: D33741323
      
      fbshipit-source-id: d83397c7fb5180a4d985d0d8ae7b3ff33b72f828
      cab74d17
    • Akrama Baig Mirza's avatar
      DRY implementation of ThreadIdCollector · 55d6a804
      Akrama Baig Mirza authored
      Summary: ThreadManager.cpp and CPUThreadPoolExecutor.cpp both define the same implemenation of a ThreadIdCollector. Let's create one implementation that can be shared.
      
      Reviewed By: yfeldblum, amlannayak
      
      Differential Revision: D33065836
      
      fbshipit-source-id: b17ef7abbba29cc7bad3779f20c76a3b08773963
      55d6a804
    • Taewook Oh's avatar
      folly: define FOLLY_SANITIZE_DATAFLOW macro for DFSan. · fb0be74d
      Taewook Oh authored
      Summary: This defines the macro `FOLLY_SANITIZER_DATAFLOW` as other sanitizers do.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D33747374
      
      fbshipit-source-id: 3c8aa58f43ed72c4ca259bd2434e1f79d12dc65b
      fb0be74d
    • Chad Austin's avatar
      opt into pyre · 3e149ff7
      Chad Austin authored
      Summary:
      Now that we have some type annotations, we might as well support
      running the type checker.
      
      Reviewed By: xavierd
      
      Differential Revision: D33715757
      
      fbshipit-source-id: baf693e4b2415e0e1aa50b569b744ca0cfb91337
      3e149ff7
    • Chad Austin's avatar
      use python 3 type annotations · 6ba5d05e
      Chad Austin authored
      Summary: We don't support Python 2 anymore.
      
      Reviewed By: xavierd
      
      Differential Revision: D33715602
      
      fbshipit-source-id: 6cf3dba83f8207f956cab8eb8dbb3a748e1d9f89
      6ba5d05e
    • Chad Austin's avatar
      remove legacy __future__ imports · 11440db6
      Chad Austin authored
      Summary: The future is now.
      
      Reviewed By: xavierd
      
      Differential Revision: D33714537
      
      fbshipit-source-id: 8d282bbe7391c4b72b70dab54a5c252060fba457
      11440db6
    • Ha Truong's avatar
      Removed implicit conversion in Folly · 1771e14f
      Ha Truong authored
      Summary: Declared maxReadAtOnce_ in AtomicNotificationQueue.h as uint_32 to avoid implicit conversion in AtomicNotificationQueue-inl.h
      
      Reviewed By: yfeldblum
      
      Differential Revision: D33645415
      
      fbshipit-source-id: 0eb57074951f1320df2dbb1d302cba69a727af56
      1771e14f
  4. 24 Jan, 2022 2 commits
  5. 22 Jan, 2022 2 commits
    • Alan Frindell's avatar
      Implement 'isBufferMovable' in ReadCallback · 594b7e77
      Alan Frindell authored
      Summary: This is more efficient for some underlying transports, including Fizz.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D33724711
      
      fbshipit-source-id: 35ebcce83da4a9289f7f083c8873142e9b844ca0
      594b7e77
    • Rob Rios's avatar
      Add mock writem in AsyncUDPSocket · 7f73100f
      Rob Rios authored
      Summary: Add writem method to MockAsyncUDPSocket.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D33696768
      
      fbshipit-source-id: eb99650f3dcde4eacbf83be3dd8ef9d2c03c6200
      7f73100f
  6. 21 Jan, 2022 4 commits
    • Alex Hornby's avatar
      use the new --force-local-execution option · 61ad883b
      Alex Hornby authored
      Summary: Use the new tpx option to run tests locally on the OSS CI hosts
      
      Reviewed By: bigfootjon
      
      Differential Revision: D33454014
      
      fbshipit-source-id: dcf49dcebcd476c68b3eb46eb013079c30db52c7
      61ad883b
    • Yedidya Feldblum's avatar
      exception_shared_string · 34c678f8
      Yedidya Feldblum authored
      Summary:
      A refcounted-string type suitable for exception types.
      
      Exception types should ordinarily be nothrow-copy-constructible, which excludes holding `std::string` fields, and should ordinarily be as small as possible, which excludes holding `std::shared_ptr<std::string>` fields.
      
      Reviewed By: luciang
      
      Differential Revision: D33010058
      
      fbshipit-source-id: ae71f00d2053c9c52b9a980d028dce8397704cda
      34c678f8
    • Adel Abouchaev's avatar
      Support variable length socket options. · fa92f656
      Adel Abouchaev authored
      Summary: Add a feature to apply and read variable length socket options.
      
      Differential Revision: D33410246
      
      fbshipit-source-id: 3407a926c2ba9323a2318f3d34f8e1f1173bde59
      fa92f656
    • Matthias Braun's avatar
      Work around clang ToT syntax error · bb743c35
      Matthias Braun authored
      Summary: Work around "incompatible pointer types assigning" errors reported by clang top-of-tree.
      
      Reviewed By: Gownta
      
      Differential Revision: D33482980
      
      fbshipit-source-id: 2d7cf408c45ae96540c5c7779f8462f01d5b3498
      bb743c35
  7. 20 Jan, 2022 6 commits
    • Chad Austin's avatar
      fix boost build on single-core machines · 65098360
      Chad Austin authored
      Summary:
      On a single-core Ubuntu VM, getdeps attempts to pass -j0 to Boost Jam,
      which fails.
      
      Reviewed By: fanzeyi
      
      Differential Revision: D33675531
      
      fbshipit-source-id: 629ee41448941213aadec10658583d8f984b13c2
      65098360
    • Ilya Albrecht's avatar
      Implement automatic scaling benchmark · 4a022b1b
      Ilya Albrecht authored
      Summary:
      Original implementation uses minimum running time as a result even if it will be just a single iteration, which might introduce high error rate.
      
      This diff targets to improve benchmarking stability by adding a new method that estimates running time over 1 sec, runs benchmark with multiple ecpoches about half a second each for 5 sec, drops top and bottom 25% percentile measurements to remove outliers, and gives a geomean of whats left.
      
      This feature is not enabled by default, as it might considarably increse total running time, and can be turned on by using `-bm_estimate_time` knob.
      
      Reviewed By: Gownta
      
      Differential Revision: D33478923
      
      fbshipit-source-id: 144d8e16f8279a30a1eccf1d9494d607893532c8
      4a022b1b
    • Chad Austin's avatar
      Back out "cmake needs openssl" · 7211f124
      Chad Austin authored
      Summary:
      Original commit changeset: 2f869768f3a8
      
      Original Phabricator Diff: D33432903 (https://github.com/facebook/folly/commit/e7eb2bb6db6c4b8f7ecb368236c2244d07b58f91)
      
      The prior commit broke the open source build for Watchman:
      
      ```
      Exception: project openssl has no builder for <getdeps.manifest.ManifestContext object at 0x7f053d23fe80>
      ```
      
      Reviewed By: lnicco
      
      Differential Revision: D33675540
      
      fbshipit-source-id: cdf11a967a2234263e5713eaf2959ec9dc2b0e52
      7211f124
    • Kenny Yu's avatar
      symbolizer: Allow Symbolizer to take a path to binary · e018a713
      Kenny Yu authored
      Summary:
      Previously by default, `Symbolizer` would always use the current process's
      binary by looking at `/proc/self/exe`. This change allows passing a
      different binary name to `Symbolizer` so that we can reuse this library
      to look up symbol information of a different process that is executed
      from a different binary.
      
      Reviewed By: Gownta
      
      Differential Revision: D33558166
      
      fbshipit-source-id: 12c6ae3aa8c5d88caaef7933edb2c69bc896d75b
      e018a713
    • Marcus Holland-Moritz's avatar
      Replace std::is_pod<> which is deprecated in C++20 (#1695) · 515b5b68
      Marcus Holland-Moritz authored
      Summary:
      Warnings are triggered by `is_pod<>` with both Clang and GCC when
      using `-std=c++20`.
      
      This change replaces all instances of `is_pod<T>::value` with
      `(is_standard_layout<T>::value && is_trivial<T>::value)`, which
      is equivalent and even suggested by both compilers.
      
      Pull Request resolved: https://github.com/facebook/folly/pull/1695
      
      Reviewed By: Gownta
      
      Differential Revision: D33483730
      
      Pulled By: Orvid
      
      fbshipit-source-id: 79bd867c7e019f614c6187ca9ca5c44d65bf6310
      515b5b68
    • Yedidya Feldblum's avatar
      let coro malloc/free use wrappers · d9619f27
      Yedidya Feldblum authored
      Summary: The coroutine library has non-elidable wrappers for alloc/dealloc. They directly call `operator new` and `operator delete` but, of course, they have conditionals. Switch to the wrappers which handle the conditionals.
      
      Reviewed By: luciang
      
      Differential Revision: D33181403
      
      fbshipit-source-id: ab8d56634569b82680b36d6b72fb9ff7f5c05f19
      d9619f27
  8. 19 Jan, 2022 3 commits
  9. 18 Jan, 2022 2 commits
    • Shai Szulanski's avatar
      Delete unused multiplex and de/materialize algorithms · 7c7597c2
      Shai Szulanski authored
      Summary: The CallbackRecord interface is unfamiliar to users and inconsistent with the general direction of folly::coro, and as a result these algorithms have not seen any usage. Deletes them and moves CallbackRecord into the only file that uses it. (We may eventually want to replace it if we come up with a story for Try<Reference> but I'm not tackling that here).
      
      Differential Revision: D33570204
      
      fbshipit-source-id: 9cfb0def927e5882f582d6c1eb280d97c9ff3e22
      7c7597c2
    • Zsolt Dollenstein's avatar
      Add --shared-libs arg to getdeps.py · 7880abd1
      Zsolt Dollenstein authored
      Summary:
      This diffs adds
      * `--shared-libs` command line argument to the `build` command which enables building shared libraries for supported projects (cmake-based projects, boost, libevent)
      * this flag overrides `BUILD_SHARED_LIBS` cmake flags in manifest files and from `--extra-cmake-defines`
      * adds `shared_libs=on` expression support in manifest files
      * for boost, the flag enables building shared libraries **in addition to** statically linked ones
      
      Reviewed By: simonmar
      
      Differential Revision: D27462289
      
      fbshipit-source-id: d22ab434f7228c30472611bc323830d88efba0a5
      7880abd1
  10. 15 Jan, 2022 2 commits
    • Mike Kolupaev's avatar
      Clarify comment for coro::merge() · dd5e8b4f
      Mike Kolupaev authored
      Summary: Based on scsiguy's feedback. Probably it can be made shorter and clearer still, feel free to propose more changes.
      
      Reviewed By: scsiguy
      
      Differential Revision: D33591287
      
      fbshipit-source-id: e0bf85ebfd98d7032ddbd54c69c52b33525a62c7
      dd5e8b4f
    • Adam Hupp's avatar
      Fix mixed MSVC/clang-cl build (#1617) · 9d608677
      Adam Hupp authored
      Summary:
      An executable built by clang-cl that is linked against folly/logging
      from vcpkg will fail to link due to a few missing symbols.  folly/logging
      has a number of functions that are only defined when `__INCLUDE_LEVEL__` is defined.
      vcpkg always uses MSVC, MSVC does not support this macro while clang-cl does,
      resulting in mismatch between what is defined, used, and declared.
      
      These ifdefs mostly came from fc507b26.
      
      The (minor IMO) negative consequence of this diff is that
      `XlogFileScopeInfo` will be unnecessarily larger (a pointer and an uint32)
       on compilers that don't support `__INCLUDE_LEVEL__` (e.g MSVC).
      
      The actual condition of whether to make use of `__INCLUDE_LEVEL__` remains, via the `XLOG_IS_IN_HEADER_FILE` macro.
      
      Pull Request resolved: https://github.com/facebook/folly/pull/1617
      
      Reviewed By: yfeldblum
      
      Differential Revision: D29753787
      
      Pulled By: Orvid
      
      fbshipit-source-id: 28f8128c981b255960d7838d2df2a3d299153bc2
      9d608677