1. 26 Mar, 2018 1 commit
  2. 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
  3. 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
  4. 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
  5. 21 Mar, 2018 4 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
    • Xiao Shi's avatar
      move `Counts` and `Tracked` from F14MapTest.cpp to F14TestUtil.h · e3f2a695
      Xiao Shi authored
      Summary:
      Move the helper classes into F14TestUtil header so that F14SetTest could use
      them as well.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D7336571
      
      fbshipit-source-id: 9fc96e43fe882d05b6b6fbcd075a42f5184f7d62
      e3f2a695
  6. 20 Mar, 2018 8 commits
    • Adam Simpkins's avatar
      update EXPECT_THROW_ERRNO() to match std::generic_category · 2be7915e
      Adam Simpkins authored
      Summary:
      std::system_error exceptions generated from an errno value should use
      `std::generic_category`.  Previously EXPECT_THROW_ERRNO() only handled
      exceptions using `std::system_category` since `folly/Exception.h` (incorrectly)
      throws exceptions using `std::system_category`
      
      This updates EXPECT_THROW_ERRNO() to accept either std::generic_category or
      std::system_category.
      
      In the future we can drop the check for std::system_category here once we fix
      folly/Exception.h to throw exceptions using std::generic_category.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D7329998
      
      fbshipit-source-id: 89295d7c8276c9119c29325bf35c0bf27452b779
      2be7915e
    • Jason Fried's avatar
      ThriftServer and get_client support for bind address and unix sockets · c85bb59d
      Jason Fried authored
      Summary:
      This diff fixes a bug in get_client flow where we accepted hostnames but didn't perform DNS resolution on them.  That has been fixed by constructing the SocketAddress passing true to allowNameLookup.
      
      While writing a unittest for this I realized that we didn't support binding servers to localhost, so I allowed for doing so.
      
      Then I realized that it would be pretty simple to extend both get_client and ThriftServer to allow for unix sockets.
      
      Discovered that unittests waiting for server.get_address() could wait forever if there was some exception in server.serve(). So I propigated the exception to the get_address future if it is not .done().
      
      I updated all callsites that could accept a hostname/ip to accept and ipaddress object.
      I updated path to accept a str or a Pathlike to support pathlib.Path.
      
      Reviewed By: ambv
      
      Differential Revision: D6911229
      
      fbshipit-source-id: 2919a720da6bfa79db85fe55de10e8519ea39c82
      c85bb59d
    • Yedidya Feldblum's avatar
      Let FileUtil::writeFileAtomic use generic_category · 51d23d49
      Yedidya Feldblum authored
      Summary:
      [Folly] Let `FileUtil::writeFileAtomic` use `generic_category`.
      
      `generic_category` is the right choice overall.
      
      And this is an excuse to decouple `FileUtil` from `Conv`.
      
      Reviewed By: simpkins
      
      Differential Revision: D7314184
      
      fbshipit-source-id: fbec3e71098e3ca41b202964886b2740ca592229
      51d23d49
    • Yedidya Feldblum's avatar
      Extract a helper alias for ctor SFINAE in SingletonThreadLocal · 69e68b71
      Yedidya Feldblum authored
      Summary: [Folly] Extract a helper alias for ctor SFINAE in `SingletonThreadLocal`.
      
      Reviewed By: djwatson
      
      Differential Revision: D7316150
      
      fbshipit-source-id: 7e3c49740dab3af37afa8a7a23f4e07cd93ff217
      69e68b71
    • Yedidya Feldblum's avatar
      Rearrange SingletonThreadLocal members · 6e98ea2a
      Yedidya Feldblum authored
      Summary: [Folly] Rearrange `SingletonThreadLocal` members, moving member types above member functions.
      
      Reviewed By: djwatson
      
      Differential Revision: D7316143
      
      fbshipit-source-id: c70b31935d9b5d7428bde777ea62832dc45b3971
      6e98ea2a
    • Yedidya Feldblum's avatar
      Split getWrapperTL from getWrapper in SingletonThreadLocal · 77c09b50
      Yedidya Feldblum authored
      Summary:
      [Folly] Split `getWrapperTL` from `getWrapper` in `SingletonThreadLocal`.
      
      Allows hypothetical future changes to operate on the `ThreadLocal<Wrapper>` singleton itself, in addition to the existing code which operates on the `Wrapper` per-thread-singleton.
      
      Reviewed By: djwatson
      
      Differential Revision: D7316099
      
      fbshipit-source-id: 80a8b7ce28da1bc64b204292032766c648f15944
      77c09b50
    • Yedidya Feldblum's avatar
      Cut unnecessary library-local comment in SingletonThreadLocal · 7882c205
      Yedidya Feldblum authored
      Summary: [Folly] Cut unnecessary `library-local` comment in `SingletonThreadLocal`.
      
      Reviewed By: djwatson
      
      Differential Revision: D7316088
      
      fbshipit-source-id: 08b8634b2f0d32776d548115109bc65732e4c880
      7882c205
    • Yedidya Feldblum's avatar
      Cut SingletonThreadLocal::getWrapperInline · 10a9dadf
      Yedidya Feldblum authored
      Summary:
      [Folly] Cut `SingletonThreadLocal::getWrapperInline`.
      
      It would not be useful in any scenario, given that the generated code is very large.
      
      Reviewed By: djwatson
      
      Differential Revision: D7315501
      
      fbshipit-source-id: 1ebc15ca0eaf13adaf52fae3971e7f9914bfe10e
      10a9dadf
  7. 19 Mar, 2018 7 commits
    • Steve O'Brien's avatar
      folly/IOBuf: remove expensive boost header + implement iterator · 9885dc08
      Steve O'Brien authored
      Reviewed By: yfeldblum
      
      Differential Revision: D7272553
      
      fbshipit-source-id: f0aaa278e6a81a53f78ae29b68f1bf9f1ba02899
      9885dc08
    • Dan Melnic's avatar
      Use unbounded queue in NotificationQueue (same as in D7164130 but with the... · 2f9ee5b8
      Dan Melnic authored
      Use unbounded queue in NotificationQueue (same as in D7164130 but with the hazptr fix from D7256905 and the singleton one from D7283390)
      
      Summary: Use unbounded queue in NotificationQueue (same as in D7164130 but with the hazptr fix from D7256905 and the singleton one from D7283390)
      
      Reviewed By: yfeldblum
      
      Differential Revision: D7278275
      
      fbshipit-source-id: 78ea94e1c9d492febd33106b06ce275d4a90a56a
      2f9ee5b8
    • Nathan Bronson's avatar
      save 8 bytes and a bit of work in F14Vector{Map,Set} · a2aff3ba
      Nathan Bronson authored
      Summary:
      F14VectorMap and F14VectorSet use ItemIter to interact with F14Table,
      but they don't actually need to be able to identify the begin ItemIter.
      This diff removes both the storage for packedBegin_ and the code to
      update it (present in all insert and erase functions) for that policy.
      This is a small CPU optimization, and reduces sizeof(F14Vector{Map,Set})
      from 32 bytes to 24.
      
      Reviewed By: shixiao
      
      Differential Revision: D7181769
      
      fbshipit-source-id: 318c63584543fca339a002d8bcb5872a7bd0bdd3
      a2aff3ba
    • Erik Hortsch's avatar
      Check that fiber suspends are not occuring in exception catch blocks · bfdcacf9
      Erik Hortsch authored
      Summary:
      Fiber suspends are incompatible with C++ exception handling. We should enforce that callers are not suspending fibers while handling exceptions.
      See https://fb.facebook.com/groups/560979627394613/permalink/1119586164867287/
      
      NOTE: This check currently fires not just for baton.wait() (and all things based on baton), but also for calling runInMainContext. I'm unsure of the safety of this.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6695110
      
      fbshipit-source-id: cf36edbab9f0573cbf639bf79d0c267681ac5914
      bfdcacf9
    • Neel Goyal's avatar
      Rename set/getServiceIdentity · 169e1f02
      Neel Goyal authored
      Summary: Rename set/getServiceIdentity to set/getSessionKey.  This is a more representative description since verified information is in the cert.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D7184169
      
      fbshipit-source-id: c9404419cb37d2b5ab2fcd8299975e514e3f495a
      169e1f02
    • Yedidya Feldblum's avatar
      Move folly/UncaughtExceptions.h to folly/lang/ · 0893755f
      Yedidya Feldblum authored
      Summary:
      [Folly] Move `folly/UncaughtExceptions.h` to `folly/lang/`.
      
      (Note: this ignores all push blocking failures!)
      
      Reviewed By: andrewjcg
      
      Differential Revision: D7319259
      
      fbshipit-source-id: 38d47503e150e01b5e4bcded6c8207484048bf84
      0893755f
    • Asier Gutierrez's avatar
      Missing installation of detail/Singleton.h · 2023e794
      Asier Gutierrez authored
      Summary:
      Makefile does not install detail/Singleton.h, which is needed by proxygen
      Closes https://github.com/facebook/folly/pull/804
      
      Reviewed By: andrewjcg
      
      Differential Revision: D7320496
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: 8c576fe53be8292fa51a3db50dcfaa1d1cb13b6a
      2023e794