1. 23 Mar, 2021 1 commit
  2. 21 Mar, 2021 1 commit
    • Yedidya Feldblum's avatar
      Let assume be invocable anytime · 82fce98f
      Yedidya Feldblum authored
      Summary:
      [Folly] Let `assume` be invocable anytime, including before and after `main` and in signal handlers, by switching from `CHECK` to `FOLLY_SAFE_CHECK`.
      
      Requires further minimizing the deps of `FOLLY_SAFE_CHECK`.
      
      Reviewed By: ot, Orvid, luciang
      
      Differential Revision: D6636035
      
      fbshipit-source-id: 026b15ea92ba37acf9b11d714d834b79da80936a
      82fce98f
  3. 19 Mar, 2021 6 commits
    • Kenny Yu's avatar
      gdb: handle missing struct pthread definition when finding async stack traces · e5460d02
      Kenny Yu authored
      Summary:
      Depending on the environment, the type definition for `struct pthread`
      (pthread implementation detail for `pthread_t`) may not be available in gdb.
      If this happens, use a predefined offset for linux x86_64 to find the `specific`
      field inside `struct pthread` that holds the thread-local storage values.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D27112799
      
      fbshipit-source-id: 38c88210c3cd2a6b06918de33167d862f59a676e
      e5460d02
    • Kenny Yu's avatar
      gdb: handle uninitialized folly_async_stack_root_tls_key · dd71878e
      Kenny Yu authored
      Summary:
      This fixes the gdb script to handle folly_async_stack_root_tls_key being uninitialized --
      this means that no async operation has run on this thread previously.
      
      This also catches any errors raised by the `co_bt` command to help with debugging the
      script itself, and to allow `thread apply all co_bt` to process all threads, even
      if one thread has an error.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D27180105
      
      fbshipit-source-id: d6b36bdbc11b94a2f956862fc7651376e1d28af0
      dd71878e
    • Yedidya Feldblum's avatar
      thunk::fail · 8a82e909
      Yedidya Feldblum authored
      Reviewed By: iahs
      
      Differential Revision: D27036059
      
      fbshipit-source-id: 15166a6e7ec58d873a1d6799a3b1eb1ad64de420
      8a82e909
    • Srivatsan Ramesh's avatar
      A new NotificationQueue without read limit for server responses · cc95898a
      Srivatsan Ramesh authored
      Summary: Using a separate queue for server replies without any limit on the number of items read at once.
      
      Differential Revision: D27090888
      
      fbshipit-source-id: 9df44322e63a3f351a6ab4e723ead083a874b705
      cc95898a
    • Yedidya Feldblum's avatar
      copy socketpair for win32 from libevent and tor · ab129b5e
      Yedidya Feldblum authored
      Summary: Rather than conditionally depending on libevent in a way which is causing downstream conflicts.
      
      Reviewed By: Orvid
      
      Differential Revision: D27121200
      
      fbshipit-source-id: 4c4816e7cb2061718f81cd8a75ce4999b5b32042
      ab129b5e
    • Yedidya Feldblum's avatar
      move thunk into its own header · 163f3c3a
      Yedidya Feldblum authored
      Reviewed By: vitaut
      
      Differential Revision: D27036041
      
      fbshipit-source-id: 038b35b9690f17b59425c13c57176ac7dd017ea5
      163f3c3a
  4. 18 Mar, 2021 3 commits
  5. 17 Mar, 2021 3 commits
    • Yedidya Feldblum's avatar
      fix FOLLY_SAFE_CHECK under some gcc versions · 966d3350
      Yedidya Feldblum authored
      Summary: For reasons unknown, some gcc versions disliked the previous code with the constexpr pointer variable, even though most supported compilers and versions accepted it.
      
      Reviewed By: aary, luciang
      
      Differential Revision: D27083528
      
      fbshipit-source-id: b225a3f211a9b51b248cc079cf11e4e25ae30460
      966d3350
    • Aaryaman Sagar's avatar
      Add options to disable gflags to folly::InitOptions · f8c901f5
      Aaryaman Sagar authored
      Summary:
      As title.  CLI applications that don't use gflags might not care about
      process-wide gflags, so add an option to kill it.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D27066900
      
      fbshipit-source-id: d412391879cd5ac89eba5903fd033775cf0ca49a
      f8c901f5
    • Lee Howes's avatar
      Make getGlobalIOExecutor return a KeepAlive<IOExecutor> · 31477657
      Lee Howes authored
      Summary: By returning a generic KeepAlive<> the global IO executor was losing the IOExecutor interface. This fixes it by returning the right type.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D27061083
      
      fbshipit-source-id: d57f67982c3467a6b814b17e851e4513ffd33502
      31477657
  6. 16 Mar, 2021 5 commits
    • Yedidya Feldblum's avatar
      reset_once · 47ed7d6e
      Yedidya Feldblum authored
      Summary: Add `reset_once`, a mechanism to reset a `once_flag`.
      
      Reviewed By: Mizuchi
      
      Differential Revision: D27071246
      
      fbshipit-source-id: 4824782fb0ce6380b72e3e657e6f5073029eaf14
      47ed7d6e
    • Yedidya Feldblum's avatar
      keep_sink · ee776518
      Yedidya Feldblum authored
      Summary: A helper for use with check functions using `FOLLY_KEEP`.
      
      Reviewed By: luciang
      
      Differential Revision: D27072070
      
      fbshipit-source-id: 9c106ca1e0854b0f16453e8ad73d7001c3b7fff6
      ee776518
    • Yedidya Feldblum's avatar
      fix safe-assert test link failures without weak symbols · f4f864ef
      Yedidya Feldblum authored
      Reviewed By: luciang
      
      Differential Revision: D27071414
      
      fbshipit-source-id: 8bbe12e8f8264f2040c030e0353e1e4d59efae55
      f4f864ef
    • Jason Rahman's avatar
      Remove setZeroCopy() override · bda140dc
      Jason Rahman authored
      Summary:
      When folly::AsyncSSLSocket is used in unencrypted mode, zero copy is
      possible due to OpenSSL being bypassed, but the setZeroCopy() override in
      AsyncSSLSocket prevents zero copy from being used. Remove the override (no
      callers currently check the return value anyway).
      
      Reviewed By: yfeldblum, yqz, jalatif
      
      Differential Revision: D27044720
      
      fbshipit-source-id: ec402ad2badb84150ecd1b7639770a49e16e9183
      bda140dc
    • Oleg Osovitskiy's avatar
      Add CoInvokeWithoutArgs googletest helper · eef86a25
      Oleg Osovitskiy authored
      Summary: Add `CoInvokeWithoutArgs` helper, coroutine-aware version of `InvokeWithoutArgs`
      
      Reviewed By: yfeldblum
      
      Differential Revision: D27060013
      
      fbshipit-source-id: 8024a5818fbe7759d3f9827d260c4e7370444bb0
      eef86a25
  7. 15 Mar, 2021 3 commits
    • Yedidya Feldblum's avatar
      deprecate try_and_catch taking explicit types · 29de57bd
      Yedidya Feldblum authored
      Summary: Encourage new uses to use the overload which does not take an explicit list of exception types.
      
      Reviewed By: aary
      
      Differential Revision: D27041702
      
      fbshipit-source-id: aa808bb432c2aea6e2c1cb10d76f2492875bae93
      29de57bd
    • Dan Melnic's avatar
      Fix -Werror,-Wshadow-uncaptured-local errors · 9a474aec
      Dan Melnic authored
      Summary: Fix -Werror,-Wshadow-uncaptured-local errors
      
      Reviewed By: yfeldblum, iahs
      
      Differential Revision: D27052090
      
      fbshipit-source-id: 843bf9374ff16bfe422ef78e889f1c1286335c1a
      9a474aec
    • Yedidya Feldblum's avatar
      revise FOLLY_SAFE_CHECK · b4f7d822
      Yedidya Feldblum authored
      Summary:
      Principally, this change shrink the code generated by `FOLLY_SAFE_CHECK` by:
      * Moving the literal arguments which would be passed to the backing functions into a constexpr data structure and passing only a pointer to that data structure.
      * Passing all the arguments through via C variadic arguments rather than inlining the sequence of calls to handle them into the caller.
      
      Reviewed By: swolchok, luciang
      
      Differential Revision: D26996101
      
      fbshipit-source-id: 61c39c08758a9de28ba0cfd342b174185e80ad9f
      b4f7d822
  8. 14 Mar, 2021 1 commit
    • Yedidya Feldblum's avatar
      let some thunk members take variadic args · 55dfcb03
      Yedidya Feldblum authored
      Summary: In particular, let `make` and `ctor` take variadic arguments since there is no cost.
      
      Reviewed By: iahs
      
      Differential Revision: D27024839
      
      fbshipit-source-id: 805c65fdc79f60af1256a4c36be94bb22c163bdd
      55dfcb03
  9. 13 Mar, 2021 3 commits
    • Yedidya Feldblum's avatar
      thunk::noop<...> · 6329dbd5
      Yedidya Feldblum authored
      Summary: So that downstream locations do not have to write their own noop functions.
      
      Reviewed By: iahs
      
      Differential Revision: D27022664
      
      fbshipit-source-id: e8f69c7babf853a71dedd24ded59c5017cf18ad6
      6329dbd5
    • Yedidya Feldblum's avatar
      expand the erased_unique_ptr facility · b3cbe1d5
      Yedidya Feldblum authored
      Summary:
      The interface:
      
        erased_unique_ptr
        to_erased_unique_ptr
        make_erased_unique
        copy_to_erased_unique_ptr
        empty_erased_unique_ptr
      
      Reviewed By: iahs
      
      Differential Revision: D26980776
      
      fbshipit-source-id: c520993a2191e7f74c5056a4854e2b85731a09a0
      b3cbe1d5
    • Yedidya Feldblum's avatar
      avoid snprintf in Elf code · 63ee5137
      Yedidya Feldblum authored
      Summary: `snprintf` may not be async-signal-safe, but Elf code is intended for use in signal handlers.
      
      Reviewed By: luciang
      
      Differential Revision: D27000080
      
      fbshipit-source-id: 818f48787b5712b7334eca782e18c71c17d03361
      63ee5137
  10. 12 Mar, 2021 6 commits
  11. 11 Mar, 2021 5 commits
    • Roger Kim's avatar
      Replace if-statements with `if constexpr` statements · e741d8ef
      Roger Kim authored
      Summary:
      We have found that BitVectorCoding.h incorrectly outputs
      -Wdivision-by-zero errors when another file that includes it fails to compile.
      In the absence of other compilation errors, the -Wdivision-by-zero error does
      not appear (since the compiler correctly can tell that "division by zero" is
      not an issue in the code).
      
      In order to get rid of these erroneous error logs, we decided to replace the
      if-statements that surround the divisions (and check that the divisor is not
      zero) with `if constexpr` statements since those will stop the compiler from
      mistakenly thinking that division by zero is possible.
      
      Reviewed By: ot, philippv, luciang
      
      Differential Revision: D26961916
      
      fbshipit-source-id: f65ef6d7782c94e58d6d28b9f8b053f205e3b7c1
      e741d8ef
    • Srivatsan Ramesh's avatar
      A new NotificationQueue without read limit for server responses · 28799ed1
      Srivatsan Ramesh authored
      Summary: Using a separate queue for server replies without any limit on the number of items read at once.
      
      Differential Revision: D26612326
      
      fbshipit-source-id: d56c892c87bafa701c12b6da780e9b2d4710ee2c
      28799ed1
    • Giuseppe Ottaviano's avatar
      Make parseTo work with arbitrary string types · db94b222
      Giuseppe Ottaviano authored
      Summary: `to<T>` already works in simple cases when `IsSomeString<T>`; by generalizing `parseTo` any string-like `T` gets full functionality without having to copy-paste the overload.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D26831450
      
      fbshipit-source-id: c09629bb7173dde1e0986654128b8e1d7c48b9ba
      db94b222
    • Brandon Schlinker's avatar
      Stop relying on net_tstamp.h in AsyncSocket · e9d7342e
      Brandon Schlinker authored
      Summary:
      `net_tstamp.h` is incomplete on some platforms, particularly OSS.
      
      One option would be to make `FOLLY_HAVE_SO_TIMESTAMPING` conditional on all of the timestamp flags being present. However, I'm instead going to just decouple this support from the underlying platform's headers.
      
      Reviewed By: rsunkad
      
      Differential Revision: D26971541
      
      fbshipit-source-id: 01b24f57ab827aca42889138e4cca4d488ae0940
      e9d7342e
    • Lee Howes's avatar
      Remove default argument for SerialExecutor::createUnique · df81d76c
      Lee Howes authored
      Summary: Remove the default argument for the deprecated createUnique operation for SerialExecutor.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D26916321
      
      fbshipit-source-id: e6fb1766bfaae4d6e702982c5527d483e6d8c036
      df81d76c
  12. 10 Mar, 2021 3 commits
    • Yedidya Feldblum's avatar
      fix to_ascii under 32-bit msvc builds · 14c99ce6
      Yedidya Feldblum authored
      Summary:
      Under gcc and clang, we use the intrinsic `__builtin_clzll`. This builtin is available regardless of whether the `clz` instruction is available on the target platform - when it is, the backend chooses it; when it is not, the backend emits emulation code.
      
      Under msvc, the builtin is `__lzcnt64`. However, this builtin is available only in x64 builds; there is no fallback to emulation code, and 32-bit builds fail to compile.
      
      Differential Revision: D26918251
      
      fbshipit-source-id: a4d9c199f632c5a210bd6fd8782d327f7aac774e
      14c99ce6
    • Jason Fried's avatar
      get_running_executor a modern alternative · 749f7a4b
      Jason Fried authored
      Summary:
      In the long term I want to force all usage of get_executor to require that the call comes from a running asyncio eventloop as its safer/saner than allowing the default un-running loop to be used since it may never actually run.  Until then I have created get_running_executor that I can use in various places. When get_running_executor(True) is used everywhere we can codemod it back to get_executor() and have asyncio.get_running_loop() used exclusively.
      
      A folly::IOBuf can be built around a Python Buffer.  It supports three ways to ask python to cleanup that buffer.
      
      1. If it has the GIL just decref the buffer
      2. else if it has a Python Executor it can schedule the cleanup
      3. it can rely on some cPython magic called "Py_AddPendingCall"
      
      thrift-py3 deserialize wraps a python buffer in a IOBuf, but since ownership is not handed off to C++ it has the GIL when we destroy the IOBUF so it doesn't need an Executor.
      
      IOBuf calls folly.executor.get_executor() which will create a AsyncioExecutor and bind it to the default eventloop.
      
      So using deserialize right before a python fork, would cause a ABORT in the child since the AsyncioExecutor would try to drive() itself during its destruction.
      
      The asyncio default eventloop is considered a bad thing, new interfaces like asyncio.run() does not rely on a default loop but creating its own.
      To insure we only ever use the eventloop from a running loop, use get_running_loop.
      
      Reviewed By: sdunster
      
      Differential Revision: D26794162
      
      fbshipit-source-id: 8e7e53c453c9ccff7e81f02e0692c8bebad70edd
      749f7a4b
    • Zhengxu Chen's avatar
      Make XLOG_EVENT_MS capture variables inside expanded lambda. · 7d413635
      Zhengxu Chen authored
      Summary:
      Just capture ms value for XLOG_EVERY_MS since it's executed inline.
      
      The use case here is we need to pass a non constant value as the milliseconds param, e.g:
      ```
      XLOG_EVERY_MS(INFO, configValue) << msg;
      ```
      
      Reviewed By: yfeldblum, simpkins
      
      Differential Revision: D26746623
      
      fbshipit-source-id: 849ad9a20ff4088ffb5a2df99c9c424592b47867
      7d413635