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

Fix random Segmentation fault issue in CRMP testing. #5361

Merged
merged 1 commit into from
Mar 16, 2021
Merged

Fix random Segmentation fault issue in CRMP testing. #5361

merged 1 commit into from
Mar 16, 2021

Conversation

yufengwangca
Copy link
Contributor

Problem

Thread 8 "chip-shell" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffe77fe700 (LWP 102296)]
0x00005555555781c0 in chip::System::Layer::State (this=0x0) at ../../src/system/SystemLayer.h:222
222 return this->mLayerState;

From crash log, it seems there are still pending timer alive after SecureSessionMgr is shut down.

#0 0x00005555555781c0 in chip::System::Layer::State() const (this=0x0) at ../../src/system/SystemLayer.h:222
#1 0x000055555557845c in chip::System::Layer::CancelTimer(void ()(chip::System::Layer, void*, int), void*)
(this=0x0, aOnComplete=0x55555559243e <chip::SecureSessionMgr::ExpiryTimerCallback(chip::System::Layer*, void*, int)>, aAppState=0x5555555f7ba0 <(anonymous namespace)::gSessionManager>) at ../../src/system/SystemLayer.cpp:321
#2 0x00005555555783d1 in chip::System::Layer::StartTimer(unsigned int, void ()(chip::System::Layer, void*, int), void*)
(this=0x0, aMilliseconds=5000, aComplete=0x55555559243e <chip::SecureSessionMgr::ExpiryTimerCallback(chip::System::Layer*, void*, int)>, aAppState=0x5555555f7ba0 <(anonymous namespace)::gSessionManager>)
at ../../src/system/SystemLayer.cpp:292
#3 0x0000555555591df7 in chip::SecureSessionMgr::ScheduleExpiryTimer() (this=0x5555555f7ba0 <(anonymous namespace)::gSessionManager>) at ../../src/transport/SecureSessionMgr.cpp:307
#4 0x0000555555592469 in chip::SecureSessionMgr::ExpiryTimerCallback(chip::System::Layer*, void*, int) (layer=0x5555555f87c0 chip::DeviceLayer::SystemLayer, param=0x5555555f7ba0 <(anonymous namespace)::gSessionManager>, error=0)
at ../../src/transport/SecureSessionMgr.cpp:420
#5 0x0000555555577ae7 in chip::System::Timer::HandleComplete() (this=0x5555555f8460 chip::System::Timer::sPool) at ../../src/system/SystemTimer.cpp:274
#6 0x0000555555578a5e in chip::System::Layer::HandleSelectResult(int, fd_set*, fd_set*, fd_set*)
(this=0x5555555f87c0 chip::DeviceLayer::SystemLayer, aSetSize=13, aReadSet=0x5555555f8970 chip::DeviceLayer::PlatformManagerImpl::sInstance+16, aWriteSet=0x5555555f89f0 chip::DeviceLayer::PlatformManagerImpl::sInstance+144, aExceptionSet=0x5555555f8a70 chip::DeviceLayer::PlatformManagerImpl::sInstance+272) at ../../src/system/SystemLayer.cpp:698
#7 0x0000555555582763 in chip::DeviceLayer::Internal::GenericPlatformManagerImpl_POSIXchip::DeviceLayer::PlatformManagerImpl::SysProcess() (this=0x5555555f8960 chip::DeviceLayer::PlatformManagerImpl::sInstance)
at ../../src/include/platform/internal/GenericPlatformManagerImpl_POSIX.cpp:186
#8 0x000055555558230e in chip::DeviceLayer::Internal::GenericPlatformManagerImpl_POSIXchip::DeviceLayer::PlatformManagerImpl::_RunEventLoop() (this=0x5555555f8960 chip::DeviceLayer::PlatformManagerImpl::sInstance)
at ../../src/include/platform/internal/GenericPlatformManagerImpl_POSIX.cpp:212
#9 0x0000555555581c8a in chip::DeviceLayer::PlatformManager::RunEventLoop() (this=0x5555555f8960 chip::DeviceLayer::PlatformManagerImpl::sInstance) at ../../src/include/platform/PlatformManager.h:204
#10 0x00005555555828b9 in chip::DeviceLayer::Internal::GenericPlatformManagerImpl_POSIXchip::DeviceLayer::PlatformManagerImpl::EventLoopTaskMain(void*) (arg=0x5555555f8960 chip::DeviceLayer::PlatformManagerImpl::sInstance)
at ../../src/include/platform/internal/GenericPlatformManagerImpl_POSIX.cpp:223
#11 0x00007ffff7f9c609 in start_thread (arg=) at pthread_create.c:477
#12 0x00007ffff762e293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
(gdb)

Summary of Changes

Clear any pending timer after SecureSessionMgr is shut down.

@yufengwangca yufengwangca changed the title Fix Segmentation fault issue during CRMP testing. Fix random Segmentation fault issue in CRMP testing. Mar 14, 2021
@andy31415 andy31415 merged commit a079680 into project-chip:master Mar 16, 2021
@yufengwangca yufengwangca deleted the pr/transport/crash branch March 16, 2021 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants