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

[Thread]: Fix crash in ThreadStackManager during system shutdown #5700

Merged
merged 1 commit into from
Mar 31, 2021
Merged

[Thread]: Fix crash in ThreadStackManager during system shutdown #5700

merged 1 commit into from
Mar 31, 2021

Conversation

yufengwangca
Copy link
Contributor

@yufengwangca yufengwangca commented Mar 30, 2021

Problem

Observe the system crash in ThreadStackManager during system shutdown.

From the backtrace, it seems the last reference on a connection was dropped without closing the connection.

(gdb) bt
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1 0x00007ffff7531859 in __GI_abort () at abort.c:79
#2 0x00007ffff7c56ed2 in () at /lib/x86_64-linux-gnu/libdbus-1.so.3
#3 0x00007ffff7c79570 in _dbus_strdup () at /lib/x86_64-linux-gnu/libdbus-1.so.3
#4 0x000055555558c1ec in chip::DeviceLayer::ThreadStackManagerImpl::DBusConnectionDeleter::operator()(DBusConnection*) (this=0x5555555fae88 chip::DeviceLayer::ThreadStackManagerImpl::sInstance+8, aConnection=0x555555639860)
at ../../src/platform/Linux/ThreadStackManagerImpl.h:102
#5 0x000055555558ccd6 in std::unique_ptr<DBusConnection, chip::DeviceLayer::ThreadStackManagerImpl::DBusConnectionDeleter>::~unique_ptr()
(this=0x5555555fae88 chip::DeviceLayer::ThreadStackManagerImpl::sInstance+8, __in_chrg=) at /usr/include/c++/9/bits/unique_ptr.h:292
#6 0x000055555558e212 in chip::DeviceLayer::ThreadStackManagerImpl::~ThreadStackManagerImpl() (this=0x5555555fae80 chip::DeviceLayer::ThreadStackManagerImpl::sInstance, __in_chrg=)
at ../../src/platform/Linux/ThreadStackManagerImpl.h:95
#7 0x00007ffff7555a27 in __run_exit_handlers (status=0, listp=0x7ffff76f7718 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:108
#8 0x00007ffff7555be0 in __GI_exit (status=) at exit.c:139
#9 0x000055555556d6f2 in chip::Shell::cmd_exit(int, char**) (argc=0, argv=0x7fffffffdd18) at ../../src/lib/shell/commands.cpp:41
#10 0x000055555556ce75 in chip::Shell::Shell::ExecCommand(int, char**)Python Exception <class 'RecursionError'> maximum recursion depth exceeded while getting the str of an object:
(this=0x5555555f8140 chip::Shell::Shell::theShellRoot, argc=1, argv=0x7fffffffdd10) at ../../src/lib/shell/shell.cpp:141
#11 0x000055555556d1ab in chip::Shell::Shell::TaskLoop(void*) (arg=0x0) at ../../src/lib/shell/shell.cpp:223
#12 0x000055555556ca71 in chip::Shell::shell_task(void*) (arg=0x0) at ../../src/lib/shell/shell.h:187
#13 0x000055555556cae3 in main() () at ../../examples/shell/standalone/main.cpp:50

Summary of Changes

Close the dbus connection before freeing the dbus connection.

@bzbarsky-apple bzbarsky-apple merged commit b007291 into project-chip:master Mar 31, 2021
@yufengwangca yufengwangca deleted the pr/linux/dbus branch March 31, 2021 18:58
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.

5 participants