1. 24 Jul, 2019 7 commits
    • Nanshu Chen's avatar
      Python async_generator bridge to folly::coro::AsyncGenerator · 4e3b3415
      Nanshu Chen authored
      Summary: Given a cpp folly::coro::AsyncGenerator, a python async generator/iterator may be built and bridged to it. Users may use `async for ...` syntax to consume data from it.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D16404979
      
      fbshipit-source-id: dd2dfd52d00bd1a3e30e838359a27458744f6461
      4e3b3415
    • Matt Glazar's avatar
      Fix tests with Python 2.7 · ae2d0a61
      Matt Glazar authored
      Summary:
      Some people want to use getdeps with Python 2.7. This looks easy to do, so take a step toward Python 2.7 support by fixing getdeps' tests when run with Python 2.7.
      
      For Python 3, this diff should not change behavior.
      
      This diff should address https://github.com/facebook/bistro/issues/35.
      
      Reviewed By: snarkmaster
      
      Differential Revision: D16435667
      
      fbshipit-source-id: f5c262b12995b609263341c4de26dac7f9b12b70
      ae2d0a61
    • Christian Clauss's avatar
      Remove `sudo: required` from `.travis.yml` (#37) · e730c5f7
      Christian Clauss authored
      Summary:
      This is just https://github.com/facebook/bistro/pull/37/, backported to `fbcode_builder`.
      
      snarkmaster
      Pull Request resolved: https://github.com/facebook/bistro/pull/37
      
      Test Plan: Push and watch Travis
      
      Reviewed By: simpkins
      
      Differential Revision: D16453080
      
      Pulled By: snarkmaster
      
      fbshipit-source-id: a15eaead931f046c41e50f8e3b412ef68b172d65
      e730c5f7
    • Nick Terrell's avatar
      Remove unnecessary copies in dynamic::hash() · 6b849e9d
      Nick Terrell authored
      Summary:
      `dynamic::hash()` would copy every key-value pair in the object accumulator hash because of two bugs in the code:
      1. The lambda took `auto` instead of `auto const&`
      2. The hasher was `hash<pair<dynamic, dynamic>>` not `hash<pair<dynamic const, dynamic>>` meaning a conversion was needed.
      
      These bugs together caused 2 copies for each sub-object. Since the copies are recursive, each object got copied 2*depth times.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D16452213
      
      fbshipit-source-id: 64a55e1640abb022c148183646e9f9720fd8482e
      6b849e9d
    • Alastair Harrison's avatar
      Fix libc++ ASAN failures in resizeWithoutInitialization (#1194) · 0752c055
      Alastair Harrison authored
      Summary:
      This is a proposed fix for issue: https://github.com/facebook/folly/issues/1193
      Using `folly::resizeWithoutInitialization` with libc++ and the address sanitizer causes false positive 'container overflow' failures.
      
      This PR only addresses the problem for resizing `std::vector`. Presumably the version of `folly::resizeWithoutInitialization` for `std::string` has the same problem, but I have not verified this.
      
      ### Potential issues
      This PR assumes that the `__sanitizer_annotate_contiguous_container` is available in libc++, and that the `std::vector` implementation has been annotated with it. The latter occurred in ~2014:
      http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/vector?r1=191987&r2=208319&pathrev=208319
      
      If there are people using C++14 compilers with versions of libc++ predating the addition of the `std::vector<T>::__annotate_contiguous_container` member function then this fix will fail to compile.
      
      I'm not aware of any sane way to detect the exact version of libc++ being used. Perhaps a suitable mitigation for those (few?) people with a C++14 compiler and pre-2015 libc++ implementation would be to provide a `FOLLY_` macro to disable the annotation.
      Pull Request resolved: https://github.com/facebook/folly/pull/1194
      
      Reviewed By: yfeldblum
      
      Differential Revision: D16445890
      
      Pulled By: nbronson
      
      fbshipit-source-id: ef33bbd5cc12c71822985c5174bf8e47e6eb3757
      0752c055
    • Yedidya Feldblum's avatar
      Extract type aliases in LtHash members · 32767e68
      Yedidya Feldblum authored
      Summary: [Folly] Extract type aliases in `LtHash` members to avoid unnatural line breaks and indentation.
      
      Reviewed By: modocache
      
      Differential Revision: D16453375
      
      fbshipit-source-id: 8d68458ba3ba7bf79fef82986f4f170e3b74ddd6
      32767e68
    • Yedidya Feldblum's avatar
      Apply clang-format to folly/experimental/crypto/ · e77bffe8
      Yedidya Feldblum authored
      Summary: [Folly] Apply `clang-format` to `folly/experimental/crypto/`.
      
      Reviewed By: modocache
      
      Differential Revision: D16453122
      
      fbshipit-source-id: 5a24b20dba3ab472cd490afaaa24e7ab1c1295ec
      e77bffe8
  2. 23 Jul, 2019 4 commits
    • Adam Simpkins's avatar
      fix handling of common arguments · 84c30daf
      Adam Simpkins authored
      Summary:
      getdeps allowed common arguments to be specified either before or after
      the subcommand name.  However, the arguments were only actually honored
      if they were specified on the command line after the subcommand name.
      Specifying any of these arguments before the subcommand would simply be
      ignored, and the default value would be used.  This happened since the
      subcommand argument's default value overwrote the value specified by the
      user from the main command parser.
      
      This fixes the behavior by using `argparse.SUPPRESS` so that argparse
      won't set the value at all if it was not specified.  This allows the
      value from the main parser to be used correctly if the argument was not
      seen by the subcommand parser.
      
      Reviewed By: chadaustin
      
      Differential Revision: D16435358
      
      fbshipit-source-id: f3893ef7a27fb018247f249f313d6438472e0140
      84c30daf
    • Nick Terrell's avatar
      Fix memory leak when exception is thrown · 7dfd49f2
      Nick Terrell authored
      Summary: F14NodeSet::insert() leaks memory when construction throws.
      
      Reviewed By: yfeldblum, nbronson
      
      Differential Revision: D16399317
      
      fbshipit-source-id: 4c9385288dd212469dfbd10b3e990b3533dc66d3
      7dfd49f2
    • Dan Melnic's avatar
      eachToTuple: use to<fbstring>(delim) instead of delim · 133d8937
      Dan Melnic authored
      Summary: eachToTuple: use to<fbstring>(delim) instead of delim
      
      Reviewed By: yfeldblum
      
      Differential Revision: D16419866
      
      fbshipit-source-id: 7a57f41ea210c569284f6c619784adc95f03b26e
      133d8937
    • Andrii Grynenko's avatar
      Fix timed_wait to not hold executor keep-alive for too long · dd15371c
      Andrii Grynenko authored
      Reviewed By: yfeldblum
      
      Differential Revision: D16426555
      
      fbshipit-source-id: 0211c58b6919dc412b9cd7a029f0543d0060b40b
      dd15371c
  3. 22 Jul, 2019 4 commits
    • Andrii Grynenko's avatar
      scheduleOn should accept a KeepAlive · 56600ae2
      Andrii Grynenko authored
      Differential Revision: D16368120
      
      fbshipit-source-id: 0511e2f84b3bf8d1affbfbeecd05c04cb0269037
      56600ae2
    • Paul Gossman's avatar
      Add missing include guard to coro/detail/Helpers.h · 931299b7
      Paul Gossman authored
      Summary: This file is included in `coro/TimedWait.h` and `coro/Collect.h`, so inclusion of those two headers is causing redefinition errors.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D16414841
      
      fbshipit-source-id: 103fa87a7c978d256e58eb67089b4cb984d362e4
      931299b7
    • Chad Austin's avatar
      turn off /EHa · a5e8658c
      Chad Austin authored
      Summary:
      The /EHa flag tells MSVC to catch asynchronous (structured) exceptions
      in `catch(...)` blocks. This is generally a bad idea, because
      structured exceptions include page faults, stack overflow, division by
      zero, and illegal instructions, at which point attempting to run
      further arbitrary C++ code will have wonky effects in the best
      case. It would probably also clobber any state required to debug the
      original failure.
      
      Reviewed By: Orvid
      
      Differential Revision: D16390933
      
      fbshipit-source-id: 2997daaf350680dc9d0c7da3cabab8749e8ecb82
      a5e8658c
    • Nick Terrell's avatar
      Only throw std::invalid_argument on parse error · 08fbd1d3
      Nick Terrell authored
      Summary:
      The documentation claims that the constructor only throws
      `std::invalid_argument`, but it could throw a `ConversionError`.
      
      Reviewed By: Orvid
      
      Differential Revision: D16387303
      
      fbshipit-source-id: 887a84f48a49acdc0516605f8204432bfd8ca800
      08fbd1d3
  4. 21 Jul, 2019 2 commits
  5. 19 Jul, 2019 5 commits
    • Adam Simpkins's avatar
      update CMakeBuilder to raise an exception if we cannot find CMake · ca788235
      Adam Simpkins authored
      Summary:
      If `path_search()` returns that CMake is not available, raise an Exception and
      fail the build.  This makes the failure somewhat easier to to identify.
      Without this the code would continue and would try to invoke `subprocess` with
      a value of `None` in the command argument list.  This error is slightly harder
      to debug, since it isn't clear which command argument or environment variable
      is not a string.
      
      Reviewed By: chadaustin
      
      Differential Revision: D16354623
      
      fbshipit-source-id: be972b02cb13bc70db0f867da70e5bf4c6cec46d
      ca788235
    • Adam Simpkins's avatar
      normalize the scratch path · 1d6854a4
      Adam Simpkins authored
      Summary:
      The scratch path is used as part of the hash computation for each project.  We
      need to make sure this path is always normalized to ensure that we compute the
      hashes consistently.
      
      Reviewed By: chadaustin
      
      Differential Revision: D16354624
      
      fbshipit-source-id: 39b5362620bdc247cd7e7f1333dac319b354dc6f
      1d6854a4
    • Adam Simpkins's avatar
      cache results of path_search() · 4c4d3911
      Adam Simpkins authored
      Summary:
      getdeps currently ends up calling `path_search()` repeatedly searching for
      various C/C++ compilers in $PATH.  It ends up doing this multiple times for
      each dependency as it computes the project hashes.  This updates the
      `path_search()` function to cache its results so that we don't keep performing
      the same searches on the file system over and over again.
      
      Reviewed By: chadaustin
      
      Differential Revision: D16354625
      
      fbshipit-source-id: 116293bd2f636632517d26436b2332e6c10624f1
      4c4d3911
    • Dan Melnic's avatar
      Fix mem leak due to observer not being freed · 9b2c712d
      Dan Melnic authored
      Summary: Fix mem leak due to observer not being freed
      
      Reviewed By: yfeldblum
      
      Differential Revision: D16234386
      
      fbshipit-source-id: 54ea9e904cf6cde0e24edf1511c2e3b46a58376f
      9b2c712d
    • Chad Austin's avatar
      build CompressionTest on macOS · c4f04f9a
      Chad Austin authored
      Summary: This particular `std::min` is ambiguous on macOS.
      
      Reviewed By: simpkins
      
      Differential Revision: D16352637
      
      fbshipit-source-id: d444b4b5f22c94b76da5463493efe433829bbba5
      c4f04f9a
  6. 18 Jul, 2019 1 commit
    • Nanshu Chen's avatar
      Py_INCREF/Py_DECREF when bridging coro task to python future and fix typo · 7186e58a
      Nanshu Chen authored
      Summary:
      1. Py_INCREF when holding py future object in bridge function. Py_DECREF in a scope guard.
      2. fix typo("folly::coroTask" should be "folly::coro::Task")
      
      Reviewed By: yfeldblum, andriigrynenko
      
      Differential Revision: D16341866
      
      fbshipit-source-id: 1d5b946596cd86c4a949e2c66f007a6140046506
      7186e58a
  7. 17 Jul, 2019 2 commits
    • Chad Austin's avatar
      transitively carry thrift dependencies forward · 60950182
      Chad Austin authored
      Summary: eden.thrift includes fb303_core.thrift, so any cmake target that depends on eden.thrift should pull in fb303_core.thrift's include directories and libraries. Implement that machinery in CppThriftLibrary.cmake.
      
      Reviewed By: wez
      
      Differential Revision: D16062657
      
      fbshipit-source-id: d5d962960e767a138a9b634a12aebccf72d6ef43
      60950182
    • Chad Austin's avatar
      add fbcode_builder manifest · 593c828e
      Chad Austin authored
      Summary: Add a manifest and CMakeLists.txt for building fb303 with cmake.
      
      Reviewed By: wez
      
      Differential Revision: D15480895
      
      fbshipit-source-id: d47f6ef9b9383b79b31a6170c7d4c9e8337de4d8
      593c828e
  8. 16 Jul, 2019 3 commits
    • Lee Howes's avatar
      Deprecate executor-taking forms of Future::then · d81227d1
      Lee Howes authored
      Summary:
      Deprecate Future::then(executor, callback) pending removal.
      
      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: D16282826
      
      fbshipit-source-id: a94c994cf02f43f7a2bd857237885b25591fa9aa
      d81227d1
    • Chad Austin's avatar
      fbcode_builder: use build interface generator expression for thrift include directories · 9cdbf0f1
      Chad Austin authored
      Summary:
      Fix an error about source directories being included in the include
      path in add_thrift_cpp2_library. I don't know why this was failing for
      fb303 and not for other projects, but adding a generation expression
      appears to fix the issue.
      
      Reviewed By: strager
      
      Differential Revision: D15725024
      
      fbshipit-source-id: 6c02fed6c6703733cf9e0b130c0f90b70e3ea300
      9cdbf0f1
    • Rui Zhang's avatar
      Add Singleton::apply and unit tests. · 34a5bd8c
      Rui Zhang authored
      Summary: Adds a callback interface to facilitate adding elision support for folly::Singleton. Planned to add context-aware elision support which will use an adaptation method based on the interface's callsite information (ie, the type of the Singleton instance, T, and the type of the callback function, F).
      
      Reviewed By: nbronson
      
      Differential Revision: D15970597
      
      fbshipit-source-id: 1010322c64d1b7900b4bef5b35059238efabb071
      34a5bd8c
  9. 15 Jul, 2019 3 commits
  10. 12 Jul, 2019 2 commits
    • Dan Melnic's avatar
      TSAN: AtForkList::child() - ignore reads, writes and sync · 58a6cebe
      Dan Melnic authored
      Summary:
      TSAN: AtForkList::child() - ignore reads, writes and sync
      
      (Note: this ignores all push blocking failures!)
      
      Reviewed By: yfeldblum
      
      Differential Revision: D16196384
      
      fbshipit-source-id: 28ea3b9fdb317eaffcb428f6ae705d5c4e5de887
      58a6cebe
    • Adam Simpkins's avatar
      improve the code that searches for dumpbin.exe · b0e08c4a
      Adam Simpkins authored
      Summary:
      Fix dyndeps.py to find dumpbin.exe in more situations.
      
      Previously the code looked for dumpbin.exe under Visual Studio directories
      named either `BuildTools` or `Community`.  On a system with an MSVC 2017
      Professional install it is instead located under a directory named
      `Professional`.  This updates the glob to allow any directory name here.
      
      Reviewed By: pkaush
      
      Differential Revision: D16207692
      
      fbshipit-source-id: 1a57ec29653a89fd3e751b3e4408a298b4632b11
      b0e08c4a
  11. 11 Jul, 2019 4 commits
    • Ahmed Soliman's avatar
      Move iobuf Python wrapper from thrift to folly · c82e22f5
      Ahmed Soliman authored
      Summary:
      We expose iobuf to Python via the folly.iobuf Python extension. The code for this extension has historically been in the fbthrift source tree. Move it to folly so that folly produces folly extensions and thrift produces thrift extensions.
      
      Without this change we end up with the folly.iobuf Cython extension being packaged with thrift rather than folly, leading the need for a number of work-arounds to allow Python and Cython to find folly.iobuf without stopping their searches on folly.executor.
      
      The tests for IOBuf python extension has been added to folly while maintaining the thrift-specific IOBuf tests in thrift.
      
      Reviewed By: vitaut
      
      Differential Revision: D14405645
      
      fbshipit-source-id: 662a4e32c219f6d044bb6e903a2525ec1b4059c5
      c82e22f5
    • Puneet Kaushik's avatar
      getdeps: Extend is_objfile() to Windows class to only select files with .exe extension · 51a8d664
      Puneet Kaushik authored
      Summary: is_objfile() is used to find the executable files in the given project. Getdeps will only find and copy the dependencies of the binaries identified by this function. On Windows we will copy only the dependencies for an exe file.
      
      Reviewed By: chadaustin
      
      Differential Revision: D16185962
      
      fbshipit-source-id: f6b5089401b242514a845e3a97b3804051d93c1c
      51a8d664
    • Andrii Grynenko's avatar
      Fix releaseDeferredExecutor to not access Executor if callback was set · 1766f03f
      Andrii Grynenko authored
      Summary: Instead of using setCallbackAndDetach (which is hard to apply in all cases because of cancellation), this diff fixes releaseDefferedExecutor.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D16189338
      
      fbshipit-source-id: 47ef192dd0cec3c13824071c8ba7e1dd06968a70
      1766f03f
    • Matt Glazar's avatar
      Fix typo in documentation · f8533d7f
      Matt Glazar authored
      Reviewed By: yfeldblum
      
      Differential Revision: D15915100
      
      fbshipit-source-id: afc131bdf143ac0eec15523e257545d63207cb34
      f8533d7f
  12. 10 Jul, 2019 1 commit
    • Wez Furlong's avatar
      RIP: travisbot notifications · f4849667
      Wez Furlong authored
      Summary:
      This are noisy and don't provide real value, so remove
      the webhooks.
      
      Reviewed By: yns88
      
      Differential Revision: D16115486
      
      fbshipit-source-id: 1daa2d78f4e786a42dcc5779ccd30c36e02d2445
      f4849667
  13. 09 Jul, 2019 2 commits
    • Christos Stratopoulos's avatar
      Compatibility with VS2019 (#1182) · 38c76b0d
      Christos Stratopoulos authored
      Summary:
      Some changes to get Poly compiling with VS2019 (and correcting an oversight from https://github.com/facebook/folly/pull/1174)
      
      The change to `detail/TypeList.h` is straightforward I think.
      
      The introduction of `getOpsImpl` I find a bit distasteful...I will remark that as of Visual Studio 16.2.0 Preview 3.0 it is not necessary, but it is still needed on Visual Studio 16.1.5 (latest release, non preview).
      
      Orvid in your comment [here](https://github.com/facebook/folly/pull/1178#issuecomment-506864383)  you mentioned the question of supporting VS 2017 or VS 2019 given that Poly had no MSVC support at all beforehand. I re-downloaded VS 2017 on my machine to test against the fixes added here and the situation seemed discouraging with lots more errors and perhaps less obvious workarounds.
      
      I have not made any changes to the CMake stuff for Poly on MSVC: https://github.com/facebook/folly/blob/master/CMakeLists.txt#L235
      
      I'm not sure if once we resolve the issue above we might want to add some logic maybe [here](https://github.com/facebook/folly/blob/master/CMakeLists.txt#L63) to handle which version of MSVC is approved for poly; will wait for further direction on that.
      Pull Request resolved: https://github.com/facebook/folly/pull/1182
      
      Reviewed By: Orvid
      
      Differential Revision: D16109504
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: d20b242494b075ce91452215c2025584fe488d65
      38c76b0d
    • Scott Haskin's avatar
      Fix for test AsyncSocketTest.getBufInUse · f14a5668
      Scott Haskin authored
      Summary:
      Test AsyncSocketTest.getBufInUse was throwing exceptions, I believe
      this should fix those issues. The problem appeared to be that the socket
      connection did not always work immediately so we needed to call loop() on the
      event base so that an async connection could complete.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D16052111
      
      fbshipit-source-id: 9793e613eea5b17cb3ab00605355102b2f8807d8
      f14a5668