1. 13 Feb, 2020 1 commit
    • Andrii Grynenko's avatar
      Make client process all buffered reads on write failure · 1329c39b
      Andrii Grynenko authored
      Summary: When connection is reset by server it's possible for a write to fail before the read callback is called. Make sure we still try to process all the data that was received before closing the socket.
      
      Reviewed By: rhodo
      
      Differential Revision: D19851139
      
      fbshipit-source-id: af50b939ccd7f25384e48bcf29b4892a23c2ef83
      1329c39b
  2. 12 Feb, 2020 4 commits
    • Joseph Wu's avatar
      Fix missing re2 dep in opensource · f3957689
      Joseph Wu authored
      Summary: platform_mapping library needs RE2 lib.
      
      Reviewed By: shri-khare
      
      Differential Revision: D19838529
      
      fbshipit-source-id: 71a2c06437ce05a42396a2867ddadb029e36926e
      f3957689
    • Dan Melnic's avatar
      Remove trivial-copyability req from LockFreeRingBuffer · bcaf9cdf
      Dan Melnic authored
      Summary: [Folly] Remove trivial-copyability requirement from `LockFreeRingBuffer` since we can rely on the compiler to optimize copy operations over types which are trivially-copyable without our code having to specify `memcpy`.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D19844612
      
      fbshipit-source-id: 4770e46ac8c63fa68b68598fb5012cb58896f550
      bcaf9cdf
    • Yedidya Feldblum's avatar
      Use SingletonThreadLocal for the current fiber manager · 7ce27feb
      Yedidya Feldblum authored
      Summary: [Folly] Use SingletonThreadLocal for the current fiber manager, which does not depend on whether `__thread` or `thread_local` is available.
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D19229511
      
      fbshipit-source-id: a92016aca89205c2842dc4f71054b1b6306b14b9
      7ce27feb
    • Yedidya Feldblum's avatar
      Prefer invoke_result_t in DistributedMutex · 5bdf434f
      Yedidya Feldblum authored
      Summary: [Folly] Prefer `invoke_result_t` in `DistributedMutex` over the underlying `decltype` and `declval` implementation.
      
      Reviewed By: aary
      
      Differential Revision: D19321643
      
      fbshipit-source-id: 323a0fce49447d2f009ad3bc61e285de3f311ff1
      5bdf434f
  3. 11 Feb, 2020 4 commits
    • Yedidya Feldblum's avatar
      Use invocability helper variables · 59e20c74
      Yedidya Feldblum authored
      Summary: [Folly] Use invocability helper variables in preference to types.
      
      Reviewed By: aary
      
      Differential Revision: D18748026
      
      fbshipit-source-id: e7a76c1238360c55dd6d41c53f763e9df4069acb
      59e20c74
    • Ming Yi Teo's avatar
      Enable -Wshorten-64-to-32 in wangle · 0ea41166
      Ming Yi Teo authored
      Summary:
      1. Add `"-Wshorten-64-to-32"` to `_extra_clang_flags`
      2. Fix warnings generated from `buck build --keep-going wangle/...`
      
      Reviewed By: chadaustin
      
      Differential Revision: D19647345
      
      fbshipit-source-id: 417840fe82ed3d5c9c2d989a0acf67e12758c1f9
      0ea41166
    • Christoph Purrer's avatar
      Fix <folly/portability/Windows.h> on Windows SDK 1903 / 10.0.18362.0 · ed9408bf
      Christoph Purrer authored
      Summary:
      Folly does not compile with Windows SDK 1903. The issues is in folly/portability/Windows.h and surfaces when compiling files including it, e.g.: xplat/folly.portability/Stdlib.cpp
      ```
      xplat\folly/portability/SysStat.h:47:5: error: conflicting types for 'mkdir'
      int mkdir(const char* fn, int mode);
          ^
      C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\direct.h:111:26: note: previous declaration is here
          _ACRTIMP int __cdecl mkdir(
                               ^
      xplat\folly\portability\Stdlib.cpp:47:11: error: no matching function for call to 'mkdir'
          ret = mkdir(ptr, 0700);
                ^~~~~
      C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\direct.h:111:26: note: candidate function not viable:
            requires single argument '_Path', but 2 arguments were provided
          _ACRTIMP int __cdecl mkdir(
                               ^
      2 errors generated.
      ```
      Now internal Windows functions collide with folly portability ones defined in https://github.com/facebook/folly/blob/master/folly/portability/Unistd.h#L61-L93
      
      C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\direct.h defines a Windows ```mkdir``` function when
      ```
      #if defined(_CRT_INTERNAL_NONSTDC_NAMES) && _CRT_INTERNAL_NONSTDC_NAMES
      //...
          _Check_return_ _CRT_NONSTDC_DEPRECATE(_mkdir)
          _ACRTIMP int __cdecl mkdir(
              _In_z_ char const* _Path
              );
      
          _Check_return_ _CRT_NONSTDC_DEPRECATE(_rmdir)
          _ACRTIMP int __cdecl rmdir(
              _In_z_ char const* _Path
              );
      
      #endif // _CRT_INTERNAL_NONSTDC_NAMES
      ```
      
      When diffing the current Windows SDK 1903 version: C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\corecrt.h
      with a previous one, e.g.: 1809 C:\tools\toolchains\vs2017_15.9\WindowsSdk\Include\10.0.17763.0\ucrt\corecrt.h
      we see a fundamental change:
      
      ## SDK 1903
      ```
      #if ( defined _CRT_DECLARE_NONSTDC_NAMES && _CRT_DECLARE_NONSTDC_NAMES) || \
          (!defined _CRT_DECLARE_NONSTDC_NAMES && !__STDC__                 )
          #define _CRT_INTERNAL_NONSTDC_NAMES 1
      #else
          #define _CRT_INTERNAL_NONSTDC_NAMES 0
      #endif
      ```
      
      ## SDK 1809
      ```
      #define _CRT_INTERNAL_NONSTDC_NAMES                                            \
          (                                                                          \
              ( defined _CRT_DECLARE_NONSTDC_NAMES && _CRT_DECLARE_NONSTDC_NAMES) || \
              (!defined _CRT_DECLARE_NONSTDC_NAMES && !__STDC__                 )    \
          )
      ```
      
      Reviewed By: Orvid
      
      Differential Revision: D19804183
      
      fbshipit-source-id: cbbe32c611a3c011175145329c29de4a9597868c
      ed9408bf
    • Yedidya Feldblum's avatar
      Adjust allocator ctors · 5ee564ba
      Yedidya Feldblum authored
      Summary:
      [Folly] Adjust allocator ctors.
      
      * Add missing family ctor to `SysAllocator` to bring it into better alignment with generic C++ allocator expectations.
      * Make other family ctors implicit.
      * Ensure that the actual copy ctors take precedence.
      * Hide copy assignment operators.
      
      Reviewed By: marksantaniello
      
      Differential Revision: D19817836
      
      fbshipit-source-id: de90fdd7cae36ac178a89556e63a29f4014532a1
      5ee564ba
  4. 10 Feb, 2020 8 commits
    • Shai Szulanski's avatar
      Add coro::AsyncPipe · 552c07c3
      Shai Szulanski authored
      Summary: we've seen people using `apache::thrift::Stream` as a heavyweight way to produce this functionality. As we move to delete that we want to provide an alternative using `AsyncGenerator`.
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D19774841
      
      fbshipit-source-id: 5ebaa0afcb08f04d7fb899b34ac7dc0270186852
      552c07c3
    • Shai Szulanski's avatar
      Add coro::UnboundedQueue · 5000a12b
      Shai Szulanski authored
      Summary: we've seen people using `apache::thrift::Stream` as a heavyweight way to produce this functionality. As we move to delete that we want to provide an alternative using `AsyncGenerator`.
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D19726875
      
      fbshipit-source-id: 047e1db4b429883a69af9819e0c6ad04022ef91f
      5000a12b
    • Matt Ma's avatar
      Support debug_ranges lookup when matching address for inline functions. · 416bc6ef
      Matt Ma authored
      Summary:
      Range lists are contained in a separate object file section called .debug_ranges. A range list is
      indicated by a DW_AT_ranges attribute whose value is represented as an offset from the
      beginning of the .debug_ranges section to the beginning of the range list.
      Each entry in a range list is either:
      a range list entry,
      a base address selection entry, or
      an end of list entry.
      
      Reviewed By: luciang
      
      Differential Revision: D19658819
      
      fbshipit-source-id: ed70915465f0ac6bb8ab6f7efe415a3d8c5b04ee
      416bc6ef
    • Matt Ma's avatar
      Get the correct file name for inline functions. · 4c872d1c
      Matt Ma authored
      Summary:
      Here is an example for class inline member function declared and defined in the same file:
      
      ```
      Definition:
      0x00004c0a:           DW_TAG_subprogram [55] *
                              DW_AT_linkage_name [DW_FORM_strp] ( .debug_str[0x00177124] = "_ZNK5folly10symbolizer4test24ClassWithInlineFunctions9inlineBarERNS0_10FrameArrayILm100EEE")
                              DW_AT_name [DW_FORM_strp] ( .debug_str[0x00089a73] = "inlineBar")
                              DW_AT_decl_file [DW_FORM_data1] (0x1a)
                              DW_AT_decl_line [DW_FORM_data1] (0xa5)
                              DW_AT_declaration [DW_FORM_flag_present]  (true)
                              DW_AT_external [DW_FORM_flag_present] (true)
                              DW_AT_accessibility [DW_FORM_data1] (0x01)
      …
      
      Declaration:   -- no DW_AT_decl_file
      0x000164c1:   DW_TAG_subprogram [228] *
                      DW_AT_specification [DW_FORM_ref4]  (cu + 0x48ea => {0x00004c0a})
                      DW_AT_inline [DW_FORM_data1]  (0x01)
                      DW_AT_object_pointer [DW_FORM_ref4] (cu + 0x161ac => {0x000164cc})
      
      …
      
      Inline function call
      0x0001657b:     DW_TAG_inlined_subroutine [140] *
                        DW_AT_abstract_origin [DW_FORM_ref4]  (cu + 0x161a1 => {0x000164c1})
                        DW_AT_low_pc [DW_FORM_addr] (0x000000000040fa6e)
                        DW_AT_high_pc [DW_FORM_data4] (0x00000055)
                        DW_AT_call_file [DW_FORM_data1] (0x1a)
                        DW_AT_call_line [DW_FORM_data1] (0xe2)
      ```
      
      Here is an example for class inline member function declared and defined in different files:
      
      ```
      Definition:  DW_AT_decl_file: 0x01  --> SymbolizerTestUtils.h
      0x00004c3d:           DW_TAG_subprogram [55] *
                              DW_AT_linkage_name [DW_FORM_strp] ( .debug_str[0x0017717f] = "_ZNK5folly10symbolizer4test22InlineFunctionsWrapper9inlineBarERNS0_10FrameArrayILm100EEE")
                              DW_AT_name [DW_FORM_strp] ( .debug_str[0x00089a73] = "inlineBar")
                              DW_AT_decl_file [DW_FORM_data1] (0x01)
                              DW_AT_decl_line [DW_FORM_data1] (0x30)
                              DW_AT_declaration [DW_FORM_flag_present]  (true)
                              DW_AT_external [DW_FORM_flag_present] (true)
                              DW_AT_accessibility [DW_FORM_data1] (0x01)
      
      …
      
      Declaration:   DW_AT_decl_file: 0xbf  --> SymbolizerTestUtils-inl.h
      0x00017ee8:   DW_TAG_subprogram [231] *
                      DW_AT_decl_file [DW_FORM_data1] (0xbf)
                      DW_AT_decl_line [DW_FORM_data1] (0x21)
                      DW_AT_specification [DW_FORM_ref4]  (cu + 0x491d => {0x00004c3d})
                      DW_AT_inline [DW_FORM_data1]  (0x01)
                      DW_AT_object_pointer [DW_FORM_ref4] (cu + 0x17bd5 => {0x00017ef5})
      
      …
      
      Inline function call
      0x00017fa5:     DW_TAG_inlined_subroutine [158] *
                        DW_AT_abstract_origin [DW_FORM_ref4]  (cu + 0x17bc8 => {0x00017ee8})
                        DW_AT_low_pc [DW_FORM_addr] (0x00000000004104ee)
                        DW_AT_high_pc [DW_FORM_data4] (0x00000055)
                        DW_AT_call_file [DW_FORM_data1] (0x1a)
                        DW_AT_call_line [DW_FORM_data2] (0x0101)
      ```
      
      Reviewed By: luciang
      
      Differential Revision: D19658560
      
      fbshipit-source-id: 78c1e42d76c19f09e4632c40e0df18bfb49479f9
      4c872d1c
    • Matt Ma's avatar
      Prefer linkage name to name for inline function frames. · 5f30664e
      Matt Ma authored
      Summary: Linkage name (DW_AT_linkage_name) contains more information than the identifier name (DW_AT_name).
      
      Reviewed By: luciang
      
      Differential Revision: D19657767
      
      fbshipit-source-id: 87b2293e6f723ceb8b5202db0f3c569c37c6c7ea
      5f30664e
    • Matt Ma's avatar
      Support inline class member functions in stack trace. · 1fbc7066
      Matt Ma authored
      Summary:
      Actually class inline functions exist in both .debug_info and .debug_types sections. In this diff, only the information in .debug_info is used.
      
      Step 1. Find the DW_TAG_inlined_subroutine debug info entry (DIE) based on the given address.
      Step 2. Find the DW_TAG_subprogram DIE based on the DW_AT_abstract_origin attr in inlined_subroutine, but this DIE is just a declaration.
      Step 3. Find the actual definition DW_TAG_subprogram DIE based on the DW_AT_specification attr.
      
      ```
      .debug_info
      
      0x00003657:           DW_TAG_subprogram [56] *   ---- step 3
                              DW_AT_linkage_name [DW_FORM_strp] ( .debug_str[0x0002932d] = "_ZN5folly10symbolizer4test24ClassWithInlineFunctions9inlineBarERNS0_10FrameArrayILm100EEE")
                              DW_AT_name [DW_FORM_strp] ( .debug_str[0x00014064] = "inlineBar")
                              DW_AT_decl_file [DW_FORM_data1] (0x18)
                              DW_AT_decl_line [DW_FORM_data1] (0xa1)
                              DW_AT_declaration [DW_FORM_flag_present]  (true)
                              DW_AT_external [DW_FORM_flag_present] (true)
                              DW_AT_accessibility [DW_FORM_data1] (0x01)
      
      …
      
      0x0000cd74:   DW_TAG_subprogram [203] * .   ---- step 2
                      DW_AT_specification [DW_FORM_ref4]  (cu + 0x358f => {0x00003657})
                      DW_AT_inline [DW_FORM_data1]  (0x01)
                      DW_AT_object_pointer [DW_FORM_ref4] (cu + 0xccb7 => {0x0000cd7f})
      
      …
      0x0000cda0:   DW_TAG_subprogram [181] *
                      DW_AT_low_pc [DW_FORM_addr] (0x00000000002a4980)
                      DW_AT_high_pc [DW_FORM_data4] (0x00001e22)
                      DW_AT_frame_base [DW_FORM_exprloc]  (<0x1> 56 )
                      DW_AT_object_pointer [DW_FORM_ref4] (cu + 0xccf0 => {0x0000cdb8})
                      DW_AT_specification [DW_FORM_ref4]  (cu + 0x312f => {0x000031f7})
      
      …
      
      0x0000ce02:     DW_TAG_inlined_subroutine [157] *               ---- step 1
                        DW_AT_abstract_origin [DW_FORM_ref4]  (cu + 0xccac => {0x0000cd74})
                        DW_AT_low_pc [DW_FORM_addr] (0x00000000002a4f66)
                        DW_AT_high_pc [DW_FORM_data4] (0x000000c0)
                        DW_AT_call_file [DW_FORM_data1] (0x18)
                        DW_AT_call_line [DW_FORM_data1] (0xe6)
      
      .debug_types
      
      0x00020fdf:         DW_TAG_class_type [33] *
                            DW_AT_calling_convention [DW_FORM_data1]  (0x05)
                            DW_AT_name [DW_FORM_strp] ( .debug_str[0x00067094] = "ClassWithInlineFunctions")
                            DW_AT_byte_size [DW_FORM_data1] (0x08)
                            DW_AT_decl_file [DW_FORM_data1] (0x18)
                            DW_AT_decl_line [DW_FORM_data1] (0x9f)
      
      …
      
      0x00020ff5:           DW_TAG_subprogram [56] *
                              DW_AT_linkage_name [DW_FORM_strp] ( .debug_str[0x0002932d] = "_ZN5folly10symbolizer4test24ClassWithInlineFunctions9inlineBarERNS0_10FrameArrayILm100EEE")
                              DW_AT_name [DW_FORM_strp] ( .debug_str[0x00014064] = "inlineBar")
                              DW_AT_decl_file [DW_FORM_data1] (0x18)
                              DW_AT_decl_line [DW_FORM_data1] (0xa1)
                              DW_AT_declaration [DW_FORM_flag_present]  (true)
                              DW_AT_external [DW_FORM_flag_present] (true)
                              DW_AT_accessibility [DW_FORM_data1] (0x01)
      
      ```
      
      Reviewed By: luciang
      
      Differential Revision: D19644033
      
      fbshipit-source-id: fa5d6dc46dbb1a417b40c1d06d9eaf9178661d21
      1fbc7066
    • Yedidya Feldblum's avatar
      Revise SignalSafeElfCache to allocate with mmap · 88cc7c93
      Yedidya Feldblum authored
      Summary:
      [Folly] Revise `SignalSafeElfCache` to use `mmap` for dynamic allocation and not to require static preallocation.
      
      While, technically, `mmap` is not documented to be async-signal-safe, in practice it is so at least on Linux. Take advantage.
      
      Prior to this change, the `SignalSafeElfCache` with all of its storage would have to be preallocated before setting the signal handler and must not be destroyed ever. Prior to this change, the preallocation would require at least `sizeof(Path) * capacity`, which defaults to ~2MB.
      
      It is now possible to use stack-allocated SignalSafeElfCache in signal handlers.
      
      This change adds a multi-thread-safe and async-signal-safe `mmap`-based allocator. Details as follows:
      * All allocations are rounded up to the nearest power of two in size and alignment.
      * Page or larger allocations are handled directly by `mmap` and free by `munmap` and are not tracked.
      * Smaller allocations are handled by an `mmap`-backed refcounted arena. Arena sections are 16 pages in size; they are allocated on demand; and they are linked together to allow for `munmap` when the allocator refcounted arena is destroyed.
      
      Reviewed By: davidtgoldblatt
      
      Differential Revision: D18760282
      
      fbshipit-source-id: 56a34abfe39a7108f790537afeda832fd39714d7
      88cc7c93
    • Yedidya Feldblum's avatar
      Put the current fiber manager behind an accessor · 09446426
      Yedidya Feldblum authored
      Summary: [Folly] Put the current fiber manager behind an accessor function v.s. having it as a static class member.
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D19229507
      
      fbshipit-source-id: 7cf4eab00ee281bc6104f994a71f5e48d9553852
      09446426
  5. 08 Feb, 2020 2 commits
    • Orvid King's avatar
      Mark a couple of move assignment operators as noexcept · ac05b70a
      Orvid King authored
      Summary: MSVC informed me that these classes had noexcept move constructors but the move assignment operators were not marked as noexecpt.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D19796949
      
      fbshipit-source-id: d2bdc8ebb6d77709e367a4137fb0817c8006084f
      ac05b70a
    • Andrii Grynenko's avatar
      Remove unnecesary loop breaks from EventBase · 070c3b78
      Andrii Grynenko authored
      Summary: This logic makes it impossible to reason about order between io events, internal and external events. The comment also seems outdated.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D19785249
      
      fbshipit-source-id: 62eee5427a3c47cccba6cb33c2ca88af82767bed
      070c3b78
  6. 07 Feb, 2020 4 commits
    • Eric Niebler's avatar
      Properly constrain the Future(T2&&) constructor · 0eb09b75
      Eric Niebler authored
      Summary:
      The `Future(T2&&)` constructor is currently constrained to disallow other `Future` and `SemiFuture` types, but it allows types which will cause a hard error when instantiating the body of the constructor. The constructor argument is later used to initialize a `Try<T>`, so the function should properly be constrained with `std::is_constructible<Try<T>, T2>::value`.
      
      Also, add the same constraint to the `SemiFuture(T2&&)` constructor, and to the `FutureBase(T2&&)` constructor for good measure.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D19782313
      
      fbshipit-source-id: 5e1ef5425b0c7ab9cc76c998425e90d0ba0b148f
      0eb09b75
    • Jason Flinn's avatar
      writeFileAtomic optionally syncs to provide durable atomicity · a14c8b75
      Jason Flinn authored
      Summary:
      The current implementation does not guarantee atomicity on power
      failure or OS crash.  For instance, if a crash happens after writing
      the directory to storage but before writing the file data to storage,
      then a zero-byte file can result.
      
      Provide an optional parameter to sync and provide atomicity in these
      situations.
      
      Adjust comments to reflect the actual guarantees provided.
      
      Differential Revision: D19754974
      
      fbshipit-source-id: 5ddb2f3a1b9e72b523ee13937f648e0913c94c2f
      a14c8b75
    • Yedidya Feldblum's avatar
      Use atomic operations on TLS SharedMutex static data · 93232f95
      Yedidya Feldblum authored
      Summary:
      [Folly] Use atomic operations on maybe-TLS `SharedMutex` static data  via `atomic_ref`. The fields are thread-local on platforms which support thread-local fields, but global otherwise.
      
      When thread-local is supported, relaxed loads and stores should ordinarily have the same overhead as non-atomic loads and stores on most platforms. When thread-local is not supported and these fields are global, the concurrent atomic loads and stores will change to become defined behavior.
      
      Differential Revision: D19688867
      
      fbshipit-source-id: 51873e12924ecff9d971316658fe71e2de18bdec
      93232f95
    • Xavier Deguillard's avatar
      use third-party vendored Rust crates · 0a24425a
      Xavier Deguillard authored
      Summary:
      Instead of fetching a tarball for the vendored Rust crates, let's just use
      what's present in third-party/rust.
      
      Reviewed By: wez, fanzeyi
      
      Differential Revision: D19770580
      
      fbshipit-source-id: ca6615a5f5c672d9a5527ad47feab6bdd33a39db
      0a24425a
  7. 06 Feb, 2020 3 commits
    • Yedidya Feldblum's avatar
      Cut StaticMetaBase noreturn dtor · 4f6a2d4e
      Yedidya Feldblum authored
      Summary: [Folly] Cut `StaticMetaBase` `[[noreturn]]` dtor, since MSVC C4722 flags it.
      
      Reviewed By: filipecalasans
      
      Differential Revision: D19738476
      
      fbshipit-source-id: d697aad1194b76e7c371aa9a34ea50cb793b5c32
      4f6a2d4e
    • Lukas Piatkowski's avatar
      mononoke: remove the getdeps manifest · 72f4c754
      Lukas Piatkowski authored
      Summary: Mononoke is becoming part of Eden repository, remove it's getdeps manifest until we finalize the move.
      
      Reviewed By: krallin
      
      Differential Revision: D19769090
      
      fbshipit-source-id: 9b471686728e9ff28317f9157f5f8a1834c5f5e4
      72f4c754
    • Misha Shneerson's avatar
      snapshot rootID at the same time as we snapshot callstacks · c0f5b564
      Misha Shneerson authored
      Summary:
      D19417574 added support for snapshotting stack traces for threads our requests are running on. The problem with this approach was that we are racing - stack trace may be recorded AFTER requests has already left the thread. Hence we might be presenting incorrect and confusing picture to the users.
      
      Here we make sure that request root id and stack trace are recorded together, and there is no race.
      
      Because we are using interrupts to get on the thread, sometimes we might not be able to record the information using this approach. We then fallback to the previous way of associating threads and requests (by walking TLS entries).
      
      (Note: this ignores all push blocking failures!)
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D19445100
      
      fbshipit-source-id: 4311f4e521a48852bf99aede03814de0941c7814
      c0f5b564
  8. 05 Feb, 2020 2 commits
    • Yedidya Feldblum's avatar
      Fix gcc-specific problem in reentrant_allocator test · 00647a8d
      Yedidya Feldblum authored
      Summary:
      [Folly] Fix gcc-specific problem in `reentrant_allocator` test.
      
      ```
      folly/memory/test/ReentrantAllocatorTest.cpp: In member function ‘virtual void ReentrantAllocatorTest_large_Test::TestBody()’:
      folly/folly/memory/test/ReentrantAllocatorTest.cpp:68:22: error: no matching function for call to ‘std::vector<ReentrantAllocatorTest_large_Test::TestBody()::type, folly::reentrant_allocator<ReentrantAllocatorTest_large_Test::TestBody()::type> >::push_back(<brace-enclosed initializer list>)’
           vec.push_back(type{i});
                            ^
      ```
      
      Differential Revision: D19738608
      
      fbshipit-source-id: bbffd1f47749be1aa88bb45bddc401ffca48c4ca
      00647a8d
    • Rosen Penev's avatar
      std::move improvements · 5d4b1cac
      Rosen Penev authored
      Summary: Pull Request resolved: https://github.com/facebook/folly/pull/1298
      
      Reviewed By: igorsugak
      
      Differential Revision: D19281240
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: 3bf437d49aa85b40923ff1ad93ba62fa97b726af
      5d4b1cac
  9. 04 Feb, 2020 1 commit
  10. 03 Feb, 2020 2 commits
    • Mark Williams's avatar
      Fix std::move warning in folly/gen · d5d8571e
      Mark Williams authored
      Summary:
      The std::move prevents copy elision (NRVO), and gcc9 is warning about
      it. Every compiler we use will do NRVO here, and in c++17 and later
      the compiler is required to use the move constructor if it (for
      whatever reason) fails to elide the copy.
      
      Reviewed By: ot
      
      Differential Revision: D19698783
      
      fbshipit-source-id: 589556a0a88da0d84c607c9894399201dd7d6ae8
      d5d8571e
    • Chris Keeline's avatar
      Allow setting fiber local type through FiberManagerMap · 78486d6a
      Chris Keeline authored
      Summary:
      Using FiberManagerMap is a prerequisite for the gdb extension, but
      previously it didn't support using a non-void local type. One option is to
      make GlobalCache<EventBaseT, LocalT>, I ended up sharing the cache across local
      types to avoid changing much in the gdb side.
      
      The gdb extension is already updated to handle the namespace change.
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D19422428
      
      fbshipit-source-id: 26cb385791a9503906fc69d91039bfa93837b6db
      78486d6a
  11. 01 Feb, 2020 2 commits
    • Andrew Krieger's avatar
      Use extended alignment safe allocator in CPUThreadPoolExecutor · d8b4f2ff
      Andrew Krieger authored
      Summary:
      Until C++17 types with extended alignment need special handling
      in eg. std::vector and also std::unique_ptr. CPUThreadPoolExecutor has a
      default queue that requires extended alignment, but also allows the user
      to provide their own blocking queue. To handle this we move the private
      member to a shared_ptr which supported type erased destructors, and then
      use allocate_shared for the default queue type with a custom allocator
      that will satisfy alignment constraints.
      
      ```
      .../unique_ptr.h:825:34: runtime error: constructor call on misaligned address 0x613000000040 for type 'folly::UnboundedBlockingQueue<folly::CPUThreadPoolExecutor::CPUTask>', which requires 128 byte alignment
      0x613000000040: note: pointer points here
       02 00 00 1c  be be be be be be be be  be be be be be be be be  be be be be be be be be  be be be be
                    ^
          #0 0x75b35e in std::_MakeUniq<folly::UnboundedBlockingQueue<folly::CPUThreadPoolExecutor::CPUTask> >::__single_object std::make_unique<folly::UnboundedBlockingQueue<folly::CPUThreadPoolExecutor::CPUTask> >() .../unique_ptr.h:825:30
          #1 0x75602f in folly::CPUThreadPoolExecutor::CPUThreadPoolExecutor(unsigned long, std::shared_ptr<folly::ThreadFactory>) xplat/folly/executors/CPUThreadPoolExecutor.cpp:66:18
          #2 0x756c6c in folly::CPUThreadPoolExecutor::CPUThreadPoolExecutor(unsigned long) xplat/folly/executors/CPUThreadPoolExecutor.cpp:84:7
      ```
      
      Differential Revision: D19669832
      
      fbshipit-source-id: 7fb60a06dbb6a04edddb6b619af7a8cef4995fd2
      d8b4f2ff
    • Adam Simpkins's avatar
      fix the CMake build · 5adba359
      Adam Simpkins authored
      Summary:
      D19222635 added a `ReentrantAllocatorTest.cpp` test file but in the
      CMakeLists.txt file it listed `MmapAllocatorTest.cpp` instead.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D19650216
      
      fbshipit-source-id: 794ced255de6781a05da7114eb7f8b3258f90a8c
      5adba359
  12. 31 Jan, 2020 7 commits
    • Mingtao Yang's avatar
      ssl: Fix SSLContext initialization test relying on undefined behavior · 3cdc99f2
      Mingtao Yang authored
      Summary:
      The context initialization test was testing undefined behavior by asserting that
      OpenSSL will return 0 (and consequently, result in SSLContext throwing) after
      a SSL_CTX is freed. That is to say, it is exercising control flow based on
      memory that is already freed.
      
      This diff alters the logic to detect an SSL_CTX free via EX_DATA.
      
      Reviewed By: igorsugak
      
      Differential Revision: D19306728
      
      fbshipit-source-id: cc3a94dbb0b2ab614fa72b099c585467b7156613
      3cdc99f2
    • Igor Sugak's avatar
      fix MSAN errors in InlineFunctionRefTest · 10067433
      Igor Sugak authored
      Reviewed By: aary
      
      Differential Revision: D19403185
      
      fbshipit-source-id: 02ebbda5b9500413920d7225b6fbe29cf5d73237
      10067433
    • Lee Howes's avatar
      Add heap-allocating version of getStackTrace · dea72424
      Lee Howes authored
      Summary: In stack-constrained environments, primarily fibers, the context state allocated by getStackTrace can be problematic. getStackTraceHeap gives the opposite guarantee from getStackTraceSafe - there is no significant stack allocation and we explicitly heap allocate instead.
      
      Reviewed By: terrelln
      
      Differential Revision: D19575634
      
      fbshipit-source-id: 2ec86eccec55d1044bd2532324c648c791df5a07
      dea72424
    • Jasmeet Bagga's avatar
      Fix spelling · 72c71129
      Jasmeet Bagga authored
      Summary: s/assiciated/associated
      
      Reviewed By: ericniebler
      
      Differential Revision: D19645433
      
      fbshipit-source-id: 844f3f782a083030dbab5b8196c98fb562f0f7de
      72c71129
    • Spencer Baumgardner's avatar
      add common interface for loop controllers with publicly accessible executor · e50c78af
      Spencer Baumgardner authored
      Summary: add common interface for loop controllers with publicly accessible executor
      
      Reviewed By: A5he
      
      Differential Revision: D19626108
      
      fbshipit-source-id: 07884726d7fce273dd56bdcf454be70051a4f62b
      e50c78af
    • Yedidya Feldblum's avatar
      Fix gcc-specific problem in reentrant_allocator test · 97c2cdd4
      Yedidya Feldblum authored
      Summary:
      [Folly] Fix gcc-specific problem in `reentrant_allocator` test.
      
      ```
      folly/memory/test/ReentrantAllocatorTest.cpp: In member function ‘virtual void ReentrantAllocatorTest_large_Test::TestBody()’:
      folly/folly/memory/test/ReentrantAllocatorTest.cpp:68:22: error: no matching function for call to ‘std::vector<ReentrantAllocatorTest_large_Test::TestBody()::type, folly::reentrant_allocator<ReentrantAllocatorTest_large_Test::TestBody()::type> >::push_back(<brace-enclosed initializer list>)’
           vec.push_back({i});
                            ^
      ```
      
      Reviewed By: simpkins
      
      Differential Revision: D19652353
      
      fbshipit-source-id: ca72a80002096e1d35c61a219f9af271fa79a4a7
      97c2cdd4
    • generatedunixname89002005287564's avatar
      Remove dead includes in folly/io · b206a6bd
      generatedunixname89002005287564 authored
      Reviewed By: yfeldblum
      
      Differential Revision: D19641278
      
      fbshipit-source-id: 2631056c6852de3b1e8b972e8b20b26283ea1070
      b206a6bd