1. 28 Mar, 2018 7 commits
    • Erik Hortsch's avatar
      Remove check for uncaught exception · f2b80e52
      Erik Hortsch authored
      Summary: This check is causing some issues in github commits. Figuring out exactly which versions of 4.9 have the bug is a pain, so let's just get rid of it. See D6695110 for more context.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D7431713
      
      fbshipit-source-id: 17d1b025edf52592495c5f69c5a15025b33b3895
      f2b80e52
    • Orvid King's avatar
      Support setThreadName on Windows · 1674ee82
      Orvid King authored
      Summary: Windows doesn't have a nice function to do this, so we have to do it ourself, throwing the right exception with a struct that no public header defines, because Windows.
      
      Reviewed By: akrieger
      
      Differential Revision: D5100900
      
      fbshipit-source-id: 4f6840e50c5c1aef36adade098739201c97b9af7
      1674ee82
    • Orvid King's avatar
      Remove FOLLY_DEPRECATED entirely · 511ddcc6
      Orvid King authored
      Summary: Actually remove it. All uses of it (outside of thrift) were removed in the previous diff.
      
      Reviewed By: ot
      
      Differential Revision: D7422614
      
      fbshipit-source-id: 6a59c34b3cbc0ee7c50f8cbf8c5e641352f2db1a
      511ddcc6
    • Joe Loser's avatar
      Fix F14TestUtil printing · 04ac9609
      Joe Loser authored
      Summary:
      There is a missing `#include <ostream>`.  Add it.
      Closes https://github.com/facebook/folly/pull/807
      
      Reviewed By: shixiao
      
      Differential Revision: D7425693
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: cb645f7da94ca5fe5f8d4314b99621557109f360
      04ac9609
    • Jason Fried's avatar
      Safer Clients · cf504d17
      Jason Fried authored
      Summary:
      Python is considered a Safe Enivronment, where things like aborts and segfaults
      can not happen.
      
      If clients where used outside of "async with" we use to print a error message
      and then C++ would abort.
      
      This fix makes sure C++ no longer aborts but we still print the message
      that the "async with" should be used.
      
      All futures are now shielded so cancel will not produce strange exceptions when
      C++ decides to fullfill the canceled future.
      
      Also we now pass a tuple of client and future to all bridgeFutureWith calls.
      This has the affect of making sure the client can not GC before the future
      is completed.
      
      We now use a unique_ptr for RequestChannel so there is no more race to delete
      the shared pointer.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D7389380
      
      fbshipit-source-id: 6a3ca019190907e726c550c9b379a2a2610d0b0a
      cf504d17
    • Igor Sugak's avatar
      fix -Wextra-semi exposed by the latest clang · 3daa8962
      Igor Sugak authored
      Summary: `-Wextra-semi` became more strict. This fixes folly build with the latest clang.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D7359992
      
      fbshipit-source-id: ce7caf05aa536f35e9af4ed33a86072afd09f387
      3daa8962
    • Xiao Shi's avatar
      fix default hasher · dc45f4c0
      Xiao Shi authored
      Summary: Revert changes accidentally slipped into D7405057.
      
      Reviewed By: yfeldblum, Orvid
      
      Differential Revision: D7419691
      
      fbshipit-source-id: ab9bea3393eb33aa19b3009263a53ac91e30692c
      dc45f4c0
  2. 27 Mar, 2018 5 commits
    • Dave Watson's avatar
      Remove hazptr_priv_list · b403ae13
      Dave Watson authored
      Summary: folly::ThreadLocal already maintains this list for us.  Add an accessor in folly::SingletonThreadLocal, and use it
      
      Reviewed By: yfeldblum
      
      Differential Revision: D7264843
      
      fbshipit-source-id: 45278f7a074e50b96b451437c327de5d6713363a
      b403ae13
    • Yedidya Feldblum's avatar
      Fix retrying when the policy throws · 40b40a1d
      Yedidya Feldblum authored
      Summary: [Folly] Fix `retrying` when the policy throws.
      
      Differential Revision: D7392852
      
      fbshipit-source-id: 3cb1d19697f111bf19047dc382056b39ad241035
      40b40a1d
    • Orvid King's avatar
      Eliminate uses of FOLLY_DEPRECATED · f9326ade
      Orvid King authored
      Summary: Every compiler we currently support supports the `[[deprecated]]` attribute, so use that instead.
      
      Reviewed By: yfeldblum, ot
      
      Differential Revision: D7405895
      
      fbshipit-source-id: 541c537cd7a0be0d901378c0e79f5cd0f55b85e3
      f9326ade
    • Andrii Grynenko's avatar
      Improve SequencedExecutor documentation · 5d09018c
      Andrii Grynenko authored
      Summary: Adding more details to the documentation and a unit test which checks various executors.
      
      Reviewed By: yfeldblum, djwatson
      
      Differential Revision: D7410461
      
      fbshipit-source-id: 2ae6926f43862ec45a06ff76dbacae681fe6feaa
      5d09018c
    • Andrii Grynenko's avatar
      Implement coro::Future -> Future conversion · 426eb685
      Andrii Grynenko authored
      Reviewed By: wqfish
      
      Differential Revision: D7205067
      
      fbshipit-source-id: 2236c132b2150e38da6d5a5c9970347320e19a60
      426eb685
  3. 26 Mar, 2018 5 commits
    • Dan Melnic's avatar
      Fix "declaration of 'h' shadows a previous local [-Werror=shadow-compatible-local]" · db2cedc7
      Dan Melnic authored
      Summary:
      Fix "declaration of 'h' shadows a previous local [-Werror=shadow-compatible-local]"
      
      (Note: this ignores all push blocking failures!)
      
      Reviewed By: djwatson
      
      Differential Revision: D7406485
      
      fbshipit-source-id: f23548022a3ccb1f480c7265b11c31d2e2876fd4
      db2cedc7
    • Orvid King's avatar
      Fix the forward declarations of F14 under MSVC · 8c80ad9e
      Orvid King authored
      Summary:
      Due to a quirk in how MSVC does name resolution, if a default value is declared in the forward declaration of a template, and the definition is made available in the same unit, the default values in the forward declaration must use the names given in the definition, not the declaration.
      To keep it sane, just use the same template parameter names for both the declaration and definition.
      
      (Note: this ignores all push blocking failures!)
      
      Reviewed By: shixiao
      
      Differential Revision: D7405057
      
      fbshipit-source-id: dda14043fec30fa505bb0bb3e2e31d0abb52ba1f
      8c80ad9e
    • Xiao Shi's avatar
      Forward iterator for F14VectorMap · 3f0f6c97
      Xiao Shi authored
      Summary:
      This diff adds a reverse iterator to F14VectorMap/Set; this is mainly useful because
      if there have been no calls to erase(), the reverse iterator will visit the entries in
      insertion order.
      
      Reviewed By: nbronson
      
      Differential Revision: D7173038
      
      fbshipit-source-id: 0a64c4e753c9c36c6ac8b6141654b6f29f410580
      3f0f6c97
    • Shoaib Meenai's avatar
      Correct exception wrapper MSVC conditional · a228d714
      Shoaib Meenai authored
      Summary:
      The layout of an exception_ptr is determined by the ABI, not the OS. MinGW (and
      Cygwin, depending on the build settings) define `_WIN32` and would therefore
      have `kIsWindows` be true, but they use the Itanium ABI instead of Microsoft's,
      so we shouldn't take the MSVC codepath for them.
      
      Unfortunately, there isn't a reliable preprocessor method to determine the ABI
      being used. `_MSC_VER` can be defined even when using the Itanium ABI (e.g.
      when using windows-itanium triples with clang), and `_MSC_VER` can be undefined
      even when using the Microsoft ABI (e.g. when building with `-fno-ms-extensions`
      with clang).
      
      To address this, introduce `kMicrosoftAbiVer`, which defaults to `_MSC_VER`,
      but can be overridden manually if necessary. This should do the right thing by
      default most of the time, while providing an escape hatch for when `_MSC_VER`
      would be incorrect to use directly.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D7377853
      
      fbshipit-source-id: dd868370e9a496b98dd26dec77c4a75c49147c3c
      a228d714
    • Kevin Doherty's avatar
      Avoid calling emplace_back from collectN future callbacks · 37515540
      Kevin Doherty authored
      Summary:
      Currently, `collectN` attaches a callback to each input future. When the callback fires, it calls `emplace_back` on vector `ctx->v` with the result of the future. As the added unit test shows, this does not work if the futures are completed in parallel.
      
      See https://fb.facebook.com/groups/474291069286180/permalink/1838209692894304/ for more discussion.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D7372982
      
      fbshipit-source-id: 875eff19172bdbfb7d4f687911f4fa22061e4ed8
      37515540
  4. 24 Mar, 2018 3 commits
    • Orvid King's avatar
      Eliminate std::tr1 references · 1d4b2e2e
      Orvid King authored
      Summary:
      `std::tuple` and `std::unordered_map` have long been standardized and supported by every platform we care about.
      Beyond that MSVC is starting to remove the tr1 namespace entirely, so these references don't work under the newest MSVC.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D7389783
      
      fbshipit-source-id: c089490360ebf15ac23925f71e991602fda3d7a0
      1d4b2e2e
    • Orvid King's avatar
      Add an additional guard to only enable std::launder aliasing if launder is actually enabled · 091bfa60
      Orvid King authored
      Summary: The nightlies for MSVC included support for std::launder, but the version that released with VS2017.7 Preview 2 doesn't actually support it. The version included in the preview also adds a macro to detect if it's been enabled, so use that.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D7388311
      
      fbshipit-source-id: 197230c9947cb271d6107d0cd5e905643e5589d1
      091bfa60
    • Orvid King's avatar
      Add an option to the MSVC build to suppress boost's out of date config messages · 5777c54e
      Orvid King authored
      Summary:
      MSVC moves faster than boost updates, so it's not unusual to be building with an MSVC newer than the boost being used was able to be tested against. This causes Boost to emit a message at compile time for every compilation unit it is included in.
      Luckly, boost provides a way out of the message, so add a config option to do so and enable it by default.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D7388583
      
      fbshipit-source-id: 8ecddc048df432df5200f4601e4121bdbd275220
      5777c54e
  5. 23 Mar, 2018 10 commits
    • Yedidya Feldblum's avatar
      Use C++ thread_local for fast-path cache in SingletonThreadLocal · d6dd4b47
      Yedidya Feldblum authored
      Summary:
      [Folly] Use C++ `thread_local` for fast-path cache in `SingletonThreadLocal`.
      
      Because modules might be `dlclose`'d, use `static thread_local` rather than `static __thread` in the slow path which integrates the dtor into both `dlclose` and thread exit.
      
      Because there might be multiple dynamically-loaded modules where the `static __thread` caches cannot be merged into a single cache, let all caches be tracked in a list. We have not found a case where this can happen while at the same time the `StaticSingletonManager` singleton does get merged, but this is at least not strictly wrong.
      
      Reviewed By: djwatson
      
      Differential Revision: D7316155
      
      fbshipit-source-id: 0bf06638853ed70464856853349445d9fa6eabc0
      d6dd4b47
    • Mainak Mandal's avatar
      better error handling for ThreadLocal ctor · 3ce3a0c3
      Mainak Mandal authored
      Summary: Currently, initializing a `ThreadLocal` with 0 silently passes and then fails at a later stage making it very hard to debug what went wrong
      
      Reviewed By: yfeldblum
      
      Differential Revision: D7326627
      
      fbshipit-source-id: dab62166753168e292f67938c52f82a1b610be2a
      3ce3a0c3
    • Igor Sugak's avatar
      remove trailing ; · 13cf726e
      Igor Sugak authored
      Summary:
      Latest clang reported `-Wextra-semi` in `BOOST_MPL_HAS_XXX_TRAIT_DEF` uses with the trailing `;`. Codemod them away before the upgrade.
      ```lang=bash
      fbgr -sl 'BOOST_MPL_HAS_XXX_TRAIT_DEF\(.*\);$' | xargs perl -pi -e 's,(BOOST_MPL_HAS_XXX_TRAIT_DEF\(.*\));$,\1,'
      ```
      
      Reviewed By: yfeldblum
      
      Differential Revision: D7383619
      
      fbshipit-source-id: f7f9415617cf6d4a876ebe8bf782d0115cd01c23
      13cf726e
    • yuyoyuppe's avatar
      Fix msvc ProducerConsumerQueue compilation and update its doc · 2598a080
      yuyoyuppe authored
      Summary:
      Compilation of basic sample from doc using VS2017 currently fails with:
      ```
      C2327 'folly::ProducerConsumerQueue<folly::fbstring>::writeIndex_': is not a type name, static, or enumerator
      ```
      Fixed it and updated the docs.
      Closes https://github.com/facebook/folly/pull/806
      
      Reviewed By: akrieger
      
      Differential Revision: D7379931
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: 6b7a72abd3324af56de355a6e65bdc7e1195596d
      2598a080
    • Igor Sugak's avatar
      require trailing ; when using BENCHMARK_DRAW_LINE macro · b20cd8da
      Igor Sugak authored
      Summary:
      Macro BENCHMARK_DRAW_LINE can be used as the following:
      ```lang=bash
      BENCHMARK_DRAW_LINE()
      BENCHMARK_DRAW_LINE();
      ```
      This inconsistency was detected by `-Wextra-semi` in the latest clang. This diff removes the trailing `;` inside `BENCHMARK_DRAW_LINE` and updates all of the references.
      
      ```lang=bash
      fbgr -sl 'BENCHMARK_DRAW_LINE\(\)' | xargs perl -pi -e 's,(?<!#define )BENCHMARK_DRAW_LINE\(\)(?!;),BENCHMARK_DRAW_LINE\(\);,'
      ```
      
      Reviewed By: yfeldblum
      
      Differential Revision: D7382525
      
      fbshipit-source-id: 76f1da01bb4dde1b0fa4ebf98748d001d8e04ab0
      b20cd8da
    • Aaryaman Sagar's avatar
      Add piecewise_construct constructor to folly::Syncronized · 8581e9e0
      Aaryaman Sagar authored
      Summary: As title
      
      Reviewed By: yfeldblum
      
      Differential Revision: D7379148
      
      fbshipit-source-id: 6865940adee5899a055e1dac6b23705db2bc8ed7
      8581e9e0
    • Xiao Shi's avatar
      fix bulk erase in `F14VectorMap` · 26262a91
      Xiao Shi authored
      Summary:
      `iterator F14VectorMap::erase(const_iterator, const_iterator)` was missing a
      conversion from `const_iterator` to `iterator`. This diff adds it as well as a
      test. For sets, `iterator == const_iterator` so no need for anything special.
      
      Perhaps we could save the roundtrip from iterator space to index space and
      back using some const_cast of fancy pointers? The cost is going to be amortized
      anyway...
      
      Reviewed By: nbronson
      
      Differential Revision: D7373152
      
      fbshipit-source-id: 91f651b3e4a1314c68fb8809baeb1477f8881790
      26262a91
    • Yedidya Feldblum's avatar
      Gate hazptr static_assert on _CPPLIB_VER vs _MSC_VER · 1813a644
      Yedidya Feldblum authored
      Summary:
      [Folly] Gate `hazptr` `static_assert` on `_CPPLIB_VER` vs `_MSC_VER`.
      
      It's a property of the standard library implementation, not a property of the compiler front-end.
      
      Reviewed By: smeenai, Orvid
      
      Differential Revision: D7378222
      
      fbshipit-source-id: 78d04252df751b683c0099cb0c273302ff388b73
      1813a644
    • Shoaib Meenai's avatar
      Support 32-bit Windows in exception wrapper · 7d625d63
      Shoaib Meenai authored
      Summary:
      It's easy enough to calculate the right offset for both 32 and 64-bit
      platforms, so we can just do so instead of hardcoding the 64-bit offset.
      
      Reviewed By: yfeldblum, Orvid
      
      Differential Revision: D7377039
      
      fbshipit-source-id: 5f7efbae58b7694801274e195a97b5e5b62b5a5e
      7d625d63
    • John Strizich's avatar
      add better error for passing config with no steps · e37d52f2
      John Strizich authored
      Summary: in response to https://github.com/facebook/openr/issues/23
      
      Reviewed By: snarkmaster
      
      Differential Revision: D7342371
      
      fbshipit-source-id: 15737f79900722ce016494f994932aa26e5acad5
      e37d52f2
  6. 22 Mar, 2018 7 commits
    • Yedidya Feldblum's avatar
      Enable -Wshadow for clang and gcc >= 5 · 84f6689c
      Yedidya Feldblum authored
      Summary:
      [Folly] Enable `-Wshadow` for clang and gcc >= 5.
      
      And disable it globally for gcc < 5 (sorry, but not sorry). The gcc < 5 implementation is far too restrictive.
      
      Reviewed By: meyering
      
      Differential Revision: D7320760
      
      fbshipit-source-id: 49cc971afcacc92b0bb2d9c4b2d7b04405fb95b3
      84f6689c
    • Perry Randall's avatar
      Back out "[thrift-py3] Fixed Long Standing issue with Clients causing aborts when used wrong" · 5acf60f6
      Perry Randall authored
      Summary:
      Original commit changeset: 4f59f6c3c8aa
      
      This is to address segfaulting in instagram server tests
      
      Reviewed By: fried
      
      Differential Revision: D7368716
      
      fbshipit-source-id: ef28fdc17fb72631550d81616c24498a3b3894a1
      5acf60f6
    • Xiao Shi's avatar
      add F14 forward declaration as a separate header file · 9dfbfa1f
      Xiao Shi authored
      Summary:
      This diff adds a header file which includes forward declaration of F14
      containers.
      
      Reviewed By: nbronson
      
      Differential Revision: D7342805
      
      fbshipit-source-id: 01e867792d8bde3769f4c71dfb6b80574b13f2b6
      9dfbfa1f
    • Xiao Shi's avatar
      inherit from instead of type aliasing in F14 fallback · 77e4a6f1
      Xiao Shi authored
      Summary:
      * make F14 containers their own types even on platforms where we fall back to
      stl containers.
      * extract F14FastMap to be the same conditional typedef.
      * define custom swap operators to avoid unnecessary move construct and move
        assignment.
      
      Reviewed By: nbronson
      
      Differential Revision: D7295846
      
      fbshipit-source-id: 92faa2feddc5c85dd17a5dd937004ca1839a09f6
      77e4a6f1
    • Adam Simpkins's avatar
      logging: treat `/` and `\\` as category name separators · 8ee1ac19
      Adam Simpkins authored
      Summary:
      Update the LogName code to also treat `/` and `\\` as category separators, just
      like `.`.
      
      This makes it easy to use directory and file names directly as log category
      names.  The XLOG() code already turns file names in to log category names.
      Previously `getXlogCategoryNameForFile()` had to do its own translation of
      directory separators into `.`.  Users manually had to perform this translation
      on their own when setting the configuration for specific categories.
      
      This change makes it possible for users to specify the filename as input
      directly when updating the logging configuration and it automatically updates
      the correct category.
      
      This also allows us to avoid allocating a new string in
      `getXlogCategoryNameForFile()` since we no longer have to translate directory
      separator characters there.
      
      Reviewed By: chadaustin
      
      Differential Revision: D7348520
      
      fbshipit-source-id: 0e996f4351798b4636786a14ebb2d8820a2cc153
      8ee1ac19
    • Alfredo Altamirano's avatar
      Fix integer overflow in futures retrying library · 93474ecf
      Alfredo Altamirano authored
      Summary:
      retryingPolicyCappedJitteredExponentialBackoff had an integer overflow.
      This occured usually when we had more than 64 retries, since we compute pow(2, n) and then we convert to a 64 bit integer.
      I added a check that it won't overflow, and if it does, then it returns the max_backoff value.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D7284952
      
      fbshipit-source-id: 7424f502b8530f8e39ba0513dd70bfc9fdc5c8e5
      93474ecf
    • Dan Melnic's avatar
      Revert NotificationQueue changes until the thread local changes land · c19e93ed
      Dan Melnic authored
      Summary:
      Revert NotificationQueue changes until the thread local changes land
      
      (Note: this ignores all push blocking failures!)
      
      Reviewed By: yfeldblum
      
      Differential Revision: D7359322
      
      fbshipit-source-id: c59c81c34b341e4a968b2ce14947b558b8db3a85
      c19e93ed
  7. 21 Mar, 2018 3 commits
    • Orvid King's avatar
      Cleanup folly/experimental/coro/ to fit within Folly's normal style guidelines · cf080bee
      Orvid King authored
      Summary: This means using "test" rather than "tests" for the name of the test directory.
      
      Reviewed By: wqfish
      
      Differential Revision: D7355701
      
      fbshipit-source-id: 262f746a983eef550dd9271a026e0d243d8a335d
      cf080bee
    • John Strizich's avatar
      update example to more modern os and gcc · cf10ed79
      John Strizich authored
      Summary:
      Openr is only doing travis ci for ubuntu 16.04 with gcc 5 so having
      the example with the older flavors can be misleading for our community.
      
      Reviewed By: saifhhasan
      
      Differential Revision: D7345130
      
      fbshipit-source-id: 684cc8e58a650050b6f63c2ec20aac1857476da7
      cf10ed79
    • Jason Fried's avatar
      Fixed Long Standing issue with Clients causing aborts when used wrong · 451bbd4d
      Jason Fried authored
      Summary:
      Python is considered a Safe Enivronment, where things like aborts and segfaults
      can not happen.
      
      If clients where used outside of "async with" we use to print a error message
      and then C++ would abort.
      
      This fix makes sure C++ no longer aborts but we still print the message
      that the "async with" should be used.
      
      Reviewed By: ambv
      
      Differential Revision: D6923956
      
      fbshipit-source-id: 4f59f6c3c8aa5c8b2c279c728a8c011a040940af
      451bbd4d