1. 07 Jan, 2021 2 commits
    • Lucian Grijincu's avatar
      folly: symbolizer: check if findSubProgramDieForAddress found the... · bc7d7abf
      Lucian Grijincu authored
      folly: symbolizer: check if findSubProgramDieForAddress found the DW_TAG_subprogram for address & terminate DFS early
      
      Summary:
      It's legal that a CU has `DW_AT_ranges` listing all addresses, but not have a `DW_TAG_subprogram` child DIE for some of those addresses.
      
      Check for `findSubProgramDieForAddress` success before reading potentially empty `subprogram` attributes in `eachParameterName`.
      
      This is a bugfix. If `DW_TAG_subprogram` is missing, we read attributes for using offsets in the uninitialized DIE `subprogram`.
      
      Initialize all struct members to avoid wasting time debugging uninitialized memory access (had fun with uninitialized `subprogram.abbr.tag` magically picking up `DW_TAG_subprogram` or garbage on the stack from previous calls).
      
       ---
      
      Terminate `findSubProgramDieForAddress` DFS on match.
      
      Before:
      - when the DW_TAG_subprogram DIE was found we stopped scanning its direct siblings (the above "return false" when `pcMatch` or `rangeMatch` are true).
      - but when we returned from recursion in the parent DIE we discarded the fact that we found the DW_TAG_subprogram and continued the DFS scan through all remaining DIEs.
      
      After:
      - after finding the DW_TAG_subprogram that owns that address the scan stops.
      
      As reference when using `-fno-debug-types-section` type info is part of `.debug_info`.
      
      ```
      namespace folly::symbolizer::test {
      void function_A();
      class SomeClass { void some_member_function() {} };
      void function_B();
      } // folly::symbolizer::test
      ```
      
      ```
      0x0000004c:   DW_TAG_namespace [2] *
                      DW_AT_name [DW_FORM_strp]       ( "folly")
      
      0x00000051:     DW_TAG_namespace [2] *
                        DW_AT_name [DW_FORM_strp]     ( "symbolizer")
      
      0x00000056:       DW_TAG_namespace [2] *
                          DW_AT_name [DW_FORM_strp]   ( "test")
      
      0x0000012e:         DW_TAG_subprogram [7] *
                            DW_AT_name [DW_FORM_strp] ( "function_A")
      
      0x0000022d:         DW_TAG_class_type [14] *
                            DW_AT_name [DW_FORM_strp] ( "SomeClass")
      
      0x00000243:           DW_TAG_subprogram [16] *
                              DW_AT_name [DW_FORM_strp]       ( "some_member_function")
      
      0x000002ed:         DW_TAG_subprogram [9] *
                            DW_AT_name [DW_FORM_strp] ( "function_B")
      ```
      
      Before:
      - if `address` corresponds to code inside `SomeClass::some_member_function` we stopped iterating over `SomeClass::some_member_function`'s sibling DIEs, and returned.
      - but we still continued scanning over `SomeClass`'s sibling DIEs and all their children recursively (DFS), and then `SomeClass`'s parents siblings etc until reaching the end of the CU
      
      After:
      - we stop DFS on match
      
      FWIW: trees are somewhat flatter when using `-fdebug-types-section`: member functions are extracted from their classes, but they're still part of namespace subtrees so the code unnecessarily explored siblings of the innermost namespace.
      
      Differential Revision: D25799618
      
      fbshipit-source-id: 9a0267e12a7d496ad00263bf30a12dc548764288
      bc7d7abf
    • Nathan Lanza's avatar
      Convert implicit cast from `long` to `double` to a `static_cast` · 5a9b1bb0
      Nathan Lanza authored
      Summary:
      This code implicitly casts a `long` to `double` but a `double`
      can not accurately represent an integer above `2^53` as
      the mantissa only stores that many digits. At `2^53 + 1`
      `double`s increment by `2`. Thus this cast is lossy. Though,
      casting a single value `LONG_MAX` to a `double` is and
      being off by one doesn't cause any harm here.
      
      Reviewed By: ispeters
      
      Differential Revision: D25654006
      
      fbshipit-source-id: 3d84092f1786d7879dd48d73af8edbbc80bb3585
      5a9b1bb0
  2. 06 Jan, 2021 4 commits
    • Lucian Grijincu's avatar
      folly::symbolizer: drop templated FrameArray from test functions and move test... · 8f2210a5
      Lucian Grijincu authored
      folly::symbolizer: drop templated FrameArray from test functions and move test functions to separate compilation unit with minimal dependencies
      
      Summary:
      Eliminate `#include` dependencies of `SymbolizerTestUtils.cpp` so that the `.o` file with interesting debug info is tiny and easily inspectable.
      - Instead of calling test functions that need to be inlined from the `SymbolizerTest.o` use `call_` trampolines so that the inlined debug info is generated in the minimal/tiny `SymbolizerTestUtils.o`.
      
       ---
      
      Remove the frames template argument so that:
      - removed dependencies from the SymbolizerTestUtils to minimize generated debug info (no longer need to include headers about FrameArray).
      - all functions used in tests can be made regular functions
      - all functions who's debug info is interesting to debug can be easily emitted in a single object file `SymbolizerTestUtils.o`
      
      Reduce some of the copy-pasta that made test noisy by grouping together function name, file and lineno.
      
       ---
      
      Test for either fullName/shortName (`DW_AT_linkage_name`/`DW_AT_name`)
      - fullName: demangled function name with namespace, qualifiers, argument types, etc. and
      - shortName: simple function name to support both cases when either both `DW_AT_linkage_name` and `DW_AT_name` or a single one of them is emitted.
      - When `DW_AT_linkage_name` (full mangled name) and `DW_AT_name` (just the function name) match, DWARF emitters omit `DW_AT_linkage_name` (to save space). With `-fsplit-dwarf-inlining` only `DW_AT_name` is emitted in `.debug_info` and the `DW_AT_linkage_name` is emitted in the `.debug_info.dwo` sections.
      
      Differential Revision: D25712808
      
      fbshipit-source-id: 88d2ac22564e3d607fb3864d37e49892a5eaf002
      8f2210a5
    • Andrew Huang's avatar
      Set default minimum TLS version in SSLContext to TLS 1.2 · 731276a4
      Andrew Huang authored
      Reviewed By: yfeldblum
      
      Differential Revision: D25527140
      
      fbshipit-source-id: 2a2721ca4418e1a4c57f621f41716e5c8f27869c
      731276a4
    • Yair Gottdenker's avatar
      Adding logs to connect error/success · 17468b65
      Yair Gottdenker authored
      Summary:
      Small change - adding  logs to connect error/success and eliminating the unnecessary ones.
      
      (Note: this ignores all push blocking failures!)
      
      Reviewed By: yfeldblum
      
      Differential Revision: D25481273
      
      fbshipit-source-id: 437942803bc895bba2eaa36e5eaf104503012d12
      17468b65
    • Misha Shneerson's avatar
      add priorities support to thread manager executor adapter · f07f33e5
      Misha Shneerson authored
      Summary:
      Adding priorities to `ThreadManagerExecutorAdapter`. The API allows to pass single executor that would be used for all priorities (preserved behavior) but also allows to add custom executors per-priority. In this case, if no executor has been provided for priority, we will spin up default thread manager implementation (which supports upstream queues).
      
      We soon will add upstream queues on top of user-provided executors as well.
      
      Reviewed By: prshreshtha
      
      Differential Revision: D25137444
      
      fbshipit-source-id: db0740a705dd3cca69916f3d1b8c4e32c011aa43
      f07f33e5
  3. 05 Jan, 2021 4 commits
    • Scott Pruett's avatar
      allow callbacks to be set and called on updates · 5398ad14
      Scott Pruett authored
      Summary:
      Allow callbacks to be attached to a SettingCore (via SettingWrapper),
      with lifetime managed by a guard object which automatically unregisters
      the callback at destruction. This provides an API for clients to react
      to changes in settings without polling.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D25592427
      
      fbshipit-source-id: a11a98ed651ef56a0fc86f5f5e4ed235f2289746
      5398ad14
    • Katie Mancini's avatar
      Exend XLOG_EVERY_N use · a7c84c39
      Katie Mancini authored
      Summary:
      the n argument in XLOG_EVERY_N is not captured by it's lambda, so
      expressions using local variables can not be passed as n. EdenFS has
      a use case where we would like to use local variables here. We want to use a
      dynamic config value for n, so that we can easily adjust how often we log
      see: D25505654.
      
      It seems like it should be ok to capture the n here, but I am by no means a
      macro expert, so please let me know if there is a tricky cpp thing here lurking
      that makes capturing n bad.
      
      Reviewed By: simpkins
      
      Differential Revision: D25551033
      
      fbshipit-source-id: e82fa465823d3d2ee2ac26924cc4a93b7b7242dd
      a7c84c39
    • Dan Melnic's avatar
      Fix OSS build - move struct/enums into their own namespace · e127df07
      Dan Melnic authored
      Summary: Fix OSS build - move struct/enums into their own namespace
      
      Reviewed By: danobi, lnicco
      
      Differential Revision: D25769992
      
      fbshipit-source-id: 1e337820edbd986bdd47099cf8af942698e6fc75
      e127df07
    • Evgeny Fiksman's avatar
      Explicitly name hazptr thread pool (#1512) · 0cc9b77f
      Evgeny Fiksman authored
      Summary:
      Pull Request resolved: https://github.com/facebook/folly/pull/1512
      
      Hazptr library creates its own CPU executor which name interfere with default executor name. We want to avoid this.
      Also insure that the thread is permanent, otherwise folly runtime may destroy and recreate it periodically.
      
      Reviewed By: magedm
      
      Differential Revision: D25708252
      
      fbshipit-source-id: 2b41ad4fa28d2ba9c9bd69bc5d4a02b933d79e66
      0cc9b77f
  4. 04 Jan, 2021 1 commit
  5. 01 Jan, 2021 1 commit
  6. 29 Dec, 2020 2 commits
  7. 28 Dec, 2020 3 commits
    • Yedidya Feldblum's avatar
      let AsyncPipe::create return the correct type · a1251f06
      Yedidya Feldblum authored
      Summary: Let `AsyncPipe::create` return the correct pipe type, namely, the type on which it is a member rather than a different instantiation of the template.
      
      Reviewed By: iahs
      
      Differential Revision: D25717180
      
      fbshipit-source-id: 94a5a657e83b5d4cac866277ec5925c0b5b0af28
      a1251f06
    • Orvid King's avatar
      Include <optional> where required · 33df23f4
      Orvid King authored
      Summary: Using std::optional requires including it first.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D25704383
      
      fbshipit-source-id: 755dfd4a6dec9695cb0ed156166d13b550fd8b40
      33df23f4
    • Lewis Baker's avatar
      Add co_current_async_stack_trace awaitable · 184d54bb
      Lewis Baker authored
      Summary:
      Adds a new awaitable that extracs the current async stack-trace as a vector
      of program counters from within the current coroutine.
      
      Usage:
      ```
      std::vector<std::uintptr_t> programCounters =
        co_await folly::coro::co_current_async_stack_trace;
      ```
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D21130683
      
      fbshipit-source-id: bf67a9969f73bdb8b91b4cc2858883b8e87762e2
      184d54bb
  8. 27 Dec, 2020 1 commit
    • Efrat Lewis's avatar
      AsyncSocket facility to read ancillary data · 7a2b83b4
      Efrat Lewis authored
      Summary: Defined new callback - ReadAncillaryDataCallback, which enables getting ancillary data when receive a message using recvmsg API.
      
      Reviewed By: cgrushko
      
      Differential Revision: D24246707
      
      fbshipit-source-id: 3363b5fafe8d370cf5560afe00476fc8ea723e7a
      7a2b83b4
  9. 26 Dec, 2020 1 commit
  10. 25 Dec, 2020 3 commits
  11. 24 Dec, 2020 1 commit
    • Dan Melnic's avatar
      Fix gso typo · d99290f5
      Dan Melnic authored
      Summary:
      Fix gso typo
      
      (Note: this ignores all push blocking failures!)
      
      Reviewed By: kevin-vigor
      
      Differential Revision: D25699054
      
      fbshipit-source-id: bac1a7a5c13efa5a58ecec11edf72c500b0783b5
      d99290f5
  12. 23 Dec, 2020 3 commits
    • Yedidya Feldblum's avatar
      add co_cancelled · 0c47744a
      Yedidya Feldblum authored
      Summary: [folly] Add `co_cancelled`, effectively a shorthand for `co_error(OperationCancelled{})`.
      
      Reviewed By: Mizuchi, lewissbaker
      
      Differential Revision: D25627993
      
      fbshipit-source-id: 91f80772a8b179a4de0fe3b29dfe7eecaafb8e1b
      0c47744a
    • Dan Melnic's avatar
      Fix nullptr dereference · 590d4349
      Dan Melnic authored
      Summary: Fix nullptr dereference
      
      Reviewed By: kevin-vigor
      
      Differential Revision: D25687105
      
      fbshipit-source-id: 59b0f3e4adc810f6e1a89447667cd167c52f7fb5
      590d4349
    • Andrii Grynenko's avatar
      Replace after-fork-use DFATAL with ERROR · 69bbfc4b
      Andrii Grynenko authored
      Differential Revision: D25683616
      
      fbshipit-source-id: 7f199b0e43e0a5a76c4cf16412b22abdc28833ac
      69bbfc4b
  13. 22 Dec, 2020 4 commits
    • Yedidya Feldblum's avatar
      fix Arena bytes-used accounting across merge · e124ab8e
      Yedidya Feldblum authored
      Summary: Fix `Arena` bytes-used accounting across calls to member `merge`.
      
      Reviewed By: luciang
      
      Differential Revision: D25656949
      
      fbshipit-source-id: b230b0cdbf51b146fd566cbf688f49817bdf874d
      e124ab8e
    • Yedidya Feldblum's avatar
      rename coro Error.h to Result.h · 37f3868a
      Yedidya Feldblum authored
      Summary: [folly] Rename coro `Error.h` to `Result.h` since it has multiple result types.
      
      Reviewed By: Mizuchi
      
      Differential Revision: D25625178
      
      fbshipit-source-id: 45f8194922b764429969329563a4695b1c13da6f
      37f3868a
    • Yedidya Feldblum's avatar
      fix Arena bytes-used accounting across clear · 4c2177f5
      Yedidya Feldblum authored
      Summary: Fix `Arena` bytes-used accounting across calls to member `clear` after a sequence of all-large allocations.
      
      Reviewed By: luciang
      
      Differential Revision: D25656875
      
      fbshipit-source-id: e79aca5f58b61bf1bd4790f8badd0dad6063a6ed
      4c2177f5
    • Andrii Grynenko's avatar
      Detect singletons that are created in parent process and used in child process · c55c0192
      Andrii Grynenko authored
      Summary: folly::Singleton is used for singletons that manage resources (thread, fds etc.) and it's generally not safe to use previously created folly::Singletons in child process after fork.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D25292667
      
      fbshipit-source-id: 5343d26c72bb9203429a918a3bb5d458c44e9f3b
      c55c0192
  14. 21 Dec, 2020 5 commits
    • Arthur Kushka's avatar
      Forced watchman daemon to always operate in non elevated mode on Windows (#878) · e45e8964
      Arthur Kushka authored
      Summary:
      Recently I found that its impossible to access elevated Watchman daemon from non-elevated process on Windows.
      
      ```
      events.js:174
            throw er; // Unhandled 'error' event
            ^
      Error: connect EPERM \\.\pipe\watchman
          at PipeConnectWrap.afterConnect [as oncomplete] (net.js:1106:14)
      Emitted 'error' event at:
          at Socket.<anonymous> (C:\open\ovrsource\unity\socialvr\_js\node_modules\fb-watchman\index.js:118:12)
          at Socket.emit (events.js:198:13)
          at emitErrorNT (internal/streams/destroy.js:91:8)
          at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
          at process._tickCallback (internal/process/next_tick.js:63:19)
      ```
      
      To fix this, it was suggested by wez to use [his library](https://github.com/wez/EleDo) to force Watchman daemon always start in normal mode on Windows. In this stack of commits I did integrated his library into project and used it to force daemon restart in normal mode when spawned from elevated terminal.
      
      To make it happen, I checked-in library sources and created proxy project which depends on the initial library and contains header bindings and cmake configuration. I did copy pasted Rust cmake macroses from another facebook project - eden, and also created analogue of autogen.sh but for Windows - autogen.cmd.
      
      Pull Request resolved: https://github.com/facebook/watchman/pull/878
      
      Test Plan:
      Launch elevated terminal
      Start watchman.exe produced from sources
      Observe daemon starting and answering
      In process monitor, observe watchman.exe process running under user group
      
      Reviewed By: fanzeyi
      
      Differential Revision: D25595879
      
      Pulled By: arhelmus
      
      fbshipit-source-id: 15eb29adcf5bd4a5708b6533a1b2bacbf13f431c
      e45e8964
    • Yedidya Feldblum's avatar
      Cut FOLLY_HAVE_MEMRCHR · ea0cdfe1
      Yedidya Feldblum authored
      Summary: [Folly] Cut `FOLLY_HAVE_MEMRCHR` since it is now unused.
      
      Reviewed By: Orvid
      
      Differential Revision: D22130149
      
      fbshipit-source-id: b10c5a52354f5c549d96b54e0c165f08b96612b1
      ea0cdfe1
    • Pranjal Raihan's avatar
      Remove folly::observer::waitForAllUpdates · 79dc5c64
      Pranjal Raihan authored
      Summary: Since this API is discouraged from use, users should call `folly::observer_detail::ObserverManager::waitForAllUpdates` (and face whatever consequences may come with it).
      
      Reviewed By: yfeldblum
      
      Differential Revision: D25629064
      
      fbshipit-source-id: 141b27bbc4f7cf9b628f15f837c38dd4d8a04f31
      79dc5c64
    • generatedunixname89002005325676's avatar
      Daily `arc lint --take CLANGFORMAT` · 9cc99a5c
      generatedunixname89002005325676 authored
      Reviewed By: zertosh
      
      Differential Revision: D25662961
      
      fbshipit-source-id: f5811a5797fd6dc8733fdf86f35c93d12a08d53a
      9cc99a5c
    • Yedidya Feldblum's avatar
      fix Arena total-size accounting across clear · 78fe8913
      Yedidya Feldblum authored
      Summary: Fix `Arena` total-size accounting across calls to `clear`, as reported by member `totalSize`.
      
      Reviewed By: luciang
      
      Differential Revision: D25656867
      
      fbshipit-source-id: b5c7bb0e95199a9fa2c94c04de65b8f494eef146
      78fe8913
  15. 20 Dec, 2020 3 commits
    • Orvid King's avatar
      Use portability/GTest.h · 2d871f2f
      Orvid King authored
      Summary: Don't use gtest/gtest.h directly.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D25659806
      
      fbshipit-source-id: a8dd0da814465a787ab7904bdd0256f22b6e3ed8
      2d871f2f
    • Orvid King's avatar
      Match DoubleRadixSort test name to file name · e4eb39f3
      Orvid King authored
      Summary: As per title
      
      Reviewed By: yfeldblum
      
      Differential Revision: D25636982
      
      fbshipit-source-id: a59c2325558175e122941000ab645c8735a3a425
      e4eb39f3
    • Yedidya Feldblum's avatar
      use throw_exception in Arena · bc8c42bb
      Yedidya Feldblum authored
      Summary: Use `throw_exception` consistently in `Arena` for consistency.
      
      Differential Revision: D25637401
      
      fbshipit-source-id: 92cda5acc09b871fed78044fa3f3fa2c41b01609
      bc8c42bb
  16. 19 Dec, 2020 2 commits
    • Yedidya Feldblum's avatar
      asan_region_is_poisoned · e6955f4d
      Yedidya Feldblum authored
      Summary: [folly] `asan_region_is_poisoned` to wrap Address Sanitizer's `__asan_region_is_poisoned`.
      
      Reviewed By: ot, luciang, markisaa
      
      Differential Revision: D25651040
      
      fbshipit-source-id: 0c8f1d0203ada43746b5e2e71c1bd8b883248f68
      e6955f4d
    • Alfred Fuller's avatar
      Fix include order and grouping in folly - 7/13 · 59fe375d
      Alfred Fuller authored
      Summary: All changes were automated
      
      Reviewed By: Orvid
      
      Differential Revision: D25507555
      
      fbshipit-source-id: c0be9a04b8a5f502f4753ce6e163a78c428bfad6
      59fe375d