1. 21 May, 2020 7 commits
    • Ian Petersen's avatar
      Enable building folly/Expected.h with coroutines on and exceptions off · 791aa797
      Ian Petersen authored
      Summary:
      `folly::expected_detail::Promise<Value, Error>` won't build with exceptions
      turned off (e.g. by passing `-fno-exceptions` on Clang's command line) because
      its `unhandled_exception()` says `throw;`.  This diff replaces the `throw;`
      with a call to `folly::rethrow_current_exception();`.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D21682605
      
      fbshipit-source-id: 294752590d54b0671395982ccdeb0386a742c01e
      791aa797
    • Yedidya Feldblum's avatar
      Use RequestToken in RequestEventBase · 8174190b
      Yedidya Feldblum authored
      Summary: [Folly] Use `RequestToken` in `RequestEventBase` to speed up lookup.
      
      Reviewed By: zhxchen17
      
      Differential Revision: D21529465
      
      fbshipit-source-id: eaaef7b48be2c5a8d76fb5f4a5293f7db7e68bed
      8174190b
    • Yedidya Feldblum's avatar
      Fix typo in checking hw checksum support · ed5983fe
      Yedidya Feldblum authored
      Summary: [Folly] Fix technical typo in checking hw checksum support, but which makes no practical difference.
      
      Differential Revision: D21689112
      
      fbshipit-source-id: 8ad71d20a561f4bbf5c413ce94e7bec227d9d940
      ed5983fe
    • Amir Livneh's avatar
      Fix instances of "the the" in comments · 6ff43051
      Amir Livneh authored
      Reviewed By: yfeldblum
      
      Differential Revision: D21666740
      
      fbshipit-source-id: 96975e777df0745f343c5b722f1d8c05bb8ac32e
      6ff43051
    • Yedidya Feldblum's avatar
      Tweak BlockingContext · f8dfa34d
      Yedidya Feldblum authored
      Summary: [Folly] Tweak `BlockingContext` in various ways.
      
      Differential Revision: D21657789
      
      fbshipit-source-id: 4b03b3b43dddc0e9011a7594001994f2594a1a5b
      f8dfa34d
    • Yedidya Feldblum's avatar
      Lock utilities · 2fc0cee3
      Yedidya Feldblum authored
      Summary:
      [Folly] Lock utilities: `upgrade_lock`, `transition_to_shared_lock`, `transition_to_upgrade_lock`, `transition_to_unique_lock`, `try_transition_to_unique_lock`.
      
      Note: `std::shared_mutex` does not have an upgrade state or any atomic transitions; there is no `std::upgrade_lock`; and `std::shared_lock` does not have a constructor from `std::unique_lock`.
      
      Reviewed By: simpkins, nbronson
      
      Differential Revision: D15532568
      
      fbshipit-source-id: d32f387b26b57539857922c3090dc75ffcaaa538
      2fc0cee3
    • Lee Howes's avatar
      Remove collectXSemiFuture · 8c529eea
      Lee Howes authored
      Summary:
      Migration from Future-returning executor-erasing collectX forms to
      SemiFuture-returning forms, that are less risky in particular with coroutines.
      
      Earlier changes added collectXSemiFuture and collectXUnsafe as a migration
      path. We then migrated collectX callsites to collectXSemiFuture or
      collectXUnsafe and switched the implementation of collectX to the SemiFuture
      form.
      
      This diff removes collectXSemiFuture completely.
      
      Reviewed By: yfeldblum, mpark
      
      Differential Revision: D21631886
      
      fbshipit-source-id: c7b296d51f30c8b51ab0c7d06b1ce62c8cdd28d5
      8c529eea
  2. 20 May, 2020 9 commits
    • Ian Petersen's avatar
      Enable building folly/Optional.h with coroutines on and exceptions off · 8abb78f4
      Ian Petersen authored
      Summary:
      `folly::detail::OptionalPromise<Value>` won't build with exceptions turned off
      (e.g. by passing `-fno-exceptions` on Clang's command line) because its
      `unhandled_exception()` says `throw;`.  This diff replaces the `throw;` with a
      call to `folly::rethrow_current_exception();`.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D21655976
      
      fbshipit-source-id: 5f431372f2494a09f98e3b8c36a94e8475efff29
      8abb78f4
    • Bryan Alger's avatar
      Fix win32 build of PThread · c6897700
      Bryan Alger authored
      Summary:
      This fails to build on win32 platform with:
      ```
      xplat\folly\portability\pthread.cpp(142): error C2664: 'HANDLE CreateThread(LPSECURITY_ATTRIBUTES,SIZE_T,LPTHREAD_START_ROUTINE,LPVOID,DWORD,LPDWORD)': cannot convert argument 3 from 'DWORD (__cdecl *)(void *)' to 'LPTHREAD_START_ROUTINE'
      ```
      
      This seems to fix it.
      
      Reviewed By: Orvid
      
      Differential Revision: D21623386
      
      fbshipit-source-id: 1b18a74bd71ffc75f34a92074e07f3d69742c07d
      c6897700
    • Yedidya Feldblum's avatar
      Small simplification of AsyncSocket read loop · 5009c3cb
      Yedidya Feldblum authored
      Summary: [Folly] Small simplification of `AsyncSocket` read loop.
      
      Differential Revision: D21514325
      
      fbshipit-source-id: 0af27205b4aa2807a800430e8a2b3dea36356970
      5009c3cb
    • Dan Melnic's avatar
      Add io_uring_submit_and_wait call · fca66cf3
      Dan Melnic authored
      Summary: Add io_uring_submit_and_wait call
      
      Reviewed By: yfeldblum
      
      Differential Revision: D21653382
      
      fbshipit-source-id: 945aa877a30b3c6431089a113ece5999d1217eb4
      fca66cf3
    • Matt Ma's avatar
      Remove unused name field in LocationInfo. · e8f3237c
      Matt Ma authored
      Reviewed By: yfeldblum, luciang
      
      Differential Revision: D21656746
      
      fbshipit-source-id: 5e19d72ccd524926c698b8814cc6c8f2c6133565
      e8f3237c
    • Dan Melnic's avatar
      fsync the temp file · 5309963f
      Dan Melnic authored
      Summary: fsync the temp file
      
      Reviewed By: yfeldblum, kevin-vigor
      
      Differential Revision: D21668049
      
      fbshipit-source-id: 85825f81dfbe10a452f7f946133bb3d8993850f8
      5309963f
    • Yedidya Feldblum's avatar
      rethrow_current_exception · 51bad111
      Yedidya Feldblum authored
      Summary: [Folly] `rethrow_current_exception`, a `-fno-exceptions` compatibility wrapper for `throw;`.
      
      Reviewed By: ispeters
      
      Differential Revision: D21656269
      
      fbshipit-source-id: 8f37fe71c6255162b8f05268cae04ac5927013d7
      51bad111
    • Nick Terrell's avatar
      Fix a typo in CpuId breaking gcc-6.5 builds · 29e37140
      Nick Terrell authored
      Summary:
      gcc-6.5 on OS X <= 10.6 complains about the `\r` when this code path
      is enabled. I don't think we officially support `__i386__`, but I want to
      backport the patch from zstd. https://github.com/facebook/zstd/pull/1418
      
      (Note: this ignores all push blocking failures!)
      
      Reviewed By: yfeldblum, Orvid
      
      Differential Revision: D13104652
      
      fbshipit-source-id: 737a68253c7d90c3a1cc026069b048551cb5ced9
      29e37140
    • Adam Simpkins's avatar
      use exceptionStr() when formating some errors in the logging code · 45f233c1
      Adam Simpkins authored
      Summary:
      If an error is thrown when formating arguments for a log message, use
      `folly::exceptionStr()` to format the exception instead of just `ex.what()`.
      
      I changed all of the tests that verify the results of these strings to use a
      regular expression, as `folly::exceptionStr()` produces different results in
      different platforms, and does not always demangle type names.
      
      I also included a minor change to increase a timeout in
      AsyncFileWriterTest.cpp, as I saw this timeout fail spuriously once in my
      testing.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D21635680
      
      fbshipit-source-id: 749ef48deb59af1f2faef0158e0291838e09fc38
      45f233c1
  3. 19 May, 2020 7 commits
    • Matt Ma's avatar
      Fix and refactor inline functions stack trace. · 2d2c15fc
      Matt Ma authored
      Summary:
      Fix the issue that there may be other tags like DW_TAG_lexical_block between DW_TAG_subprogram and DW_TAG_inlined_subroutine.
      
      Also increase the maximum inline location info per frame since previous value 3 is too small.
      
      Refactors the code to set file and line for inline functions.
      
      Reviewed By: luciang
      
      Differential Revision: D21250080
      
      fbshipit-source-id: f52dc74ee5c144aa26723546b48486f8a5250f19
      2d2c15fc
    • Dan Melnic's avatar
      Fix uninitialized maxSubmit_, maxGet_ member variables · 8228e607
      Dan Melnic authored
      Summary: Fix uninitialized maxSubmit_, maxGet_ member variables
      
      Reviewed By: danobi
      
      Differential Revision: D21645171
      
      fbshipit-source-id: 094ba7b045010954fdebc249318191f956f5b7b2
      8228e607
    • Adam Simpkins's avatar
      make it possible to use folly logging with exceptions disabled · 04b3ad7f
      Adam Simpkins authored
      Summary:
      This updates the logging code so that it is possible to include `folly/xlog.h`
      and write log statements in code that is compiled with `-fno-exceptions`
      
      The code for parsing log configuration strings does still use exceptions in
      some of its config parsing logic.  It shouldn't be too difficult to disable
      that in a subsequent diff, but for now this change at least makes it possible
      for calling code to write log messages.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D21630914
      
      fbshipit-source-id: ce9ed422f40066e57433a85182e1a8fc6d8628db
      04b3ad7f
    • Robin Cheng's avatar
      Fix a minor race condition for ThreadPoolExecutor. · cf7284d0
      Robin Cheng authored
      Summary:
      This fixes a race condition detected by ThreadSanitizer.
      
      The thread list is protected by a mutex, but individual structs in the list are not protected, leading to racy access to two of their fields. This diff makes the fields atomic.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D21484748
      
      fbshipit-source-id: a981419f47a2aebaf1d40b23e9c4967cf2104aaa
      cf7284d0
    • Dan Melnic's avatar
      Remove PollIoBackend inline submit · b412547b
      Dan Melnic authored
      Summary: Remove PollIoBackend inline submit
      
      Reviewed By: danobi
      
      Differential Revision: D21625033
      
      fbshipit-source-id: 02ee55e64a2538c6a2392ea70912f4ae9b642963
      b412547b
    • Lee Howes's avatar
      Add another option to control output formatting of stack traces · 509ab86b
      Lee Howes authored
      Summary:
      The current stack trace formatting is based on repeated string appends with newlines. This change adds more control so that we can produce file and line information only, without unnecessary newlines.
      
      New format:
        ./folly/experimental/symbolizer/Symbolizer.h:77
        ./folly/experimental/symbolizer/test/StackTraceTest.cpp:209
        ./folly/experimental/symbolizer/test/StackTraceTest.cpp:213
        ./folly/experimental/symbolizer/test/StackTraceTest.cpp:258
      
      Reviewed By: yfeldblum
      
      Differential Revision: D21562670
      
      fbshipit-source-id: 7d05605cbda686e2f1c87577647c7ab7581f8580
      509ab86b
    • Kirk Shoop's avatar
      Add ensureCleanupAfterTask · 59a079eb
      Kirk Shoop authored
      Summary:
      adds ensureCleanupAfterTask()
      
      takes a SemiFuture<T> task and a SemiFuture<Unit> cleanup.
      
      returns a SemiFuture<T>
      
      always starts cleanup after task completes. stores the result of the task and replays it after the cleanup completes.
      
      cleanup is not allowed to fail.
      
      Reviewed By: yfeldblum, andriigrynenko
      
      Differential Revision: D21481825
      
      fbshipit-source-id: 901a91c25f7b2b4fa794a590a5433e0fad27d168
      59a079eb
  4. 18 May, 2020 1 commit
  5. 17 May, 2020 1 commit
  6. 15 May, 2020 4 commits
    • Misha Shneerson's avatar
      Add BPF task stats tracepoint to TM and CPU thread pool executor · 2db01ebc
      Misha Shneerson authored
      Summary:
      Allows attaching a BPF script to observe tasks behavior
      
      Sample script, attaching those probes to a test binary (./buck-out/gen/common/services/cpp/test/thrift_2_async_server) is provided.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D21526163
      
      fbshipit-source-id: e976ddada1921c8c904d65aa9a558bbb45bf158f
      2db01ebc
    • Lewis Baker's avatar
      Add CoInvoke() GMock helper for writing safe coroutine lambda versions · 1d98189f
      Lewis Baker authored
      Summary:
      Adds a new CoInvoke() helper function that should be used instead of ::testing::Invoke() when defining mock methods using coroutine lambdas.
      
      Use of Invoke() in a GMock definition that calls a coroutine-lambda that
      contains captures will result in the returned Task holding a dangling reference
      to a copy of the lambda.
      
      The CoInvoke() helper instead, ensures that the coroutine created by the
      lambda holds on to a reference to a copy of the lambda that is kept alive
      until the coroutine completes by invoking the lambda using the folly::coro::co_invoke()
      utility function instead of directly calling operator().
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D21578404
      
      fbshipit-source-id: 3322740efd00596c2311530a166ef2d5301c6b89
      1d98189f
    • Wez Furlong's avatar
      getdeps: upgrade zstd from 1.3.8 -> 1.4.4 · 8cc979ba
      Wez Furlong authored
      Summary:
      I'm doing this mostly so that we can avoid using git
      to fetch the sources.
      
      Reviewed By: chadaustin
      
      Differential Revision: D21508201
      
      fbshipit-source-id: 54d4635d8938659bea962e90bd829d237f1ed221
      8cc979ba
    • Wez Furlong's avatar
      getdeps: windows: avoid expanding drive letter substitutions · 950cdd9b
      Wez Furlong authored
      Summary:
      We use drive letter substitutions to workaround Windows
      filename length limitations.  On my personal Windows system running
      python 3.8.2 realpath inside an ssh session manages to resolve to
      the full filename which causes the boost build to fail.
      
      Avoid that!
      
      Reviewed By: chadaustin
      
      Differential Revision: D21507851
      
      fbshipit-source-id: 1220c1c85d2124ddc51f42cefff2ce00e10c55c9
      950cdd9b
  7. 14 May, 2020 3 commits
    • Yedidya Feldblum's avatar
      Avoid inlining Cursor slow paths · 5b7309d5
      Yedidya Feldblum authored
      Summary: [Folly] Avoid inlining `Cursor` slow paths. These are already extracted to separate functions, but the compiler will still aggressively inline them.
      
      Differential Revision: D21392842
      
      fbshipit-source-id: 2b045ae9c5188315b938de984730ad2051237cf5
      5b7309d5
    • Andrew Huang's avatar
      Give ownership of new session callbacks to SSLContext (v2) · 10eac460
      Andrew Huang authored
      Summary: Giving SSLContext ownership over the new session callback attached to SSL_CTX, so that it may do additional work with the new session (i.e. forward the session to its corresponding abstracted SSLSession).
      
      Reviewed By: mingtaoy
      
      Differential Revision: D21478165
      
      fbshipit-source-id: 459e4b3f9af2fedee4c02df6c9f689db15c1852f
      10eac460
    • Dan Melnic's avatar
      Avoid calling scheduleTimeout for a thread that is mostly busy · d1f8e411
      Dan Melnic authored
      Summary: Avoid calling scheduleTimeout for a thread that is mostly busy
      
      Reviewed By: yfeldblum
      
      Differential Revision: D21531280
      
      fbshipit-source-id: b89254ebc3662c951b3b181b3a2777afb9e3f4fe
      d1f8e411
  8. 13 May, 2020 2 commits
    • Matt Joras's avatar
      Add recvmmsg weak symbol. · ee1e6c7b
      Matt Joras authored
      Summary:
      As it turns out, to use this reliably on Android we need to define a weak symbol. The headers are only exported after API level 21, so apps that compile with 16 cannot use it with a compile time flag.
      
      Instead we can utilize a weak symbol to link with it, and check if it's there at runtime.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D21535034
      
      fbshipit-source-id: 8b68a803d1e9f2f293e9f3efa16fb2a18abee53d
      ee1e6c7b
    • Yedidya Feldblum's avatar
      Explicitly enforce that RequestToken is trivially-destructible · a3e63b14
      Yedidya Feldblum authored
      Summary:
      [Folly] Explicitly enforce that `RequestToken` is trivially-destructible to permit its use as a Meyers Singleton without requiring the use of Leaky Meyers Singleton to avoid destruction-order problems.
      
      (Note: this ignores all push blocking failures!)
      
      Differential Revision: D21533605
      
      fbshipit-source-id: fe334fd5257b1d0a07efd849c4532b28801e54c4
      a3e63b14
  9. 12 May, 2020 3 commits
    • Christopher Wei's avatar
      Add virtual event base interface for getFiberManager · 7c0d945b
      Christopher Wei authored
      Summary: Adds a version of getFiberManager that takes a VirtualEventBase + FrozenOptions
      
      Reviewed By: yfeldblum
      
      Differential Revision: D21507009
      
      fbshipit-source-id: 2bffd1704650b25e78fc388b3e033da4f2c16b9a
      7c0d945b
    • Matt Joras's avatar
      Fix recvmmsg wrapper. · d33c823f
      Matt Joras authored
      Summary: It needs to set the msg_len, otherwise the caller doesn't know how long the datagram is.
      
      Reviewed By: yangchi
      
      Differential Revision: D21512788
      
      fbshipit-source-id: f24c2bd9e86acf93ebf12c48afcf7658c8e8d54e
      d33c823f
    • Dan Melnic's avatar
      Fix sendmmsg wrapper · efb57da2
      Dan Melnic authored
      Summary: Fix sendmmsg wrapper
      
      Reviewed By: yfeldblum
      
      Differential Revision: D21513176
      
      fbshipit-source-id: ddc1bdd93801136994ef62fd5793da7371e9e22a
      efb57da2
  10. 11 May, 2020 3 commits
    • Spencer Baumgardner's avatar
      add support for reference types · fe4c0d46
      Spencer Baumgardner authored
      Summary:
      This diff adds support for reference types to the Async abstraction.
      
      One example use-case is memoization where you generate the value asynchronously on cache-miss. You want may want to return a reference to avoid the expense of copying.
      
      Some additional context is in D21438851.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D21478238
      
      fbshipit-source-id: 53e1b997abed2d40f0a2f9ab935925ad9bbc91ab
      fe4c0d46
    • JiaJie Ye's avatar
      VirtualEventBase is a SequencedExecutor · 0ef1daa2
      JiaJie Ye authored
      Summary:
      VirtualEventBase is backed by a EventBase and byitself is also sequenced, thus shoudl be an SequencedExecutor
      
      (Note: this ignores all push blocking failures!)
      
      Reviewed By: yfeldblum
      
      Differential Revision: D21493098
      
      fbshipit-source-id: 97fd09161117e77422a5786584db89af98dfe314
      0ef1daa2
    • Xavier Deguillard's avatar
      getdeps: add filtering of tests · 7e79b25f
      Xavier Deguillard authored
      Summary:
      For large projects, with lots of tests, running all the tests can take a lot
      of time, but for quick development iteration, only a subset of the tests may
      be needed to run.
      
      On non-Windows platforms, this can be easily achieved by manually executing
      the individual tests binaries and use the builtin filtering mechanism of that
      test binary to achieve the goal. On Windows, this can quickly become
      impossible as DLLs might not be available, and the right PATH would need to
      be manually specified by hand to execute the tests binaries[0].
      
      To solve this, let's simply provide a unified way of running specific tests
      by passing in a regexp. Both testpilot and CTest do support regex to execute
      specific tests. My understanding is that cargo doesn't yet allows regex, but
      will in the future.
      
      [0]: And a missing DLLs would produce no output when executed from
           PowerShell, which makes this very confusing.
      
      Reviewed By: wez
      
      Differential Revision: D21484774
      
      fbshipit-source-id: ee32e950e25bb2a498a2b364a447955a917b0590
      7e79b25f