1. 16 Sep, 2019 2 commits
    • Tom Jackson's avatar
      toPrettyJson() sorts keys for deterministic output · 800f602c
      Tom Jackson authored
      Summary: Diffing logs would be easier if the lines which pretty-printed JSON were identical if their values were identical, and they're just easier to visually scan for a value if they're sorted anyway.
      
      Reviewed By: yfeldblum, luciang
      
      Differential Revision: D17367669
      
      fbshipit-source-id: 91188f23576ce39b9edc2307be018a43f30c786d
      800f602c
    • Yedidya Feldblum's avatar
      Use a fixed mempool capacity in LifoSem · a821d1c9
      Yedidya Feldblum authored
      Summary: [Folly] Use a fixed mempool capacity in `LifoSem`, simplifying usage.
      
      Reviewed By: nbronson
      
      Differential Revision: D17251982
      
      fbshipit-source-id: e3bce99204daef178418268f1d195365400df885
      a821d1c9
  2. 13 Sep, 2019 2 commits
    • Nanshu Chen's avatar
      refactor AsyncGeneratorWrapper to use AsyncGenerator::NextResult · f65c05bb
      Nanshu Chen authored
      Summary: AsyncGeneratorWrapper uses folly::Optional as the return type for "getNext". Now the AsyncGenerator API has changed by adding `next()` method which returns a `NextResult` type, which works like folly::Optional while supporting both values and references, it's best to use `NextResult` for the wrapper as well.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D16695661
      
      fbshipit-source-id: 84e9d74e8d6b17b93bd3c22e2aaf56c7b9e4b789
      f65c05bb
    • Hasnain Lakhani's avatar
      Add CMake option to fetch deps statically · 0c5ceda6
      Hasnain Lakhani authored
      Summary:
      We would like to build a version of proxygen that has minimal
      dependencies on dynamic libraries.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D17228181
      
      fbshipit-source-id: cfd61afdfa978c49a536184f426502196241fb8a
      0c5ceda6
  3. 12 Sep, 2019 1 commit
  4. 11 Sep, 2019 4 commits
    • Adam Simpkins's avatar
      fbcode_builder: update FBPythonBinary.cmake to work on Windows · 32701064
      Adam Simpkins authored
      Summary:
      On Windows we have to explicitly invoke `make_fbpy_archive.py` with python.
      Therefore use CMake's built-in `FindPythonInterp` module to find the python
      executable and use that when invoking `make_fbpy_archive.py`
      
      This is slightly complicated by the effort required to find python with older
      versions of CMake.  We ideally still want to support versions of CMake back to
      at least 3.8, which means we need to still support finding Python with the
      older `FindPythonInterp.cmake` module
      
      Reviewed By: wez
      
      Differential Revision: D17128606
      
      fbshipit-source-id: 3f4beff76848b8a362ebdf21198e7a8bf1b0537f
      32701064
    • Mark Santaniello's avatar
      bugfix sorted_vector_types allocator-extended c'ctor · c27460f2
      Mark Santaniello authored
      Summary: The nested EBO classes were missing the allocator-extended c'ctor.  Fix and add tests to cover this case.
      
      Reviewed By: nbronson
      
      Differential Revision: D17284711
      
      fbshipit-source-id: 6e7e8df83712f018fd6a7558513164f319b1b7f8
      c27460f2
    • Yedidya Feldblum's avatar
      Cut dep on boost chrono · 835f77cd
      Yedidya Feldblum authored
      Summary: [Folly] Cut unused dep on boost `chrono` library from folly and proxygen.
      
      Reviewed By: vitaut
      
      Differential Revision: D17298687
      
      fbshipit-source-id: 90d0182f4fbb76c13cb341e27514e688f12590a4
      835f77cd
    • Yedidya Feldblum's avatar
      Move hash_128_to_64 to top of file · 701224e9
      Yedidya Feldblum authored
      Summary: [Folly] Move `hash_128_to_64` to top of file - it has no dependencies so there was no need to split the declaration and definition across 500 lines.
      
      Reviewed By: Orvid
      
      Differential Revision: D17276906
      
      fbshipit-source-id: f57133e8873d8b1afcfd5ab119e07615f6ee9018
      701224e9
  5. 10 Sep, 2019 5 commits
    • Matt Ma's avatar
      Support inline functions in folly stack trace symbolizer · 1c76bae6
      Matt Ma authored
      Summary:
      Basic idea is to find the subprogram for a given stack trace address, scan the inlined subroutines of that subprogram recursively for all inline function calls, then find the name and location of these inline function calls.
      
      Now only pure inline functions are supported, and class inline functions are not. Class inline functions needs a lookup path "caller->obj->type", then lookup types in .debug_types, which is more complex.
      
      The debug info parser idea was stolen from hphp/tools/debug-parser/dwarfstate.h
      
      Not sure if we want to add a flag to enable this feature. We can discuss over review.
      
      Reviewed By: luciang
      
      Differential Revision: D16760775
      
      fbshipit-source-id: 1a7c23486605e7d8837070a697a875789ae41416
      1c76bae6
    • David Goldblatt's avatar
      Add documentation to Conv.h. · cffb3628
      David Goldblatt authored
      Summary: This adds a file-level comment that explains the various usages.
      
      Differential Revision: D16259169
      
      fbshipit-source-id: 95e5e8f047cdd159899cab47c390a7b0ab8d70cb
      cffb3628
    • Nathan Bronson's avatar
      UninitializedMemoryHacks gcc 9 support · f7798632
      Nathan Bronson authored
      Summary:
      gcc 9's libstdc++ moves the definition of _M_impl._M_finish
      into a new intermediate class. It's still addressible with the same name,
      but the type of the member pointer changes. This diff switches to using
      decltype to tolerate both the old and the new implementation.
      
      Reported as issue https://github.com/facebook/folly/issues/1223
      
      Reviewed By: yfeldblum
      
      Differential Revision: D17283175
      
      fbshipit-source-id: 9c9da28b83c3cb3584d33575b462d10b17002edb
      f7798632
    • Yedidya Feldblum's avatar
      No mutable flags in IOBuf · bbd6fb43
      Yedidya Feldblum authored
      Summary: [Folly] No mutable flags in IOBuf to avoid races when invoking `const`-qualified members concurrently.
      
      Reviewed By: simpkins
      
      Differential Revision: D17251909
      
      fbshipit-source-id: e52d333fb620d05f7229a11db9c2f14fe9f6f028
      bbd6fb43
    • Yedidya Feldblum's avatar
      Avoid ambiguous call in futures · b1233937
      Yedidya Feldblum authored
      Summary:
      [Folly] Avoid ambiguous call in futures. Because `std::atomic` is in `namespace std`, unqualified calls to `atomic_compare_exchange_strong_explicit` from within `namespace folly` are ADL-ambiguous between the overloads in `namespace std` and in `namespace folly`.
      
      Also:
      * Fix incorrectly-named prototype.
      * Fix used of `std::atomic<T>::value_type` which may not exist.
      
      Fixes #1221.
      
      Reviewed By: aary, Orvid
      
      Differential Revision: D17256763
      
      fbshipit-source-id: ffcaf171e6257cdef29de0ffb63f310d7f4a93eb
      b1233937
  6. 09 Sep, 2019 2 commits
    • Zhenyu Zhou's avatar
      Add a constructor to folly::Codel · 5ca43e12
      Zhenyu Zhou authored
      Summary: Making a new ctor so that we can pass in the parameters
      
      Reviewed By: yfeldblum
      
      Differential Revision: D17173662
      
      fbshipit-source-id: ab518892694e1bec1179177e7d9477e3a89ff38d
      5ca43e12
    • László Várady's avatar
      Fix tests on Arch Linux (#1218) · b36f6181
      László Várady authored
      Summary:
      Compiling folly on Arch Linux triggered a few platform-specific behaviors that were not covered correctly by tests.
      
      - Fix F14{Map,Set} maxSize test cases
          The maximum size of `F14Table` is dependent of its allocator's max_size:
      
          ```
          max_size() -> std::min<std::size_t>(
              (std::numeric_limits<InternalSizeType>::max)(),
              AllocTraits::max_size(a)
          )
          ```
      
          This commit fixes the `F14{Map,Set}` maxSize tests, so they won't fail
          on platforms where the standard allocator's `max_size()` is based on
          `ptrdiff_t` (signed).
      
      -  Fix TestUtilTest
          If glog is compiled without gflags support, `SetCommandLineOptionWithMode()`
          can't force glog to use stderr.
      
          glog has its own compatibility layer for `FLAGS_*` in case gflags is missing,
          that's why `FLAGS_logtostderr` is always available.
      
      - Skip AsyncIOTest tests if O_DIRECT is not supported by the file system
          `fs::temp_directory_path()` returns `"/tmp"` on Linux.
      
          When using systemd, the /tmp directory is mounted by default as tmpfs;
          and tmpfs does not support the `O_DIRECT` flag.
      
          This commit skips tests in case the file can't be opened with `O_DIRECT`.
      Pull Request resolved: https://github.com/facebook/folly/pull/1218
      
      Reviewed By: nbronson
      
      Differential Revision: D17160597
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: 00274d1f8770079e35559ee9bd8426402e949abd
      b36f6181
  7. 08 Sep, 2019 1 commit
    • Yedidya Feldblum's avatar
      Switch from -defs.h pattern · f5502bfd
      Yedidya Feldblum authored
      Summary: [Folly] Switch from `-defs.h` pattern to `-inl.h` pattern in `folly/stats/` since `extern template` doing shallow instantiation rather than deep instantiation makes this pattern difficult.
      
      Reviewed By: chadaustin
      
      Differential Revision: D16761319
      
      fbshipit-source-id: 1760bf53b09791bebf996064c0d1fcc3babf43d2
      f5502bfd
  8. 07 Sep, 2019 1 commit
    • Yedidya Feldblum's avatar
      Bake templates into the compiler binary · 355677ed
      Yedidya Feldblum authored
      Summary: [Thrift] Bake templates into the compiler binary rather than having to package the templates with the compiler.
      
      Reviewed By: stevegury, vitaut
      
      Differential Revision: D16356056
      
      fbshipit-source-id: b971dce7aada8dc2a26587fbf818e661acd0c555
      355677ed
  9. 06 Sep, 2019 4 commits
    • Yedidya Feldblum's avatar
      Extract compare-exchange hack under TSAN · 2ccb83e2
      Yedidya Feldblum authored
      Summary:
      [Folly] Extract compare-exchange hack under TSAN to a common location and make its interface mimic `std::atomic_compare_exchange_strong_explicit`. Limit it to Clang TSAN (no knowledge of whether it applies to other implementations of TSAN), but extend it to handle all pairs of success and failure orders.
      
      The TSAN bug is described in https://github.com/google/sanitizers/issues/970. High level, Clang TSAN ignores the explicit failure order and infers a failure order from the success order - which is broken if the explicit failure order is in the relevant sense stronger than the success order.
      
      Reviewed By: aary, nbronson
      
      Differential Revision: D16854217
      
      fbshipit-source-id: 18f6458520bbd5f482e41c10d7229e6cfae1db2a
      2ccb83e2
    • Wez Furlong's avatar
      getdeps: build all available boost libraries · ff5e2117
      Wez Furlong authored
      Summary:
      This should make it easier to eg: enable fbzmq on macos at a later
      time, and also makes things more explicit about what is being built, and
      importantly, by listing these in the manifest ensures that we have a
      hash change if we change this list; we wouldn't trigger such a change
      if the list were encoded solely in builder.py
      
      Reviewed By: chadaustin
      
      Differential Revision: D17133149
      
      fbshipit-source-id: caf0dd45e262188eeefafe0868ef95ad257a4950
      ff5e2117
    • Wez Furlong's avatar
      getdeps: allow aliasing sources for add_fb_python_executable · 743cae42
      Wez Furlong authored
      Summary:
      * Fix a minor issue with `add_fb_python_executable` where it would
        emit `--main` even if `MAIN_MODULE` had not been specified
      * Introduce the ability to rename python sources in the manifest so
        that they have a different install path.
      * Note that this changes the DEPENDS parameters to reference abs_sources;
        previously these were using relative paths to the sources pulled directly
        from the SOURCES arguments, but since those can now contain aliasing
        operations we need to pre-process the list.  I switched to abs_sources
        because that was already being maintained.  If for some reason the
        DEPENDS list needs to be relative paths, this will need to be adjusted.
      
      Reviewed By: simpkins
      
      Differential Revision: D17147417
      
      fbshipit-source-id: d0825bfbdad6be658c078aaac6645e6926a1530f
      743cae42
    • Wez Furlong's avatar
      getdeps: add build cache abstraction · f40148ce
      Wez Furlong authored
      Summary:
      This diff adds a small abstraction that allows for uploading
      and downloading from an artifact cache.
      
      We try to download from this cache at build time, but will only
      try to populate it for continuous builds--those are built from
      code that has been reviewed and landed on master.  This restriction
      helps to avoid thrashing the cache with works in progress and
      results in a slightly more trustworthy state of the cache contents.
      
      In addition to this, we choose only to cache third party projects.
      The rationale is that our first party projects move too quickly to
      be worth caching, especially since the cache granularity is for
      the whole project rather than just changed elements of a given
      project.
      
      In a later diff I will introduce some implementations of the
      cache class that work with eg: Travis or Circle CI caching.
      
      Reviewed By: simpkins
      
      Differential Revision: D16873307
      
      fbshipit-source-id: 2bfb69e36615791747b499073586562f2ca48be9
      f40148ce
  10. 05 Sep, 2019 1 commit
    • Lee Howes's avatar
      Increase timeout to a length that is unlikely to trigger · f20cc52f
      Lee Howes authored
      Summary: one_ms is short enough that it can trigger under testing. Increase to make less likely to fail spuriously.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D17190402
      
      fbshipit-source-id: 091cd3ee8f3da224e39ba95c403e233115a80510
      f20cc52f
  11. 04 Sep, 2019 5 commits
    • Lee Howes's avatar
      Fix documentation of Future::within and SemiFuture::within · 63d655cf
      Lee Howes authored
      Summary: SemiFuture::within was undocumented and Future::within's use of the term "throws" was confusing. This cleans up both sets of documentation.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D17186392
      
      fbshipit-source-id: 83409df85b07bd3cad9fb020e99fc3a7f3c70b61
      63d655cf
    • Dan Melnic's avatar
      Disable FOLLY_TLS under 32 bit Apple/iOS · 67dc542a
      Dan Melnic authored
      Summary: Disable FOLLY_TLS under 32 bit Apple/iOS
      
      Reviewed By: mzlee
      
      Differential Revision: D17172252
      
      fbshipit-source-id: ab47bb9ddb810aec45a940fc2ae834bac6a48f7c
      67dc542a
    • László Várady's avatar
      Remove std::move() calls that prevent NRVO (#1217) · ee3a3a1e
      László Várady authored
      Summary:
      > Under the following circumstances, the compilers are permitted to omit the copy and move construction of class objects:
      
      > In a return statement, when the operand is the name of a non-volatile object with automatic storage duration, which isn't a function parameter or a catch clause parameter, and which is of the same class type (ignoring cv-qualification) as the function return type. This variant of copy elision is known as NRVO, "named return value optimization".
      
      `std::move()` prevents this optimization.
      
      GCC 9.1.0 warning:
      ```
      moving a local object in a return statement prevents copy elision [-Wpessimizing-move]
      ```
      Pull Request resolved: https://github.com/facebook/folly/pull/1217
      
      Reviewed By: LeeHowes
      
      Differential Revision: D17173234
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: ed63ef89dfd01883ddd6fd775285997f96a029fd
      ee3a3a1e
    • Yedidya Feldblum's avatar
      Cut mstch manifest · eea51e2d
      Yedidya Feldblum authored
      Summary: [OpenSource] Cut `mstch` manifest, which was but is no longer used by `fbthrift`.
      
      Reviewed By: avalonalex, davidtgoldblatt
      
      Differential Revision: D17160816
      
      fbshipit-source-id: 3b96142455d6990870e8ed3e5ce330d339d5a657
      eea51e2d
    • Wez Furlong's avatar
      getdeps: assign test owner in continuous runs · 241df17c
      Wez Furlong authored
      Summary:
      Feed the first-party oncall data through to the testpilot
      invocation.  This will set the owner of the test in continuous runs.
      
      The oncall is passed through via the sandcastle module, which means
      that you will have to manually pass it through for local testing
      (see test plan), but it should automatically get picked up when
      sandcastle schedules the `test` step of the job.
      
      Reviewed By: chadaustin
      
      Differential Revision: D17146802
      
      fbshipit-source-id: a4f0e65853a46ed8709594c96db859ede2530b00
      241df17c
  12. 03 Sep, 2019 6 commits
    • John Strizich's avatar
      add generated constant definitions to library · 7b373430
      John Strizich authored
      Summary: when trying to build openr with `getDeps.py` constant definitions where not available since they were not part of the generated thrift lib. this fixes it.
      
      Reviewed By: chadaustin
      
      Differential Revision: D16064417
      
      fbshipit-source-id: ee2b3e061caf67235f4a873405cf6cd6fb663ef4
      7b373430
    • Kirk Shoop's avatar
      Add folly::coro::multiplex() algorithm · b963f391
      Kirk Shoop authored
      Summary: This algorithm multiplexes values from a stream-of-streams into a single stream of events that identifies the stream index the event originated from and also the end-of-stream and stream-error events.
      
      Reviewed By: lewissbaker
      
      Differential Revision: D15643142
      
      fbshipit-source-id: a309a485f11465d9068ea81f4bc32823dd34291f
      b963f391
    • Kirk Shoop's avatar
      Add folly::coro::transform() algorithm · 600a1046
      Kirk Shoop authored
      Summary: The `transform()` algorithm uses the provided function to transform each value in the provided input stream and produces each transformed value on the returned output stream.
      
      Reviewed By: lewissbaker
      
      Differential Revision: D16774893
      
      fbshipit-source-id: 7ab33706c667b1706c0cb0b1c0ecb9046f47a325
      600a1046
    • Kirk Shoop's avatar
      Add folly::coro::merge() operator for AsyncGenerator. · 189c99a6
      Kirk Shoop authored
      Summary: Adds a new `folly::coro::merge()` algorithm that accepts an async stream of async streams and returns an async stream that merges and interleaves the results.
      
      Reviewed By: lewissbaker
      
      Differential Revision: D15617383
      
      fbshipit-source-id: cafb8e31725cdb21cfa00ce186901329828c2b68
      189c99a6
    • Luca Niccolini's avatar
      BUILD_SHARED_LIBS=OFF for CI build · 6e4965ce
      Luca Niccolini authored
      Summary: fixes the CI build
      
      Reviewed By: dddmello
      
      Differential Revision: D17158685
      
      fbshipit-source-id: 44ea871eab4d8c964b8372fb8d84879fa823ca50
      6e4965ce
    • Eric Niebler's avatar
      Update fbcode for range-v3 0.9.1-pre · 3685bdd1
      Eric Niebler authored
      Summary:
      Range-v3 v0.9.1-pre deprecated and renamed a bunch of interfaces to harmonize with the direction of C++20's `std::ranges`. In this diff, I:
      
      * Rename the `ranges::view` namespace qualification to `ranges::views` (plural),
      * Rename the `ranges::action` namespace qualification to `ranges::actions` (plural),
      * Rename `ranges::view::bounded` to `ranges::views::common`,
      * Rename `ranges::to_` to `ranges::to`,
      * Replace _some_ implicit conversions of views to containers with explicit invocations of `ranges::to` (more work to be done here, but can wait).
      
      Reviewed By: mzlee
      
      Differential Revision: D17061465
      
      fbshipit-source-id: f28205ecf3965d3560e9cffe2805d0b404597b21
      3685bdd1
  13. 02 Sep, 2019 1 commit
    • Lee Howes's avatar
      Remove executor-taking form of then · 2d5ad1d0
      Lee Howes authored
      Summary:
      Remove calls to Future::then(executor, callback).
      
      This form of Future::then is ambiguous, and does not yet implement the stronger
      typing of thenValue and thenTry. It is also tempting to use instead of via,
      where it is not obvious that it has the behaviour of wrapping a via call in a
      push and pop of the current executor:
      .pushCurrentExecutor().via(executor).then(callback).popCurrentExecutor().
      
      With the addition of inline continuations, we can instead make the nesting
      explicit at low cost by making it an inline continuation that launches an
      asynchronous task on the passed executor.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D15100419
      
      fbshipit-source-id: e929e2eaf2fc30313cb099150be3a9535ae729a6
      2d5ad1d0
  14. 01 Sep, 2019 1 commit
    • Lee Howes's avatar
      Make folly::TimeKeeper::after and ::at return SemiFuture · 11003288
      Lee Howes authored
      Summary:
      TimeKeeper::after and TimeKeeper::at return Futures that for the majority of implementations complete on a TimeKeeper owned executor. This can lead to problems.
      
      Consistent with other API cleanups, this diff switches TimeKeeper APIs to return SemiFuture, requiring that the caller attach an explicit executor when work is to be scheduled downstream of the TimeKeeper.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D17005944
      
      fbshipit-source-id: 98d7e8aaf1ad40ce2180503f632f2f0003bb12be
      11003288
  15. 31 Aug, 2019 3 commits
    • Lee Howes's avatar
      Add result DeferredExecutor to avoid risk of double nesting · eb5c5900
      Lee Howes authored
      Summary: Under some circumstances the DeferredExecutor might already have nested executors and this code adds more. Both incoming futures should instead nest within a fresh DeferredExecutor returned that is part of the SemiFuture from the operation.
      
      Reviewed By: mpark
      
      Differential Revision: D17121117
      
      fbshipit-source-id: b4507bf5d7b0c98e5e5de6f73ff4bd3e2790374c
      eb5c5900
    • Yedidya Feldblum's avatar
      RTM re-nits for xabort · 5db275b9
      Yedidya Feldblum authored
      Summary:
      [Folly] RTM re-nits for `xabort`.
      
      * Remove param pack.
      * Always noreturn.
      
      Reviewed By: nbronson
      
      Differential Revision: D17117350
      
      fbshipit-source-id: b16056b1f02956d334da4494c689a4b988a961d4
      5db275b9
    • Kirk Shoop's avatar
      Add folly::coro::materialize() & folly::coro::dematerialize() algorithms · 37a33e67
      Kirk Shoop authored
      Summary:
      The `materialize()` algorithm meterializes values from a stream into a stream of events that represent each value and also the end-of-stream and stream-error events.
      
      `dematerialize()` reverses a materialized stream by replaying the events recorded in the input stream to an output stream.
      
      Reviewed By: lewissbaker
      
      Differential Revision: D16772236
      
      fbshipit-source-id: 27de543ea2d02691a376fd0f11d0113c5c39287d
      37a33e67
  16. 30 Aug, 2019 1 commit
    • Wez Furlong's avatar
      fbzmq: disable build on darwin and windows · f3352d86
      Wez Furlong authored
      Summary:
      boost.fiber is not available on macos and is required by fbzmq,
      so disable the build on darwin.
      
      In D17128935 I tried to make libzmq build with cmake to build
      on windows, but there's a problem with its cmake and it fails
      to configure.
      
      So let's just nop out the build for !linux for now.
      
      Reviewed By: jstrizich
      
      Differential Revision: D17129362
      
      fbshipit-source-id: db89010d18707a4105b8d395b1758f738336495d
      f3352d86