Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] running Chef example device with RPC enabled on MacOS crashed #9

Open
erwinpan1 opened this issue May 30, 2023 · 1 comment
Open
Labels

Comments

@erwinpan1
Copy link
Owner

Reproduction steps

Description

Running Chef example device with RPC enabled on MacOS,, when accessing through RPC, the process crashed and shows "Chip stack locking error at '../third_party/connectedhomeip/src/app/util/attribute-storage.cpp:496'. Code is unsafe/racy" . Full logs are attached.

[1672985524055] [66420:2416745] CHIP: [DL] Device Configuration:
[1672985524055] [66420:2416745] CHIP: [DL]   Serial Number: TEST_SN
[1672985524055] [66420:2416745] CHIP: [DL]   Vendor Id: 65521 (0xFFF1)
[1672985524055] [66420:2416745] CHIP: [DL]   Product Id: 32768 (0x8000)
[1672985524055] [66420:2416745] CHIP: [DL]   Hardware Version: 0
[1672985524056] [66420:2416745] CHIP: [DL]   Setup Pin Code (0 for UNKNOWN/ERROR): 20202021
[1672985524056] [66420:2416745] CHIP: [DL]   Setup Discriminator (0xFFFF for UNKNOWN/ERROR): 3840 (0xF00)
[1672985524056] [66420:2416745] CHIP: [DL]   Manufacturing Date: (not set)
[1672985524056] [66420:2416745] CHIP: [DL]   Device Type: 65535 (0xFFFF)
[1672985524056] [66420:2416745] CHIP: [SVR] SetupQRCode: [MT:Y.K90AFN00KA0648G00]
[1672985524056] [66420:2416745] CHIP: [SVR] Copy/paste the below URL in a browser to see the QR Code:
[1672985524056] [66420:2416745] CHIP: [SVR] https://project-chip.github.io/connectedhomeip/qrcode.html?data=MT%3AY.K90AFN00KA0648G00
[1672985524056] [66420:2416745] CHIP: [SVR] Manual pairing code: [34970112332]
[1672985524056] [66420:2416761] CHIP: [DIS] Updating services using commissioning mode 1
[1672985524056] [66420:2416761] CHIP: [DL] Using wifi MAC for hostname
[1672985524057] [66420:2416761] CHIP: [DIS] Advertise commission parameter vendorID=65521 productID=32768 discriminator=3840/15 cm=1
[1672985524057] [66420:2416761] CHIP: [DIS] Registering service F014704C4BA27EF4 on host 88665A5ACF51.local. with port 5540 and type: _matterc._udp,_V65521,_S15,_L3840,_CM on interface id: 0
[1672985524057] [66420:2416761] CHIP: [DIS] Mdns: OnRegister name: F014704C4BA27EF4, type: _matterc._udp., domain: local., flags: 2
[1672985524057] [66420:2416761] CHIP: [DIS] mDNS service published: _matterc._udp; instance name: F014704C4BA27EF4
[1672985524059] [66420:2416761] CHIP: [DIS] Status: Satisfied
[1672985524059] [66420:2416761] CHIP: [DIS]     lo0 (1)
[1672985524059] [66420:2416761] CHIP: [DIS]             * ipv6: ::1
[1672985524059] [66420:2416761] CHIP: [DIS]             * ipv6: fe80::1
[1672985524060] [66420:2416761] CHIP: [DIS]     en0 (6 / WiFi)
[1672985524060] [66420:2416761] CHIP: [DIS]             * ipv6: fe80::1827:c337:dad5:269e
[1672985524060] [66420:2416761] CHIP: [DIS]             * ipv6: fd60:8de0:2059:b8c5:4bd:a9d7:dd45:9e3
[1672985524061] [66420:2416761] CHIP: [DIS] Mdns: OnRegisterRecord flags: 1
[1672985524061] [66420:2416761] CHIP: [DIS] Mdns: OnRegisterRecord flags: 1
[1672985524061] [66420:2416761] CHIP: [DIS] Mdns: OnRegisterRecord flags: 1
[1672985524061] [66420:2416761] CHIP: [DIS] Mdns: OnRegisterRecord flags: 0
[1672985541705] [66420:2416766] CHIP: [DMG] Reading attribute: Cluster=0x0000_0006 Endpoint=1 AttributeId=0x0000_0000 (expanded=0)
[1672985541705] [66420:2416766] CHIP: [DL] Chip stack locking error at '../third_party/connectedhomeip/src/app/util/attribute-storage.cpp:496'. Code is unsafe/racy
[1672985541705] [66420:2416766] CHIP: [-] chipDie chipDie chipDie

Resolution:

Lock the stack (by Promise) and use the same working thread to set/get attributes

Bug prevalence

Everytime

GitHub hash of the SDK that was being used

e394eb7

Platform

darwin

Platform Version(s)

No response

Anything else?

No response

erwinpan1 pushed a commit that referenced this issue Oct 10, 2023
…ist". (project-chip#29666)

The typical failure there looks like this:

==29620==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 88 byte(s) in 1 object(s) allocated from:
    #0 0x106396e12 in calloc+0xa2 (libclang_rt.asan_osx_dynamic.dylib:x86_64+0x51e12)
    #1 0x7ff800dc9789 in map_images_nolock+0x24b (libobjc.A.dylib:x86_64h+0x1789)
    #2 0x7ff800dc94db in map_images+0x42 (libobjc.A.dylib:x86_64h+0x14db)
    #3 0x113d721fa in invocation function for block in dyld4::RuntimeState::setObjCNotifiers(void (*)(unsigned int, char const* const*, mach_header const* const*), void (*)(char const*, mach_header const*), void (*)(char const*, mach_header const*))+0x112 (dyld:x86_64+0xf1fa)
    #4 0x113d6d6c8 in dyld4::RuntimeState::withLoadersReadLock(void () block_pointer)+0x28 (dyld:x86_64+0xa6c8)
    #5 0x113d720e1 in dyld4::RuntimeState::setObjCNotifiers(void (*)(unsigned int, char const* const*, mach_header const* const*), void (*)(char const*, mach_header const*), void (*)(char const*, mach_header const*))+0x51 (dyld:x86_64+0xf0e1)
    #6 0x113d85d44 in dyld4::APIs::_dyld_objc_notify_register(void (*)(unsigned int, char const* const*, mach_header const* const*), void (*)(char const*, mach_header const*), void (*)(char const*, mach_header const*))+0x4e (dyld:x86_64+0x22d44)
    #7 0x7ff800dc9343 in _objc_init+0x4fe (libobjc.A.dylib:x86_64h+0x1343)
    #8 0x7ff800d83992 in _os_object_init+0xc (libdispatch.dylib:x86_64+0x2992)
    #9 0x7ff800d911b7 in libdispatch_init+0x136 (libdispatch.dylib:x86_64+0x101b7)
    #10 0x7ff80bd34894 in libSystem_initializer+0xed (libSystem.B.dylib:x86_64+0x1894)
    #11 0x113d77e4e in invocation function for block in dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const+0xb5 (dyld:x86_64+0x14e4e)
    #12 0x113d9eaac in invocation function for block in dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int) block_pointer, void const*) const+0xf1 (dyld:x86_64+0x3baac)
    #13 0x113d95e25 in invocation function for block in dyld3::MachOFile::forEachSection(void (dyld3::MachOFile::SectionInfo const&, bool, bool&) block_pointer) const+0x22c (dyld:x86_64+0x32e25)
    #14 0x113d64db2 in dyld3::MachOFile::forEachLoadCommand(Diagnostics&, void (load_command const*, bool&) block_pointer) const+0x80 (dyld:x86_64+0x1db2)
    #15 0x113d95bb6 in dyld3::MachOFile::forEachSection(void (dyld3::MachOFile::SectionInfo const&, bool, bool&) block_pointer) const+0xb2 (dyld:x86_64+0x32bb6)
    #16 0x113d9e603 in dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int) block_pointer, void const*) const+0x1d1 (dyld:x86_64+0x3b603)
    #17 0x113d77d81 in dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const+0x8f (dyld:x86_64+0x14d81)
    #18 0x113d7e659 in dyld4::PrebuiltLoader::runInitializers(dyld4::RuntimeState&) const+0x1d (dyld:x86_64+0x1b659)
    #19 0x113d8b76d in dyld4::APIs::runAllInitializersForMain()+0x25 (dyld:x86_64+0x2876d)
    #20 0x113d6938c in dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*)+0xd72 (dyld:x86_64+0x638c)
    #21 0x113d684e3 in start+0x183 (dyld:x86_64+0x54e3)
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the Stale label Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant