1. 13 Feb, 2019 4 commits
    • Caleb Marchent's avatar
      Include range in the folly python extensions (#1013) · 9d8a3f73
      Caleb Marchent authored
      Summary:
      range.pxd needs to be exported; so that fbtrhift-py3 can compile against it
      Pull Request resolved: https://github.com/facebook/folly/pull/1013
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13987018
      
      Pulled By: calebmarchent
      
      fbshipit-source-id: 7b7e6f62e5bc23e70a3c263fb3b33cf1d439e439
      9d8a3f73
    • Yedidya Feldblum's avatar
      Remove disabled code from FOR_EACH_RANGE · f2c0cfdd
      Yedidya Feldblum authored
      Summary: [Folly] Remove disabled code from `FOR_EACH_RANGE`.
      
      Reviewed By: aary
      
      Differential Revision: D14062987
      
      fbshipit-source-id: 6d01e76debc46398ceae3be435691c20595d393e
      f2c0cfdd
    • Yedidya Feldblum's avatar
      pretty_name · 86ec30e9
      Yedidya Feldblum authored
      Summary:
      [Folly] `pretty_name`, for getting static type pretty-names without RTTI.
      
      Available as constant expressions - no runtime overhead.
      
      Depends on per-platform non-specified magic symbols. May not work everywhere.
      
      Reviewed By: aary
      
      Differential Revision: D14019723
      
      fbshipit-source-id: e50557261024298cd37957b94dad3a10c927ee97
      86ec30e9
    • Yedidya Feldblum's avatar
      Cut macro FOR_EACH_RANGE_R · ff5f718e
      Yedidya Feldblum authored
      Summary: [Folly] Cut macro `FOR_EACH_RANGE_R`.
      
      Reviewed By: aary, danobi
      
      Differential Revision: D14058731
      
      fbshipit-source-id: d31c0673785d467665598e2138b6b6082d9629ab
      ff5f718e
  2. 12 Feb, 2019 4 commits
  3. 11 Feb, 2019 3 commits
  4. 10 Feb, 2019 1 commit
    • Yedidya Feldblum's avatar
      Always define FOLLY_HAS_RTTI · df5a0575
      Yedidya Feldblum authored
      Summary: [Folly] Always define `FOLLY_HAS_RTTI` to either `0` or `1`.
      
      Reviewed By: LeeHowes
      
      Differential Revision: D14018830
      
      fbshipit-source-id: 5212f3f6269067fc6326e293cedb243e650f71db
      df5a0575
  5. 09 Feb, 2019 2 commits
    • Dongyi Ye's avatar
      Add an option to use clientAddress hash to despatch UDP packets. · 150a10cf
      Dongyi Ye authored
      Summary:
      Currently udp socket send packet to listener in a round robin fashion. This will cause issue if there are more than one packet in one "session". Because packets from one session could be routed to two different listeners.
      
      This diff added a packet dispatch option which use clientAddress (address family + ip + port) hashing. In this way, the packets from same client will always routed to same listener when the total number of listener is consistent.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13994665
      
      fbshipit-source-id: e450c2fcbc95c55cb37cb5cda13c5df6d8119812
      150a10cf
    • Yedidya Feldblum's avatar
      Make Init non-moveable · 35b194e8
      Yedidya Feldblum authored
      Summary: [Folly] Make Init non-moveable to break code that could trigger early invocation of the moved-from instance's destructor when copy elision is not applied.
      
      Reviewed By: markisaa
      
      Differential Revision: D14002508
      
      fbshipit-source-id: faf8de587c0573d14d9b1082b7f531e147c48ed7
      35b194e8
  6. 08 Feb, 2019 9 commits
    • Yedidya Feldblum's avatar
      Detect libc++ std version in folly::chrono backports · 7f0aea22
      Yedidya Feldblum authored
      Summary: [Folly] Detect libc++ std version in `folly::chrono` backports, since libc++ does not define the recommended feature macros.
      
      Reviewed By: wez
      
      Differential Revision: D14002296
      
      fbshipit-source-id: 022085658aee3a453c5aea714f75f27013825c6f
      7f0aea22
    • Orvid King's avatar
      Remove AsyncSocket.getFd · 5bcb4a7a
      Orvid King authored
      Summary: It's dead now.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13629451
      
      fbshipit-source-id: f4a79919ba20a13b6afd59b5e4605bf8faa3c6ad
      5bcb4a7a
    • Orvid King's avatar
      Shift calls of AsyncServerSocket.getSocket to AsyncServerSocket.getNetworkSocket · 44b142c4
      Orvid King authored
      Summary: The file-descriptor backed API will be going away.
      
      Reviewed By: yfeldblum, ryantimwilson
      
      Differential Revision: D13603038
      
      fbshipit-source-id: d89d3a3836ab551ec92c2fb1f74248cc2119ba03
      44b142c4
    • Adam Norton's avatar
      EvictingCacheMap::insert · 57e26df8
      Adam Norton authored
      Summary: Add insert method to mimic std::unordered_map::insert. Allows for insertion without overwriting an existing element.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13928583
      
      fbshipit-source-id: 54f0eb5069b753bcaca55b04c09968d12dceb5e3
      57e26df8
    • Andrii Grynenko's avatar
      Implement blockingWait for coro::Task · df20b646
      Andrii Grynenko authored
      Reviewed By: lewissbaker
      
      Differential Revision: D14002394
      
      fbshipit-source-id: 8f0422d66c6b6859ec42a6ee5ea58c97e9a15de9
      df20b646
    • Wez Furlong's avatar
      folly: resolve ambiguous floor overload on macos · 3f488e75
      Wez Furlong authored
      Summary:
      This manifested once D13765262 landed, but is likely
      more closely related to the changes in D4375603:
      
      ```
      In file included from /Users/facebook/wez-fbsource/fbcode/watchman/external/folly/folly/io/async/TimeoutManager.cpp:21:
      /Users/facebook/wez-fbsource/fbcode/watchman/external/folly/folly/Chrono.h:153:32: error: call to 'floor' is ambiguous
        return detail::round_impl(d, floor<To>(d));
                                     ^~~~~~~~~
      /Users/facebook/wez-fbsource/fbcode/watchman/external/folly/folly/io/async/TimeoutManager.cpp:77:44: note: in instantiation of function template specialization 'folly::chrono::round<std::__1::chrono::duration<long
            long, std::__1::ratio<1, 1000> >, long long, std::__1::ratio<1, 1000000>, void>' requested here
        timeout_type timeout_ms = folly::chrono::round<timeout_type>(timeout);
                                                 ^
      /usr/local/fbprojects/packages/xcode/104/xcode_10.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/chrono:444:1: note: candidate function [with _ToDuration =
            std::__1::chrono::duration<long long, std::__1::ratio<1, 1000> >, _Rep = long long, _Period = std::__1::ratio<1, 1000000>]
      floor(const duration<_Rep, _Period>& __d)
      ^
      /Users/facebook/wez-fbsource/fbcode/watchman/external/folly/folly/Chrono.h:127:14: note: candidate function [with To = std::__1::chrono::duration<long long, std::__1::ratio<1, 1000> >, Rep = long long, Period =
            std::__1::ratio<1, 1000000>, $3 = void]
      constexpr To floor(std::chrono::duration<Rep, Period> const& d) {
                   ^
      ```
      
      this diff resolves the ambiguity in favor of `folly::chrono::floor`.
      
      Reviewed By: bolinfest
      
      Differential Revision: D14000897
      
      fbshipit-source-id: 669dbf3573c3799cb21e14f247acc8d053afe746
      3f488e75
    • Adam Simpkins's avatar
      logging: move the fatal_helper test program to test/helpers · b23981b8
      Adam Simpkins authored
      Summary:
      Move `FatalHelper.cpp` to the new folly/logging/test/helpers directory created
      in D13984692.
      
      Reviewed By: yfeldblum, dmaone
      
      Differential Revision: D13994517
      
      fbshipit-source-id: e2b7e4b4f649fed5b882df47424d24e4fc4f717a
      b23981b8
    • Adam Simpkins's avatar
      logging: fix a crash when using logging after main() returns · 4a2619fe
      Adam Simpkins authored
      Summary:
      Fix a problem where `LoggerDB::get()` could crash when called after `main()`
      has returned.
      
      The `LoggerDBSingleton` object may have been destroyed already, so calling
      `LoggerDBSingleton::getDB()` was not allowed.  This updates the code to just
      store the singleton in a simple raw pointer, and only use the singleton helper
      object for flushing log handlers.
      
      Reviewed By: dmaone
      
      Differential Revision: D13984692
      
      fbshipit-source-id: a0c8550af367458ca39fefa9090e3165ad6a82bb
      4a2619fe
    • Eric Niebler's avatar
      get folly/experimental/pushmi building with gcc-5 again · de4ce899
      Eric Niebler authored
      Summary: Judging from the number of things that needed fixing, pushmi has been busted on gcc-5 for some time.
      
      Reviewed By: yfeldblum, kirkshoop
      
      Differential Revision: D13979146
      
      fbshipit-source-id: 95def0ef6289b41e116a55359476ffec91787706
      de4ce899
  7. 07 Feb, 2019 2 commits
    • Orvid King's avatar
      Remove the fd overload of BlockingSocket::BlockingSocket() · 4435c335
      Orvid King authored
      Summary: It's not needed
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13993615
      
      fbshipit-source-id: 7e53224d39502b96e13bff352dab778df4782a1c
      4435c335
    • Yedidya Feldblum's avatar
      Fix SingletonRelaxedCounter in T::~T() of ThreadLocal<T> · 9a9dfd3b
      Yedidya Feldblum authored
      Summary:
      [Folly] Fix `SingletonRelaxedCounter` in `T::~T()` of `ThreadLocal<T>`.
      
      Given a type `T` which has a dtor which increments some `SingletonRelaxedCounter`, and given some use of a `ThreadLocal<T>` where, within some given thread, the only time `SingletonRelaexCounter` is incremented is in the `T` dtor, there would be a leak of the `LocalLifetime` and this leak would cause subsequent `SingletonRelaxedCounter::count()` to segfault with access to a deallocated local counter.
      
      C++ `thread_local` destructors run before `pthread` thread-specific destructors. If a `pthread` thread-specific destructor triggers initialization of a C++ `thread_local`, then that `thread_local` will be leaked in that its destructor will never be run.
      
      Fix this with `ThreadLocal` by detecting when `ThreadLocal` per-thread destructors have begun running. This is a larger issue with `pthread` thread-specific objects overall, but as long as we stick to using `ThreadLocal`, it can be papered over.
      
      Reviewed By: davidtgoldblatt
      
      Differential Revision: D13970469
      
      fbshipit-source-id: a4c7f36d2c0d63f8f0e363ddb9d35a44b027aea6
      9a9dfd3b
  8. 06 Feb, 2019 4 commits
    • Andrii Grynenko's avatar
      Remove Executor* APIs · 0779c7fa
      Andrii Grynenko authored
      Summary: Executor::KeepAlive<> is now implicitly constructible from Executor*.
      
      Reviewed By: capickett
      
      Differential Revision: D13954744
      
      fbshipit-source-id: 523a860a337429a995152dc7171c0f6e8be8cecb
      0779c7fa
    • Lee Howes's avatar
      Add explicit deprecation to delayedUnsafe · 293afa64
      Lee Howes authored
      Summary: Deprecate delayedUnsafe to stop people adding it to code.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13949215
      
      fbshipit-source-id: ffc4eec113964a0b247f16f3c37f3f8c69fbb0df
      293afa64
    • Lee Howes's avatar
      Add tag_t to Futures.md · 373e67af
      Lee Howes authored
      Summary: Update futures documentation for consistency with tag type changes.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13975003
      
      fbshipit-source-id: 7015ffb8bd2b306e2dd31f6e2eb9e45b2618fa5f
      373e67af
    • Dan Melnic's avatar
      Add support for microsecond timers · 6b43343b
      Dan Melnic authored
      Summary: Add support for microsecond timers
      
      Reviewed By: spalamarchuk
      
      Differential Revision: D13765262
      
      fbshipit-source-id: ab5e2d876195a726dc654aee28cb40f695cf2277
      6b43343b
  9. 05 Feb, 2019 3 commits
    • Chip Turner's avatar
      Add benchmarks similar to `stringPrintf` for `folly::Format` and `fmt` · 241ea7bd
      Chip Turner authored
      Summary:
      Basic benchmarks to validate performance of similar string
      formatting functions.  Notably, `stringPrintf` is always inferior to
      either format-based alternative.
      
      ```
      ============================================================================
      folly/test/StringBenchmark.cpp                  relative  time/iter  iters/s
      ============================================================================
      libc_tolower                                               714.38ns    1.40M
      folly_toLowerAscii                                          66.03ns   15.14M
      stringPrintfOutputSize(1)                                  170.06ns    5.88M
      stringPrintfOutputSize(4)                                  198.54ns    5.04M
      stringPrintfOutputSize(16)                                 202.94ns    4.93M
      stringPrintfOutputSize(64)                                 204.82ns    4.88M
      stringPrintfOutputSize(256)                                  1.32us  759.95K
      stringPrintfOutputSize(1024)                                 4.47us  223.70K
      stringPrintfAppendfBenchmark                                25.38ms    39.40
      fmtOutputSize(1)                                           104.62ns    9.56M
      fmtOutputSize(4)                                           121.50ns    8.23M
      fmtOutputSize(16)                                          125.27ns    7.98M
      fmtOutputSize(64)                                          125.59ns    7.96M
      fmtOutputSize(256)                                         633.15ns    1.58M
      fmtOutputSize(1024)                                          1.06us  939.38K
      fmtAppendfBenchmark                                          8.22ms   121.71
      follyFmtOutputSize(1)                                      122.76ns    8.15M
      follyFmtOutputSize(4)                                      149.51ns    6.69M
      follyFmtOutputSize(16)                                     148.90ns    6.72M
      follyFmtOutputSize(64)                                     147.45ns    6.78M
      follyFmtOutputSize(256)                                    150.71ns    6.64M
      follyFmtOutputSize(1024)                                   584.94ns    1.71M
      follyFmtAppendfBenchmark                                    11.39ms    87.79
      BM_cEscape                                                 321.10us    3.11K
      BM_cUnescape                                               290.97us    3.44K
      BM_uriEscape                                                 2.99us  333.92K
      BM_uriUnescape                                               1.56us  639.36K
      BM_unhexlify                                               525.33ps    1.90G
      splitOnSingleChar                                            1.21us  823.13K
      splitOnSingleCharFixed                                     466.79ns    2.14M
      splitOnSingleCharFixedAllowExtra                             0.00fs  Infinity
      splitStr                                                     1.86us  536.53K
      splitStrFixed                                              620.41ns    1.61M
      boost_splitOnSingleChar                                      2.34us  427.23K
      joinCharStr                                                947.58ns    1.06M
      joinStrStr                                                 956.37ns    1.05M
      joinInt                                                      2.24us  447.21K
      ============================================================================
      ```
      
      Reviewed By: vitaut
      
      Differential Revision: D13940303
      
      fbshipit-source-id: a26d984cde26b1a5eb3eba1935722cdcd221fe44
      241ea7bd
    • Caleb Marchent's avatar
      Install executor_api.h when generated in OSS build (#1010) · 5aaeba16
      Caleb Marchent authored
      Summary:
      futures.h includes folly/python/executor_api.h, this header needs to be
      available to downstream projects (Thrift) which use python/futures.h.
      Pull Request resolved: https://github.com/facebook/folly/pull/1010
      
      Reviewed By: Orvid
      
      Differential Revision: D13915880
      
      Pulled By: calebmarchent
      
      fbshipit-source-id: 3c47fc4fe4ba425a4c12dcefd8980703765bdad5
      5aaeba16
    • Kyle Nekritz's avatar
      Reduce log level on setLockTypes warning in openssl 1.1.0. · 9a4e7a76
      Kyle Nekritz authored
      Summary: We do not need this spammy logging.
      
      Reviewed By: siyengar, mingtaoy
      
      Differential Revision: D13950327
      
      fbshipit-source-id: 6fc91d3efa27d2d88ab7571233ce04a6e28b15f7
      9a4e7a76
  10. 02 Feb, 2019 1 commit
    • Stepan Palamarchuk's avatar
      Properly handle negative timeouts · 055fce5f
      Stepan Palamarchuk authored
      Summary:
      We're always scheduling negative timeouts to fire immediately. However, there's a branch with invalid timeout that may end up getting us into an invalid state (in particular, setting negative `expireTick_`).
      
      To avoid that, this adds input sanitization by making sure we don't have anything negative.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13934881
      
      fbshipit-source-id: 28d7dc48f57da67d3266a7f33e058ff6994eb756
      055fce5f
  11. 01 Feb, 2019 3 commits
  12. 31 Jan, 2019 2 commits
    • Lara Lu's avatar
      add copy constructor for KeepAlive · 291c761f
      Lara Lu authored
      Summary:
      There is a need for KeepAlive copy constructor from various users. Adding them after chatting with Andrii.
      Background: move is preferred to copy as the latter does an atomic counter increment. `copy()` was introduced but there is a need for more user-friendly way of copying.
      TODO: maybe get rid of `copy()` and its usages?
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D13864057
      
      fbshipit-source-id: 38b2e45285566a3c2dba01706e82f421285b6bae
      291c761f
    • Caleb Marchent's avatar
      Include folly_pic in the opensource installed targets · ff841386
      Caleb Marchent authored
      Summary: Pull Request resolved: https://github.com/facebook/folly/pull/1006
      
      Reviewed By: Orvid
      
      Differential Revision: D13782299
      
      Pulled By: calebmarchent
      
      fbshipit-source-id: 7662c67a18c10a04d8d68e3f729da81c6df38336
      ff841386
  13. 30 Jan, 2019 2 commits
    • Shahzad Lone's avatar
      Reserve the vectors in ConcurrentHashMapTest (#998) · 6db47e87
      Shahzad Lone authored
      Summary:
      Even though this is a test, we are still reallocating a vector (resizing until re-sized/reallocated to 32), which in theory calls for allocation 5 times. But we can save this by just reserving the vector pre-hand (we know the size).
      Pull Request resolved: https://github.com/facebook/folly/pull/998
      
      Reviewed By: magedm
      
      Differential Revision: D13834292
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: 6b0d16ef0200184d10ba292a0b1d8d3afdadf56d
      6db47e87
    • Alex Guzman's avatar
      Add some more OpenSSL 1.1.0 compat functions · 7ad42542
      Alex Guzman authored
      Summary: Adds functions for DH length to the compat library.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13584117
      
      fbshipit-source-id: ef753d58ee400fbaf8d47f59b7d39e17380ed417
      7ad42542