1. 17 Jun, 2020 1 commit
    • Matt Ma's avatar
      Back out "Resubmit: Allow using different symbolizer mode in signal handler." · 23cadde7
      Matt Ma authored
      Summary:
      Original commit changeset: 25d4049019e4
      
      Base diff broke fboss build (using fbcode_builder) with the following error:
      
      /tmp/fbcode_builder_getdeps-ZrootZfboss2.gitZbuildZfbcode_builder-root/installed/folly/include/folly/init/Init.h:22:10: fatal error: folly/experimental/symbolizer/SymbolizerMode.h: No such file or directory
       #include <folly/experimental/symbolizer/SymbolizerMode.h>
      
      Revert this first to unblock fboss while I am investigating the failure.
      
      Reviewed By: shri-khare
      
      Differential Revision: D22077183
      
      fbshipit-source-id: 8bafc0518df82c61922104b7d59ef5ee20fdd572
      23cadde7
  2. 16 Jun, 2020 2 commits
  3. 15 Jun, 2020 8 commits
    • Matt Ma's avatar
      Resubmit: Allow using different symbolizer mode in signal handler. · 792d3247
      Matt Ma authored
      Summary: Fixed the missed initialization in InitOptions.
      
      Reviewed By: luciang
      
      Differential Revision: D22023637
      
      fbshipit-source-id: 25d4049019e42708c98e5b589ed4838e2870d39b
      792d3247
    • Giuseppe Ottaviano's avatar
      Specialize F14Table default constructor to avoid reserve() instantiation · 8d4e8ede
      Giuseppe Ottaviano authored
      Summary: F14 class member fields are often in headers, and often the default constructor is implicit. The current implementation unconditionally instantiates `reserve()`, which has non-negligible cost. By specializing the default constructor we can avoid that in the common case.
      
      Reviewed By: philippv, luciang
      
      Differential Revision: D22027490
      
      fbshipit-source-id: 964d9fa19ca92797bcb209e09959dc4706af39d4
      8d4e8ede
    • Pranav Thulasiram Bhat's avatar
      Deduction guide for Async · 248b90f6
      Pranav Thulasiram Bhat authored
      Summary:
      This diff implements a deduction guide for explicitly creating and returning Async objects in lambdas and functions with deduced return types.
      
      This saves the user from having to specify often lengthy return types when annotating such functions.
      
      Reviewed By: A5he
      
      Differential Revision: D21770141
      
      fbshipit-source-id: f80898ef6eeadee7c5a7168aaae4031e224a0935
      248b90f6
    • Pranav Thulasiram Bhat's avatar
      Async traits · 641a5030
      Pranav Thulasiram Bhat authored
      Summary: This diff implements traits to aid in the development of templated functions accepting annotated functions.
      
      Reviewed By: yfeldblum, A5he
      
      Differential Revision: D21770066
      
      fbshipit-source-id: 40ae340aeeb484c4f9769c13b5c9a92a97723801
      641a5030
    • Pranav Thulasiram Bhat's avatar
      Awaiting Coro · d1f59dd5
      Pranav Thulasiram Bhat authored
      Summary:
      This diff implements `coro_wait`, an annotated helper to block on the execution of a coroutine.
      
      The goal here is to provide an easy way to migrate from fibers to coroutines.
      
      Reviewed By: A5he
      
      Differential Revision: D21978610
      
      fbshipit-source-id: d59a222978d9db2963656312e71c7dcb2b9a11e9
      d1f59dd5
    • Pranav Thulasiram Bhat's avatar
      Awaiting futures · a7d768ee
      Pranav Thulasiram Bhat authored
      Summary:
      This diff adds `future_wait`, an annotated helper to run blocking `get` operations on futures.
      
      `future_wait` will help annotate functions (and their caller stack) that block on futures.
      
      For semifutures, deferred work is performed on fiber-main context, so there is no concern of bleeding fibers.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D21965552
      
      fbshipit-source-id: 79941c3b73c67d63d83dcdc778c62a0fc9051de3
      a7d768ee
    • Chad Austin's avatar
      re-enable lz4 compression for rocksdb on macOS and Linux · 3b5ce36b
      Chad Austin authored
      Summary:
      I think LZ4 was disabled accidentally in our rocksdb getdeps build in
      D21319896. Enable it again on macOS and Linux, because otherwise this
      breaks people with EdenFS mounts containing LZ4-compressed proxy
      hashes.
      
      Reviewed By: xavierd
      
      Differential Revision: D21990356
      
      fbshipit-source-id: b9166c2992ae51f09de3fa9a4f114143aa008f43
      3b5ce36b
    • Lewis Baker's avatar
      Add folly::tag_invoke · 66dc0a6f
      Lewis Baker authored
      Summary:
      Adds a helper utility called 'tag_invoke' for defining CPOs that dispatch to a call to an overload of the ADL-name 'tag_invoke()' that takes the CPO as the first argument instead of to a CPO-specific ADL-name.
      
      This makes it possible to build generic adapters, such as type-erasing adapters, that can forward through calls to all CPOs through to an underlying object.
      
      Adds FOLLY_DECLVAL(T) helper macro used in the implementation of some of the traits.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D17867173
      
      fbshipit-source-id: fadae6ec97498008a5238036b7310a1e0ae119a2
      66dc0a6f
  4. 13 Jun, 2020 1 commit
    • Nathan Bronson's avatar
      add explicit cast for narrowing on 32-bit platforms · 6bdbdb6f
      Nathan Bronson authored
      Summary:
      folly::Hash<Range<T>> uses SpookyHashV2::Hash64 (for integral
      T). On 32-bit platforms we need an explicit cast to avoid a narrowing
      warning when converting this to size_t.
      
      (Note: this ignores all push blocking failures!)
      
      Reviewed By: shixiao
      
      Differential Revision: D21491467
      
      fbshipit-source-id: 1cbd05553c61b8dccb664ec4478cfb0b049dc5b5
      6bdbdb6f
  5. 12 Jun, 2020 4 commits
    • Lucian Grijincu's avatar
      Revert D21918702: Allow using different symbolizer mode in signal handler. · 780050d9
      Lucian Grijincu authored
      Differential Revision:
      D21918702
      
      Original commit changeset: 3213e9536147
      
      fbshipit-source-id: 4e9394b2026f0d6d74e668c7c72b3612a42770ea
      780050d9
    • Giuseppe Ottaviano's avatar
      Outline most of TimedDrivableExecutor implementation · 4bbd587c
      Giuseppe Ottaviano authored
      Summary: This header is widely included (via `Future.h`) and instantiations of `UnboundedQueue`'s methods are expensive, so outline them (note that the template methods will only be instantiated if used, so that's fine).
      
      Reviewed By: philippv
      
      Differential Revision: D22014083
      
      fbshipit-source-id: b6a71c38c142917e9e0d86fbb64a88462382952a
      4bbd587c
    • Matt Ma's avatar
      Allow using different symbolizer mode in signal handler. · 8ae59d46
      Matt Ma authored
      Summary: This would allow us have better stack trace with inline functions in signal handler output.
      
      Reviewed By: luciang
      
      Differential Revision: D21918702
      
      fbshipit-source-id: 3213e9536147759a4e59f5b6f68d22d941d36c7f
      8ae59d46
    • Yedidya Feldblum's avatar
      Wrap _r_debug per platform · 55a91da8
      Yedidya Feldblum authored
      Summary: [Folly] Wrap `_r_debug` per platform, since the way to get it varies by platform.
      
      Reviewed By: ot, luciang
      
      Differential Revision: D22004737
      
      fbshipit-source-id: 6f6a6163c9709da0a5042b807cdd88fcdf2e57eb
      55a91da8
  6. 11 Jun, 2020 3 commits
    • Andrii Grynenko's avatar
      Stop using atomic_thread_fence in folly::Baton · f75211c0
      Andrii Grynenko authored
      Summary: Thread fences are not supported by TSAN
      
      Reviewed By: yfeldblum
      
      Differential Revision: D21989519
      
      fbshipit-source-id: bb657c82a64abe025e8f4c030916c0cacc3c0b81
      f75211c0
    • Derek Brown's avatar
      Coroutines Method Typo (#1385) · 2c9b2aad
      Derek Brown authored
      Summary:
      The `collectSemiFuture` method doesn't exist.  Use `collectAllSemiFuture` instead.
      Pull Request resolved: https://github.com/facebook/folly/pull/1385
      
      Reviewed By: yfeldblum
      
      Differential Revision: D21991532
      
      Pulled By: DerekTBrown
      
      fbshipit-source-id: 4ba3378fe34b7e6bb910f7045267fdbab87ebb14
      2c9b2aad
    • Yedidya Feldblum's avatar
      Back out "EventBase::getRecentSteadyTime" · 82dd413a
      Yedidya Feldblum authored
      Summary:
      Original commit changeset: 8eb472ce50bf
      
      This breaks time measurement to include measuring the wait preceding handler/callback invocation.
      
      Reviewed By: w-o-o
      
      Differential Revision: D21986042
      
      fbshipit-source-id: 42701b929878c3f56d736de5ca0417814c64fce1
      82dd413a
  7. 10 Jun, 2020 1 commit
    • Pranav Thulasiram Bhat's avatar
      Raise stackSizeMultiplier for debug builds · aa825c5c
      Pranav Thulasiram Bhat authored
      Summary:
      Debug builds can be prone to stack overflows if they are configurated to use the same stack sizes as prod builds.
      
      This diff effectively doubles the stack size for debug builds to provide more buffer against overflows.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D21913754
      
      fbshipit-source-id: bd32cc4dd9c79a50be178e5d6d30804a83e60ee4
      aa825c5c
  8. 09 Jun, 2020 10 commits
    • Mohamad Gebai's avatar
      Add strict versions of prevPowTwo() and nextPowTwo() · cb47018e
      Mohamad Gebai authored
      Summary: Returns the previous/next power of two that are strictly smaller/greater than the parameter.
      
      Reviewed By: yfeldblum, Gownta
      
      Differential Revision: D21920224
      
      fbshipit-source-id: be919063379e5b231cc69d743128fcaeb0ea9f39
      cb47018e
    • Yedidya Feldblum's avatar
      Cut FOR_EACH_KV · c94ebed8
      Yedidya Feldblum authored
      Summary: [Folly] Cut the FOR_EACH_KV macro, which may be replaced by a combination of range-for and structured bindings.
      
      Differential Revision: D21826182
      
      fbshipit-source-id: ce4712afd3d0d7806eb1fca8c97009da117f982e
      c94ebed8
    • Alexey Kuzmenko's avatar
      only allocate trimmedName on win32 · 58171cb5
      Alexey Kuzmenko authored
      Reviewed By: yfeldblum
      
      Differential Revision: D21921631
      
      fbshipit-source-id: e905d6d2a96775a8c3b328fb78c8d32897f634f6
      58171cb5
    • Junqi Wang's avatar
      Allow connect before bind · e31eb32a
      Junqi Wang authored
      Summary: connect will automatically bind the socket if the socket is not bound yet
      
      Reviewed By: yangchi
      
      Differential Revision: D21845740
      
      fbshipit-source-id: 27a5b44476dfc0b2ae5ff2f0a6c1bd4e976eadc9
      e31eb32a
    • Yedidya Feldblum's avatar
      Dead Code: TAsyncSocket · d11cbbc9
      Yedidya Feldblum authored
      Summary: [Thrift] Dead Code: `TAsyncSocket`.
      
      Reviewed By: vitaut
      
      Differential Revision: D20851837
      
      fbshipit-source-id: d4279fb1ab712f338d399220df26d56c4ab7076a
      d11cbbc9
    • Yedidya Feldblum's avatar
      EventBase::getRecentSteadyTime · da13f8bc
      Yedidya Feldblum authored
      Summary:
      [Folly] `EventBase::getRecentSteadyTime`, returning a recent `steady_clock::time_point` which is updated each pass through the event loop, but not for each ready event or function.
      
      Assuming everything in the loop is truly asynchronous, this permits callers to get a reasonably accurate approximation of the current time, but for many callers to blend or amortize the cost of getting that current time.
      
      May only be called from the running IO thread.
      
      Differential Revision: D21866783
      
      fbshipit-source-id: 8eb472ce50bf012616e567b29f6724c67ef8d41a
      da13f8bc
    • Yedidya Feldblum's avatar
      atomic_ref::compare_exchange_strong · 33403f55
      Yedidya Feldblum authored
      Summary: [Folly] `atomic_ref::compare_exchange_strong` and `atomic_ref::compare_exchange_weak`.
      
      Differential Revision: D21923944
      
      fbshipit-source-id: 55620473ea253782cc1dbb95baef38c96a9fbc70
      33403f55
    • Andrii Grynenko's avatar
      Crash process if folly::Singleton destruction is taking too long · e223d1a4
      Andrii Grynenko authored
      Summary: This provides a single mechanism to mitigate deadlocks in singleton destructors.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D21827615
      
      fbshipit-source-id: 090bad1a91238310e7814663193711df0f4d622a
      e223d1a4
    • Yedidya Feldblum's avatar
      Deduction guide for atomic_ref · 2cf42c9f
      Yedidya Feldblum authored
      Summary: [Folly] Deduction guide for `atomic_ref`.
      
      Reviewed By: markisaa
      
      Differential Revision: D21923854
      
      fbshipit-source-id: 8ad10692b95c653fc65302e6ad0118cbd615a62f
      2cf42c9f
    • Mingtao Yang's avatar
      Deprecate AsyncTransportWrapper · 2586be5b
      Mingtao Yang authored
      Summary:
      All implementations of transports in practice were all AsyncTransportWrappers
      (AsyncSocket, AsyncSSLSocket, AsyncFizzBase, etc.).
      
      AsyncTransportWrapper was confusing. The only additional functionality that
      it provided was the ability to query underlying transports, a piece of
      functionality which makes just as much sense on AsyncTransport.
      
      The simplified model:
      
      "AsyncTransport deals with bidirectional I/O. It is both an AsyncReader, and
      an AsyncWriter. It may be nested."
      
      This diff changes AsyncTransportWrapper usages in folly to refer to
      AsyncTransport, and aliases AsyncTransportWrapper for compatibility.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D21915048
      
      fbshipit-source-id: 741fad91b8f7c8080f942168f5513b12602cfe9a
      2586be5b
  9. 08 Jun, 2020 1 commit
  10. 07 Jun, 2020 1 commit
  11. 06 Jun, 2020 2 commits
    • Yedidya Feldblum's avatar
      Mark _r_debug imports as weak · db54c6bf
      Yedidya Feldblum authored
      Summary:
      [Folly] Mark `_r_debug` imports as weak imports. `_r_debug` is available in `<link.h>` but is not a portable API, so detect whether it is available at runtime and use it only if it is available.
      
      Fixes: https://github.com/facebook/folly/issues/1373.
      
      Reviewed By: Orvid
      
      Differential Revision: D21911715
      
      fbshipit-source-id: 660c0bc90d405d9a43826e7bdfc3b04480728b66
      db54c6bf
    • Yedidya Feldblum's avatar
      Dead code: countLoadedElfFiles · 7d367a68
      Yedidya Feldblum authored
      Summary: [Folly] Cut dead code: `countLoadedElfFiles()`.
      
      Differential Revision: D21910945
      
      fbshipit-source-id: 43ff7d118b4876e2cbd4527713c8552963810537
      7d367a68
  12. 05 Jun, 2020 1 commit
    • Yedidya Feldblum's avatar
      Let ElfCache be unbounded · 35ff8b26
      Yedidya Feldblum authored
      Summary:
      [Folly] Let `ElfCache` be unbounded to permit binaries with many dynamically-linked libraries from continuously missing the cache when symbolizing.
      
      Some applications symbolize stacktraces relatively frequently. When the build is using dynamic linking, such as might be done when developing the application or running the unit-tests, the overhead from re-loading `ElfFile` instances can appear. Address this by making the cache be unboundedly large.
      
      This is unlikely to affect applications built using mostly-static linking, such as might be done for production builds, even when they are large applications built from many libraries, since the capacity parameter is usually much larger than the total number of dynamically loaded libraries.
      
      Currently, no substantial work is done when initializing `ElfFile` instances. If substantial work were to be done, especially in an unoptimized build such as might be used when developing the application or running the unit-tests, and instances do not stay in cache, then that substantial work would be repeated whenever symbolizing stacktraces rather than being amortized.
      
      Reviewed By: luciang
      
      Differential Revision: D18819555
      
      fbshipit-source-id: 0e75326133e901e7bd49ea3cefe9b318e6d4466f
      35ff8b26
  13. 04 Jun, 2020 1 commit
    • Andrii Grynenko's avatar
      Fix pool resizer to correctly handle VirtualEventBase destruction · 4479aa0c
      Andrii Grynenko authored
      Summary: It's possible that we still have a recurring pool resizer task scheduled after virtual event base is destroyed. This changes makes sure that we don't try to reschedule it if VirtualEventBase is already destroyed.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D21875241
      
      fbshipit-source-id: c4622c5d103c6291386055c153ab4aeebe7795a2
      4479aa0c
  14. 03 Jun, 2020 4 commits
    • Martin Thomas Fleischer's avatar
      Fix shell builders (#50) · 3ee93a0f
      Martin Thomas Fleischer authored
      Summary:
      In 0ae204a978c11ddefafd81bd319a078239a44c1c the 'projects_dir' option
      became a required constructor argument since it is called within the
      constructor. However, it has not been adjusted in the subclasses that
      used to set the option after instantiation. This commit fixes the
      'shell_builder' and the 'debian_system_builder'.
      Pull Request resolved: https://github.com/facebook/openr/pull/50
      
      Test Plan:
      1. Go to build directory: `cd build`
      2. Run the `shell_builder` & `debian_system_builder`:
          - `python fbcode_builder/shell_builder.py`
          - `python debian_system_builder/debian_system_builder.py`
      
      `shell_builder` output before:
      ```
      Traceback (most recent call last):
        File "fbcode_builder/shell_builder.py", line 102, in <module>
          builder = ShellFBCodeBuilder()
        File "/home/butjar/tu/ma/openr/build/fbcode_builder/fbcode_builder.py", line 93, in __init__
          self._github_dir = self.option('projects_dir')
        File "/home/butjar/tu/ma/openr/build/fbcode_builder/fbcode_builder.py", line 108, in option
          raise RuntimeError('Option {0} is required'.format(name))
      RuntimeError: Option projects_dir is required
      ```
      
      `shell_builder` output after:
      ```
      set -exo pipefail
      export CCACHE_DIR='/home/butjar/.fbcode_builder-sZshomesZsbutjarsZstusZsmasZsopenr/.ccache' CC="ccache ${CC:-gcc}" CXX="ccache ${CXX:-g++}"
      ### Diagnostics ###
      
      # Builder ShellFBCodeBuilder(google/googletest:cmake_defines={u'BUILD_GTEST': u'ON', u'BUILD_SHARED_LIBS': u'OFF'}, google/googletest:git_hash=u'release-1.8.1', facebook/openr:local_repo_dir='/home/butjar/tu/ma/openr', facebook/zstd:git_hash=ShellQuoted(u'$(git describe --abbrev=0 --tags origin/master)'), openr/build:cmake_defines={u'ADD_ROOT_TESTS': u'OFF'}, thom311/libnl:git_hash=u'libnl3_2_25', projects_dir=u'/home/butjar/.fbcode_builder-sZshomesZsbutjarsZstusZsmasZsopenr', fmtlib/fmt:git_hash=u'5.3.0', wangle/wangle/build:cmake_defines={u'BUILD_TESTS': u'OFF'}, prefix=u'/home/butjar/.fbcode_builder-sZshomesZsbutjarsZstusZsmasZsopenr/installed', fizz/fizz/build:cmake_defines={u'BUILD_TESTS': u'ON'}, ccache_dir=u'/home/butjar/.fbcode_builder-sZshomesZsbutjarsZstusZsmasZsopenr/.ccache', zeromq/libzmq:git_hash=u'v4.2.2', make_parallelism=4, jedisct1/libsodium:git_hash=u'stable')
      hostname
      cat /etc/issue || echo no /etc/issue
      g++ --version || echo g++ not installed
      cmake --version || echo cmake not installed
      
      ### Check out fmtlib/fmt, workdir build ###
      
      mkdir -p '/home/butjar/.fbcode_builder-sZshomesZsbutjarsZstusZsmasZsopenr' && cd '/home/butjar/.fbcode_builder-sZshomesZsbutjarsZstusZsmasZsopenr'
      git clone  https://github.com/'fmtlib/fmt'
      mkdir -p '/home/butjar/.fbcode_builder-sZshomesZsbutjarsZstusZsmasZsopenr'/'fmt'/'build' && cd '/home/butjar/.fbcode_builder-sZshomesZsbutjarsZstusZsmasZsopenr'/'fmt'/'build'
      git checkout '5.3.0'
      
      ### Build and install fmtlib/fmt ###
      
      ...
      ```
      
      Reviewed By: steven1327
      
      Differential Revision: D21865881
      
      Pulled By: saifhhasan
      
      fbshipit-source-id: dfd78127d3b2c78721f84a3ecafe0b7198c38f06
      3ee93a0f
    • Martin Thomas Fleischer's avatar
      Fix shebang in shell_builder (#51) · 2e3e2e00
      Martin Thomas Fleischer authored
      Summary:
      Typo in python shebang introduced by 0d19e27, probably by accident.
      
      Found while skimming the code.
      Pull Request resolved: https://github.com/facebook/openr/pull/51
      
      Reviewed By: steven1327
      
      Differential Revision: D21865922
      
      Pulled By: saifhhasan
      
      fbshipit-source-id: 5f2c2c2fac82078070920915812139f5fef1c7fe
      2e3e2e00
    • Yedidya Feldblum's avatar
      Move AlignedSysAllocator computation of max · dcd9f349
      Yedidya Feldblum authored
      Summary: [Folly] Move `AlignedSysAllocator` computation of max value over input alignment values from two places to a single place.
      
      Differential Revision: D19229096
      
      fbshipit-source-id: 4e95c7b7e0afe99c37116150184eb180683c7d13
      dcd9f349
    • Lukas Piatkowski's avatar
      rust-shed: add secure_utils to the shed · 3b29cdba
      Lukas Piatkowski authored
      Reviewed By: StanislavGlebik
      
      Differential Revision: D21549859
      
      fbshipit-source-id: 0e143354a60578732ae1eed8c3c71b9f859e3958
      3b29cdba