1. 23 Mar, 2020 3 commits
    • Lee Howes's avatar
      Add logging for blocking using baton while on an executor · 55fc4b32
      Lee Howes authored
      Summary:
      Add sampled logging of blocking operations made on folly::Baton from within an executor task.
      
      Relies on thread_local state recording whether we are in a context where blocking is disallowed, which means within a task running on an executor with support for the functionality. Functionality is currently limited to certain executors, and to blocking operations on Baton, but this covers common user-facing APIs like Future.
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D20010963
      
      fbshipit-source-id: c0598e1a3a9c4e3641581e561b678a2b241998ff
      55fc4b32
    • Adam Simpkins's avatar
      exclude eden/scm build artifacts from the getdeps path map · f6ef5d3c
      Adam Simpkins authored
      Summary:
      If you have built the `eden/scm` subdirectory with `make local` in your
      repository it will have left a bunch of build output artifacts in the source
      tree.  Update the getdeps shipit path map for eden to explicitly exclude many
      of these build artifacts.
      
      In particular:
      - Exclude `eden/scm/build/` since this directory can contains a lot of files.
      - Exclude all `*.pyc` files since there may be a reasonable number of these.
      - Exclude several Cargo-related files since these will cause problems when
        trying to build Rust code.
      
      Reviewed By: chadaustin
      
      Differential Revision: D20570720
      
      fbshipit-source-id: a60dec4854ae470fdb58e9651fd8a3b910c76004
      f6ef5d3c
    • Wez Furlong's avatar
      folly: to_narrow for windows compatibility · efd0e727
      Wez Furlong authored
      Summary:
      The default warning settings for the MSVC compiler result in an
      extremely noisy build output, to the point where it can take minutes of reading
      through pages of output to locate the actual error when debugging a build
      problem.  The majority of these warnings are the result of implicit integer
      narrowing that is silently permitted in our posix builds.
      
      Rather than blanket suppress these conversion warnings and mask potential bugs,
      this commit makes a pass over the code and adds `folly::to_narrow` to a number
      of call sites to make it explicit that a narrowing operation is taking place
      and that it is (probably!) intentional.   We make a lot of assumptions
      throughout our various projects that we won't allow data larger than 2GB
      through eg: thrift and as a result, a lot of wire/serialization related code
      uses `uint32_t` for sizes instead of `size_t`.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D20562029
      
      fbshipit-source-id: 706ba9cf330d40a2b3f911e5e9a8b9de325ebc80
      efd0e727
  2. 20 Mar, 2020 4 commits
    • Giuseppe Ottaviano's avatar
      Type-erase setCallback · 940c095e
      Giuseppe Ottaviano authored
      Summary:
      `setCallback()` functions just store the argument as a `Function`, so we don't need to specialize the templates all the way down, we can pass directly a `Function`.
      
      This reduces code size, and should not have runtime impact: either the move is elided in both cases, or if not there's no particular reason why a `Function` move should be more expensive than an arbitrary functor's (could even be faster).
      
      Reviewed By: yfeldblum, luciang
      
      Differential Revision: D20561695
      
      fbshipit-source-id: 1973c47a5410a43eb44beea36cb1105663094eb3
      940c095e
    • Shrikrishna Khare's avatar
      Script to build OpenNSA kernel modules · e7b465ec
      Shrikrishna Khare authored
      Summary:
      OpenNSA has prebuilt SDK but kernel modules have to be built from sources. Add
      a utility script to build and extend packaging script.
      
      In future, we can consider folding this build into fbcode_builder itself.
      
      Differential Revision: D20549883
      
      fbshipit-source-id: f9475b7e0223e9f357117d7d7d27df8904fa1d73
      e7b465ec
    • Pranav Thulasiram Bhat's avatar
      Fix doc in SharedMutex · a795f497
      Pranav Thulasiram Bhat authored
      Summary: Correct typo
      
      Reviewed By: lewissbaker
      
      Differential Revision: D20544820
      
      fbshipit-source-id: f9edffd0a44448fd558b3e659585044f9be81035
      a795f497
    • Koray Polat's avatar
      Update fmt from 5.3.0 to 6.1.1 · e8fe8fc4
      Koray Polat authored
      Summary: Updated fmt version to be on par with buck build. It was causing inconsistencies.
      
      Reviewed By: vitaut
      
      Differential Revision: D20528011
      
      fbshipit-source-id: d9e04ed2c28b839eaeff24120162c4db4732fa55
      e8fe8fc4
  3. 19 Mar, 2020 5 commits
    • Yedidya Feldblum's avatar
      Cut unused includes in folly/experimental/symbolizer/ElfCache.h · 8fa800e8
      Yedidya Feldblum authored
      Summary: [Folly] Cut unused `#include`s in `folly/experimental/symbolizer/ElfCache.h`.
      
      Reviewed By: Orvid
      
      Differential Revision: D20482493
      
      fbshipit-source-id: 426ebe0aa55e116e3f3c8095b0c9d0f1babdb354
      8fa800e8
    • Xavier Deguillard's avatar
      revisionstore: add a LFS remote store · 8a1bd857
      Xavier Deguillard authored
      Summary:
      This enables fetching blobs from the LFS server. For now, this is limited to
      fetching them, but the protocol specify ways to also upload. That second part
      will matter for commit cloud and when pushing code to the server.
      
      One caveat to this code is that the LFS server is not mocked in tests, and thus
      requests are done directly to the server. I chose very small blobs to limit the
      disruption to the server, by setting a test specific user-agent, we should be
      able to monitor traffic due to tests and potentially rate limit it.
      
      Reviewed By: DurhamG
      
      Differential Revision: D20445628
      
      fbshipit-source-id: beb3acb3f69dd27b54f8df7ccb95b04192deca30
      8a1bd857
    • Andrii Grynenko's avatar
      makeValueObserver · 33849b67
      Andrii Grynenko authored
      Summary: Helper observer which only triggers updates when the value changes.
      
      Reviewed By: bithree
      
      Differential Revision: D20521319
      
      fbshipit-source-id: 77e45d92f710b1701552cf29445f44aa9d9487f4
      33849b67
    • Lee Howes's avatar
      replace [[nodiscard] with FOLLY_NODISCARD · 7be4309f
      Lee Howes authored
      Summary: Correct use of portability macro.
      
      Reviewed By: yfeldblum, manderyao
      
      Differential Revision: D20520392
      
      fbshipit-source-id: b21fb13aa7a523db21a506b71e65047edbb17684
      7be4309f
    • Chad Austin's avatar
      fix unused parameter warnings · 05cf1d41
      Chad Austin authored
      Summary: Fix two small warnings when building AsyncUDPSocket on macOS.
      
      Reviewed By: fanzeyi
      
      Differential Revision: D20525411
      
      fbshipit-source-id: 39cd84364413d434d261c17c4c8a87e31ac75a42
      05cf1d41
  4. 18 Mar, 2020 8 commits
    • Dan Melnic's avatar
      Add support for creating an EventBaseManager with a custom backend factory method · 00c84e07
      Dan Melnic authored
      Summary:
      Add support for creating an EventBaseManager with a custom backend factory method
      
      (Note: this ignores all push blocking failures!)
      
      Reviewed By: kevin-vigor
      
      Differential Revision: D20513736
      
      fbshipit-source-id: 62edc876cd1c0667bd7beb85a3d6fbd9a5a03ebf
      00c84e07
    • Dan Melnic's avatar
      Return 0(success) in EventBaseEvent::eb_event_base_set if we're trying to use... · 3df1b70d
      Dan Melnic authored
      Return 0(success) in EventBaseEvent::eb_event_base_set if we're trying to use a non libevent backend
      
      Summary: Return 0(success) in EventBaseEvent::eb_event_base_set if we're trying to use a non libevent backend
      
      Reviewed By: kevin-vigor
      
      Differential Revision: D20513609
      
      fbshipit-source-id: 8329c614f728a86d1bd5267652c39c8d4f54f6cd
      3df1b70d
    • Dan Melnic's avatar
      Allow the WTCallback to be used with timer managers that have timeoutExpired methods · c79a6fde
      Dan Melnic authored
      Summary: Allow the WTCallback to be used with timer managers that have timeoutExpired methods
      
      Reviewed By: kevin-vigor
      
      Differential Revision: D20503031
      
      fbshipit-source-id: df91f1e2531f5c54943d3540bdf7c3d357c9fda1
      c79a6fde
    • TJ Yin's avatar
      fix flaky unit-test CodelTest · 101ac180
      TJ Yin authored
      Summary:
      Sometimes it fails to throw exception in [Codel::setOptions](https://github.com/facebook/folly/blob/master/folly/executors/Codel.cpp#L109), since it failed the check `interval <= delay`.
      
      The reason is that both interval and delay are [POD](https://github.com/facebook/folly/blob/master/folly/executors/Codel.h#L80-L81), thus both are not initialized by default.
      
      Using them without initialization is UB. In x86, they will have random value (since x86 doesn't have trap representation), thus sometimes it passes, sometimes it fails.
      
      Based on comment, it looks like the intention is copying the `options` from default initialized `Codel`.
      
      Reviewed By: amlannayak
      
      Differential Revision: D20499449
      
      fbshipit-source-id: e12de0b42c02a8bf6379ba7fd224e0ae173945f0
      101ac180
    • Dan Melnic's avatar
      Add eb_signal_set, eb_timer_set methods to be in sync with libevent · 4aef2fa3
      Dan Melnic authored
      Summary:
      Add eb_signal_set, eb_timer_set methods to be in sync with libevent
      
      (Note: this ignores all push blocking failures!)
      
      Reviewed By: kevin-vigor
      
      Differential Revision: D20513498
      
      fbshipit-source-id: be8d5d0ca362bdaa86cc161f481aea93cc757c75
      4aef2fa3
    • Lee Howes's avatar
      Current thread executor · 5c4e6238
      Lee Howes authored
      Summary: A thread-local query for the current executor. Grounding feature for logging operations.
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D20070133
      
      fbshipit-source-id: e320d2a3d97744b91c07a6060708e5cefc517cb7
      5c4e6238
    • Maged Michael's avatar
      RequestContext: Use hazard pointer-based implementation by default · 8a3363fa
      Maged Michael authored
      Summary: Make the hazard pointer-based implementation of request context the default one by setting `folly_reqctx_use_hazptr` to true by default.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D19145252
      
      fbshipit-source-id: 5dd68fb92561685a6ee35d8b3b03a1dcf7e1e356
      8a3363fa
    • Dmytro Stechenko's avatar
      fix duplicated symbols for dynamic::TypeInfo members · 2ca4c388
      Dmytro Stechenko authored
      Summary:
      while compiling on windows see duplicated symbols:
      ```
      lld-link: error: duplicate symbol:
      public: static char const *const folly::dynamic::TypeInfo<
      class std::basic_string<char, struct std::char_traits<char>,
      class std::allocator<char>>>::name
      in buck-out\dev\gen\crypto\cat\cpp\tests\crypto_auth_token_util_test#compile-CryptoAuthTokenUtilTest.cpp.obj1f5bc0bc,windows-x86_64\out.obj
      and in libdynamic.lib(out.obj)
      ```
      
      Reviewed By: yfeldblum
      
      Differential Revision: D20426321
      
      fbshipit-source-id: 4e0346c624ad12561adb14f3a2e5f6e15bbbba26
      2ca4c388
  5. 17 Mar, 2020 4 commits
    • Brian Gesiak's avatar
      Remove workaround for co_return with uniform initializer · c761da7b
      Brian Gesiak authored
      Summary:
      This workaround is no longer necessary for a Clang that includes
      patch https://reviews.llvm.org/D76118.
      
      Reviewed By: ispeters, lewissbaker
      
      Differential Revision: D20486353
      
      fbshipit-source-id: cab137ed557ba8aa6ec86ec7011cc4fc7c46fe82
      c761da7b
    • Dmytro Stechenko's avatar
      fix -Wsign-compare in hazptr · 21dc1d37
      Dmytro Stechenko authored
      Summary:
      building on windows fails:
      ```
      buck-out/cells/fbsource/gen/xplat/third-party/glog/glogWindows#header-mode-symlink-tree-only,headers\glog/logging.h:698:32:
      error: comparison of integers of different signs: 'const unsigned long long' and 'const int' [-Werror,-Wsign-compare]
      
      buck-out/dev/gen/folly/synchronization/hazptr#header-mode-symlink-tree-only,headers\folly/synchronization/HazptrObj.h:397:13:
      note: in instantiation of function template specialization 'google::Check_EQImpl<unsigned long long, int>' requested here
                  DCHECK_EQ(reinterpret_cast<uintptr_t>(p) & 7, 0) << p << " " << i;
      ```
      
      Reviewed By: yfeldblum
      
      Differential Revision: D20482798
      
      fbshipit-source-id: 4b661121401890cec113905fc6b53cd9189fcca0
      21dc1d37
    • Luca Niccolini's avatar
      VERSION_ID in /etc/os-release is not mandatory · 1e93e64f
      Luca Niccolini authored
      Summary:
      e.g. debian doesn't seem to have it
      ```
      $ cat /etc/os-release
      PRETTY_NAME="Debian GNU/Linux bullseye/sid"
      NAME="Debian GNU/Linux"
      ID=debian
      HOME_URL="https://www.debian.org/"
      SUPPORT_URL="https://www.debian.org/support"
      BUG_REPORT_URL="https://bugs.debian.org/"
      ```
      
      Reviewed By: mjoras
      
      Differential Revision: D20483097
      
      fbshipit-source-id: 722397ff994336884ed2e5bbf8fe517d4dcf4e6c
      1e93e64f
    • David Carlier's avatar
      FreeBSD and/or clang build fix. (#1317) · 72f1c293
      David Carlier authored
      Summary:
      clang being more strict with obsolete C++14 api, has
      completely disabled them in this context.
      Pull Request resolved: https://github.com/facebook/folly/pull/1317
      
      Reviewed By: luciang, markisaa
      
      Differential Revision: D20154780
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: 1ff36fecd3406802c3f393dfdd5dbe2f30656567
      72f1c293
  6. 16 Mar, 2020 3 commits
    • Lee Howes's avatar
      Fix retrying to correctly deal with a SemiFuture-returning policy · db0e476d
      Lee Howes authored
      Summary: Retrying was modified to support SemiFuture returning policy and function, but incorrectly handled the return type propagation. Fix the problem and add a test to verify.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D20462982
      
      fbshipit-source-id: 97b4dad6d83dbbfe7f1846b457bf915c14b9f31a
      db0e476d
    • Jeff McGlynn's avatar
      Fix build errors with -Wvla on Mac/iOS · 3697fb05
      Jeff McGlynn authored
      Summary:
      Conv.h's detail::digitsEnough was not decomposing to a constexpr on iOS/Mac toolchains, which resulted in the following call becoming a runtime VLA:
      
      ```
      char buffer[detail::digitsEnough<unsigned __int128>() + 1];
      ```
      
      Update to use `numeric_limits<>::digits10`, which allows this function to evaluate at compile-time on iOS/Mac.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D20440659
      
      fbshipit-source-id: d086e367eec0d3b2f35465525cb7406e746e6df7
      3697fb05
    • Yedidya Feldblum's avatar
      Unqualify uses of folly::AsyncUDPSocket::ReadCallback::OnDataAvailableParams · 0dd89890
      Yedidya Feldblum authored
      Summary: Unqualify nearly all uses of `folly::AsyncUDPSocket::ReadCallback::OnDataAvailableParams` since nearly all uses already have `OnDataAvailableParams` in scope.
      
      Differential Revision: D20450063
      
      fbshipit-source-id: c0fd49a7eace44a6edc8086762c44753224788dd
      0dd89890
  7. 15 Mar, 2020 3 commits
    • Pádraig Brady's avatar
      folly: fix clash with std::reduce with libgcc >= 9.3.0 · 13655b8a
      Pádraig Brady authored
      Summary:
      This code is new in 9.3.0, introduced upstream with:
      https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=ed920373
      Unless we qualify folly::reduce() we get the clash
      in P127472223 when running the test plan.
      
      Reviewed By: meyering
      
      Differential Revision: D20461173
      
      fbshipit-source-id: 41b21e9215571da2cbd2ef7f817e2d9999083033
      13655b8a
    • Yedidya Feldblum's avatar
      FOLLY_SSSE · d9407ff2
      Yedidya Feldblum authored
      Summary: [Folly] `FOLLY_SSSE`, for testing compiler mode support for SSSE3 intrinsics.
      
      Reviewed By: markisaa
      
      Differential Revision: D20414435
      
      fbshipit-source-id: 077a78f880ea8dce44f1aced38a6cca08cdd1f65
      d9407ff2
    • Yedidya Feldblum's avatar
      Move remove_reference_wrapper to coro traits · f08234c4
      Yedidya Feldblum authored
      Summary: [Folly] Move remove_reference_wrapper to coro traits, since this is not a language-level trait and is there to be used in the coro library.
      
      Reviewed By: iahs
      
      Differential Revision: D20301017
      
      fbshipit-source-id: aa78488cc5138e6ade9dcbc99ec1b75b65c74c78
      f08234c4
  8. 14 Mar, 2020 3 commits
    • Daryl Johnas Sison's avatar
      Revert D20443631: Fix compilation errors for C++20 · 30f1c257
      Daryl Johnas Sison authored
      Differential Revision:
      D20443631
      
      Original commit changeset: 03e8210a64a3
      
      fbshipit-source-id: 42621768beab530619aba877015dd48d509bc62b
      30f1c257
    • Scott Ramsby's avatar
      Fix mode_t to match Linux and be overridable (#1335) · f84ad364
      Scott Ramsby authored
      Summary:
      `unsigned int` is a more typical definition of the mode_t type on Linux systems, which is what this is trying to emulate.
      
      Also guard by checking that HAVE_MODE_T isn't already define to allow clients to suppress its definition in cases where other client-used libraries (e.g. wxWindows) have their own definition which may conflict.
      Pull Request resolved: https://github.com/facebook/folly/pull/1335
      
      Reviewed By: yfeldblum
      
      Differential Revision: D20408879
      
      Pulled By: scramsby
      
      fbshipit-source-id: 511484f6513501bf595ccb9cdfb893c9d5761320
      f84ad364
    • Laurent Stacul's avatar
      Fix compilation errors for C++20 (#1329) · dacd7bf0
      Laurent Stacul authored
      Summary:
      Compiling with gcc 10.0.1 and -std=gnu++2a, we have the following errors:
      ```
      folly/FBString.h:1013:33: error: no type named 'reference' in 'class std::allocator<char>'
       1013 |   typedef typename A::reference reference;
            |                                 ^~~~~~~~~
      folly/FBString.h:1014:39: error: no type named 'const_reference' in 'class std::allocator<char>'
       1014 |   typedef typename A::const_reference const_reference;
      ```
      This is due to the fact many members in `std::allocator` have been remove in C++20: https://en.cppreference.com/w/cpp/memory/allocator
      
      We also have this one due to the new way C++ resolves the comparison operators:
      ```
      folly/dynamic-inl.h:854:20: error: ambiguous overload for 'operator!=' (operand types are 'folly::dynamic::const_item_iterator' and 'folly::dynamic::const_item_iterator')
        854 |   return find(key) != items().end() ? 1u : 0u;
            |          ~~~~~~~~~ ^~ ~~~~~~~~~~~~~
            |              |                   |
            |              |                   folly::dynamic::const_item_iterator
            |              folly::dynamic::const_item_iterator
      In file included from folly/dynamic-inl.h:25,
                       from folly/dynamic.h:796,
                       from folly/dynamic.cpp:17:
      folly/detail/Iterators.h:80:8: note: candidate: 'bool folly::detail::IteratorFacade<D, V, Tag>::operator==(const D&) const [with D = folly::dynamic::const_item_iterator; V = const std::pair<const folly::dynamic, folly::dynamic>; Tag = std::f
      orward_iterator_tag]' (reversed)
         80 |   bool operator==(D const& rhs) const {
            |        ^~~~~~~~
      folly/detail/Iterators.h:98:3: note: candidate: 'typename std::enable_if<std::is_convertible<D, D2>::value, bool>::type folly::detail::IteratorFacade<D, V, Tag>::operator==(const D2&) const [with D2 = folly::dynamic::const_item_iterator; D =
       folly::dynamic::const_item_iterator; V = const std::pair<const folly::dynamic, folly::dynamic>; Tag = std::forward_iterator_tag; typename std::enable_if<std::is_convertible<D, D2>::value, bool>::type = bool]' (reversed)
         98 |   operator==(D2 const& rhs) const {
            |   ^~~~~~~~
      folly/detail/Iterators.h:84:8: note: candidate: 'bool folly::detail::IteratorFacade<D, V, Tag>::operator!=(const D&) const [with D = folly::dynamic::const_item_iterator; V = const std::pair<const folly::dynamic, folly::dynamic>; Tag = std::f
      orward_iterator_tag]'
         84 |   bool operator!=(D const& rhs) const {
            |        ^~~~~~~~
      folly/detail/Iterators.h:103:8: note: candidate: 'bool folly::detail::IteratorFacade<D, V, Tag>::operator!=(const D2&) const [with D2 = folly::dynamic::const_item_iterator; D = folly::dynamic::const_item_iterator; V = const std::pair<const f
      olly::dynamic, folly::dynamic>; Tag = std::forward_iterator_tag]'
        103 |   bool operator!=(D2 const& rhs) const {
            |        ^~~~~~~~
      ```
      Pull Request resolved: https://github.com/facebook/folly/pull/1329
      
      Reviewed By: ot, igorsugak
      
      Differential Revision: D20443631
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: 03e8210a64a3eeaefb6f14afaddf45be882e3ba6
      dacd7bf0
  9. 13 Mar, 2020 5 commits
  10. 12 Mar, 2020 2 commits
    • Victor Zverovich's avatar
      Move toStdString to FBString.h · c80c8e6c
      Victor Zverovich authored
      Summary: Move `toStdString` to `FBString.h` because it's fbstring-related and remove the dependency between `String.h` and `FBString.h`. This is possible because the only other use of fbstring in `String.h` is removed in previous diff.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D20195591
      
      fbshipit-source-id: b5ff7c918669e063e24bf91155a2496f82d7e975
      c80c8e6c
    • Dan Melnic's avatar
      Add ThreadWheelTimekeeperHighRes class · e5ccead7
      Dan Melnic authored
      Summary: Add ThreadWheelTimekeeperHighRes class
      
      Reviewed By: LeeHowes
      
      Differential Revision: D20355093
      
      fbshipit-source-id: b76563a3706d7732b490a88096fed484954820e5
      e5ccead7