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

Crash in chip::Inet::EndPointManagerImplPool<chip::Inet::UDPEndPointImplSockets, 32u>::~EndPointManagerImplPool #14859

Closed
woody-apple opened this issue Feb 7, 2022 · 3 comments · Fixed by #24767

Comments

@woody-apple
Copy link
Contributor

Problem

Thread 6 name:   Dispatch queue: com.apple.CoreHAP.CHIPAccessoryServer.clientQueue.4445458304
Thread 6 Crashed:
0   libsystem_kernel.dylib        	       0x1c1ed8b98 __pthread_kill + 8
1   libsystem_pthread.dylib       	       0x1fcb5f3dc pthread_kill + 272
2   libsystem_c.dylib             	       0x195246538 abort + 168
3   CHIP                          	       0x110e1ba08 chip::Inet::EndPointManagerImplPool<chip::Inet::UDPEndPointImplSockets, 32u>::~EndPointManagerImplPool() + 164
4   CHIP                          	       0x110e1a208 chip::Inet::EndPointManagerImplPool<chip::Inet::UDPEndPointImplSockets, 32u>::~EndPointManagerImplPool() + 32
5   libsystem_c.dylib             	       0x195246e9c __cxa_finalize_ranges + 464
6   libsystem_c.dylib             	       0x195241718 exit + 32
7   XXXX                    	       0x1017192f8 -[XXXX XXXX:] + 532
8   XXXX                  	       0x101208798 -[XXXXX] + 148
9   XXXX                  	       0x1012072e4 ____activateIfNecessary_block_invoke + 40
10  libdispatch.dylib             	       0x18990b8dc _dispatch_block_async_invoke2 + 148
11  libdispatch.dylib             	       0x1898fcad8 _dispatch_client_callout + 20
12  libdispatch.dylib             	       0x1898fff98 _dispatch_continuation_pop + 500
13  libdispatch.dylib             	       0x18991313c _dispatch_source_invoke + 1596
14  libdispatch.dylib             	       0x1899040ac _dispatch_lane_serial_drain + 376
15  libdispatch.dylib             	       0x189904d60 _dispatch_lane_invoke + 444
16  libdispatch.dylib             	       0x18990f5ac _dispatch_workloop_worker_thread + 648
17  libsystem_pthread.dylib       	       0x1fcb59140 _pthread_wqthread + 288
18  libsystem_pthread.dylib       	       0x1fcb58ee0 start_wqthread + 8

Proposed Solution

<suggested fix, suggested enhancement>

@bzbarsky-apple
Copy link
Contributor

@woody-apple Are we still seeing this?

@bzbarsky-apple
Copy link
Contributor

This is still happening. Something is leaking UDPEndPointImplSockets and then we crash on shutdown....

@bzbarsky-apple
Copy link
Contributor

Still happening, with stacks like:

3   Matter                        	       0x1b62f6ff0 chipAbort + 20 (/Library/Caches/com.apple.xbs/Binaries/CHIPFramework/install/TempContent/Objects/Matter.build/Matter.build/out/../../../../../../../../Sources/CHIPFramework/connectedhomeip/src/lib/support/CodeUtils.h:508)
4   Matter                        	       0x1b64d56bc chip::Inet::EndPointManager<chip::Inet::UDPEndPoint>::~EndPointManager() + 376 (/Library/Caches/com.apple.xbs/Binaries/CHIPFramework/install/TempContent/Objects/Matter.build/Matter.build/out/../../../../../../../../Sources/CHIPFramework/connectedhomeip/src/inet/InetLayer.h:59)
5   Matter                        	       0x1b64d5534 chip::Inet::EndPointManagerImplPool<chip::Inet::UDPEndPointImplSockets>::~EndPointManagerImplPool() + 76 (/Library/Caches/com.apple.xbs/Binaries/CHIPFramework/install/TempContent/Objects/Matter.build/Matter.build/out/../../../../../../../../Sources/CHIPFramework/connectedhomeip/src/inet/InetLayer.h:119)
6   Matter                        	       0x1b64d4834 chip::Inet::EndPointManagerImplPool<chip::Inet::UDPEndPointImplSockets>::~EndPointManagerImplPool() + 32 (/Library/Caches/com.apple.xbs/Binaries/CHIPFramework/install/TempContent/Objects/Matter.build/Matter.build/out/../../../../../../../../Sources/CHIPFramework/connectedhomeip/src/inet/InetLayer.h:119)
7   libsystem_c.dylib             	       0x1858f4a6c __cxa_finalize_ranges + 476 (/Library/Caches/com.apple.xbs/Sources/Libc/stdlib/FreeBSD/atexit.c:290)

due to exit calls.

bzbarsky-apple added a commit to bzbarsky-apple/connectedhomeip that referenced this issue Feb 1, 2023
We have lots of things with static destructors that assert clean
shutdown in the destructor.  That means that calling exit() without a
clean shutdown is pretty much guaranteed to lead to a shutdown crash.

Just ensure that we are in fact shutting down the
MTRDeviceControllerFactory if exit() is called, to avoid those crashes.

Fixes project-chip#14859
woody-apple pushed a commit that referenced this issue Feb 1, 2023
We have lots of things with static destructors that assert clean
shutdown in the destructor.  That means that calling exit() without a
clean shutdown is pretty much guaranteed to lead to a shutdown crash.

Just ensure that we are in fact shutting down the
MTRDeviceControllerFactory if exit() is called, to avoid those crashes.

Fixes #14859
kkasperczyk-no pushed a commit to kkasperczyk-no/sdk-connectedhomeip that referenced this issue Mar 15, 2023
We have lots of things with static destructors that assert clean
shutdown in the destructor.  That means that calling exit() without a
clean shutdown is pretty much guaranteed to lead to a shutdown crash.

Just ensure that we are in fact shutting down the
MTRDeviceControllerFactory if exit() is called, to avoid those crashes.

Fixes project-chip/connectedhomeip#14859
kkasperczyk-no pushed a commit to kkasperczyk-no/sdk-connectedhomeip that referenced this issue Mar 15, 2023
We have lots of things with static destructors that assert clean
shutdown in the destructor.  That means that calling exit() without a
clean shutdown is pretty much guaranteed to lead to a shutdown crash.

Just ensure that we are in fact shutting down the
MTRDeviceControllerFactory if exit() is called, to avoid those crashes.

Fixes project-chip/connectedhomeip#14859
lecndav pushed a commit to lecndav/connectedhomeip that referenced this issue Mar 22, 2023
…hip#24767)

We have lots of things with static destructors that assert clean
shutdown in the destructor.  That means that calling exit() without a
clean shutdown is pretty much guaranteed to lead to a shutdown crash.

Just ensure that we are in fact shutting down the
MTRDeviceControllerFactory if exit() is called, to avoid those crashes.

Fixes project-chip#14859
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants