mikekazakov/nimble-commander

Investigate a spurious ASAN violation in FSEventsDirUpdate

Opened this issue · 0 comments

Sometimes happens in the CI workflows:

-------------------------------------------------------------------------------
nc::utility::FSEventsDirUpdate Registers event listeners
-------------------------------------------------------------------------------
tests/FSEventsDirUpdate_UT.cpp:24
...............................................................................

tests/FSEventsDirUpdate_UT.cpp:38: FAILED:
  REQUIRE( runMainLoopUntilExpectationOrTimeout(5s, [&] { return call_count[0] == 2 && call_count[1] == 1; }) )
with expansion:
  false

=================================================================
==12996==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ff7b59714a0 at pc 0x00010a630ca9 bp 0x7ff7b596b220 sp 0x7ff7b596b218
READ of size 4 at 0x7ff7b59714a0 thread T0
    #0 0x10a630ca8 in std::__1::__function::__func<____C_A_T_C_H____T_E_S_T____2()::$_3, std::__1::allocator<____C_A_T_C_H____T_E_S_T____2()::$_3>, void ()>::operator()() function.h:356
    #1 0x10a8d233a in nc::utility::FSEventsDirUpdateImpl::FSEventsDirUpdateCallback(__FSEventStream const*, void*, unsigned long, void*, unsigned int const*, unsigned long long const*) FSEventsDirUpdateImpl.cpp:95
    #2 0x7ff81ca131b7 in implementation_callback_rpc+0xeac (FSEvents:x86_64+0x31b7)
    #3 0x7ff81ca1228d in _Xcallback_rpc+0xe8 (FSEvents:x86_64+0x228d)
    #4 0x7ff81ca12186 in FSEventsD2F_server+0x36 (FSEvents:x86_64+0x2186)
    #5 0x7ff81ca157a6 in FSEventsClientProcessMessageCallback+0x2d (FSEvents:x86_64+0x57a6)
    #6 0x7ff814b59d75 in __CFMachPortPerform+0xf3 (CoreFoundation:x86_64h+0xaad75)
    #7 0x7ff814b2c3f2 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__+0x28 (CoreFoundation:x86_64h+0x7d3f2)
    #8 0x7ff814b2c332 in __CFRunLoopDoSource1+0x21b (CoreFoundation:x86_64h+0x7d332)
    #9 0x7ff814b2afb0 in __CFRunLoopRun+0xa85 (CoreFoundation:x86_64h+0x7bfb0)
    #10 0x7ff814b29ec0 in CFRunLoopRunSpecific+0x22f (CoreFoundation:x86_64h+0x7aec0)
    #11 0x10a6390c0 in runMainLoopUntilExpectationOrTimeout(std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l>>, std::__1::function<bool ()>) (.2245) FSEventsDirUpdate_UT.cpp:124
    #12 0x10a633f09 in ____C_A_T_C_H____T_E_S_T____4() (.2241) FSEventsDirUpdate_UT.cpp:60
    #13 0x10a78db99 in Catch::RunContext::invokeActiveTestCase() catch.hpp:12959
    #14 0x10a78cae4 in Catch::RunContext::runCurrentTest(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>&) catch.hpp:12932
    #15 0x10a78b326 in Catch::RunContext::runTest(Catch::TestCase const&) catch.hpp:12693
    #16 0x10a7981b6 in Catch::Session::runInternal() catch.hpp:13493
    #17 0x10a79622d in Catch::Session::run() catch.hpp:13449
    #18 0x10a7a480b in main UnitTests_main.cpp:20
    #19 0x7ff8146f641e in start+0x76e (dyld:x86_64+0xfffffffffff6e41e)

  0x7ff7b5971700: f2 f2 f2 f2 00 00 00 00 00 00 f2 f2 f2 f2 f8 f8
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==12996==ABORTING
./run_all_unit_tests.sh: line 97: 12996 Abort trap: 6           $path
-------------------------------------------------------------------------------
nc::utility::FSEventsDirUpdate Removes event listeners