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 SEGFAULT when running minmdns client #13423

Merged
merged 2 commits into from
Jan 11, 2022

Conversation

andy31415
Copy link
Contributor

Problem

Chip MDNS client uses a timeout to schedule a 'platform shutdown'.
When shutting down, the MinMDNS Server still holds UDP references and attempts to release them in its destructor, which crashes since SystemLayer has been shut down and is likely deallocated.

Change overview

Shutdown the mdns server before attempting to shut down the rest of the platform.

Testing

Rand minmdns client binary and observed no more SEGFAULT.

@github-actions
Copy link

github-actions bot commented Jan 10, 2022

PR #13423: Size comparison from 46cd8db to ce00701

Decreases (5 builds for linux, p6)
platform target config section 46cd8db ce00701 change % change
linux chip-tool-ipv6only arm64 (read only) 7105612 7105244 -368 -0.0
.text 6020036 6019668 -368 -0.0
thermostat-no-ble arm64 (read only) 2034188 2033836 -352 -0.0
.text 1691408 1691056 -352 -0.0
p6 all-clusters-app default (read/write) 2399760 2399712 -48 -0.0
.text 1358024 1357976 -48 -0.0
light-app default (read/write) 2323856 2323808 -48 -0.0
.text 1282120 1282072 -48 -0.0
lock-app default (read/write) 2296080 2296032 -48 -0.0
.text 1254344 1254296 -48 -0.0
Full report (11 builds for k32w, linux, p6, qpg, telink)
platform target config section 46cd8db ce00701 change % change
k32w light k32w061+release (read/write) 655396 655396 0 0.0
.bss 76776 76776 0 0.0
.data 1848 1848 0 0.0
.text 570972 570972 0 0.0
lock k32w061+release (read/write) 659736 659736 0 0.0
.bss 77072 77072 0 0.0
.data 1868 1868 0 0.0
.text 574996 574996 0 0.0
linux chip-tool-ipv6only arm64 (read only) 7105612 7105244 -368 -0.0
(read/write) 327041 327041 0 0.0
.bss 54865 54865 0 0.0
.data 1096 1096 0 0.0
.data.rel.ro 209424 209424 0 0.0
.dynamic 560 560 0 0.0
.got 57976 57976 0 0.0
.init 24 24 0 0.0
.init_array 168 168 0 0.0
.rodata 388916 388916 0 0.0
.text 6020036 6019668 -368 -0.0
thermostat-no-ble arm64 (read only) 2034188 2033836 -352 -0.0
(read/write) 145137 145137 0 0.0
.bss 64657 64657 0 0.0
.data 880 880 0 0.0
.data.rel.ro 72656 72656 0 0.0
.dynamic 560 560 0 0.0
.got 4008 4008 0 0.0
.init 24 24 0 0.0
.init_array 296 296 0 0.0
.rodata 129004 129004 0 0.0
.text 1691408 1691056 -352 -0.0
p6 all-clusters-app default (read/write) 2399760 2399712 -48 -0.0
.bss 116804 116804 0 0.0
.data 2592 2592 0 0.0
.text 1358024 1357976 -48 -0.0
light-app default (read/write) 2323856 2323808 -48 -0.0
.bss 105672 105672 0 0.0
.data 2384 2384 0 0.0
.text 1282120 1282072 -48 -0.0
lock-app default (read/write) 2296080 2296032 -48 -0.0
.bss 104552 104552 0 0.0
.data 2336 2336 0 0.0
.text 1254344 1254296 -48 -0.0
qpg lighting-app qpg6105+debug (read only) 533296 533296 0 0.0
(read/write) 146936 146936 0 0.0
.bss 86624 86624 0 0.0
.data 1004 1004 0 0.0
.text 527976 527976 0 0.0
lock-app qpg6105+debug (read only) 505072 505072 0 0.0
(read/write) 146940 146940 0 0.0
.bss 85760 85760 0 0.0
.data 952 952 0 0.0
.text 499752 499752 0 0.0
persistent-storage-app qpg6105+debug (read only) 106448 106448 0 0.0
(read/write) 146938 146938 0 0.0
.bss 36146 36146 0 0.0
.data 288 288 0 0.0
.text 101128 101128 0 0.0
telink lighting-app tlsr9518adk80d (read/write) 834638 834638 0 0.0
bss 86924 86924 0 0.0
noinit 37160 37160 0 0.0
text 582846 582846 0 0.0

@github-actions
Copy link

github-actions bot commented Jan 10, 2022

PR #13423: Size comparison from 46cd8db to 15ffbdf

Increases above 0.2%:

platform target config section 46cd8db 15ffbdf change % change
linux chip-tool-ipv6only arm64 .got 57976 58184 208 0.4
.rodata 388916 389956 1040 0.3
Increases (1 build for linux)
platform target config section 46cd8db 15ffbdf change % change
linux chip-tool-ipv6only arm64 (read only) 7105612 7116396 10784 0.2
(read/write) 327041 327249 208 0.1
.got 57976 58184 208 0.4
.rodata 388916 389956 1040 0.3
.text 6020036 6029156 9120 0.2
Decreases (7 builds for efr32, linux, p6)
platform target config section 46cd8db 15ffbdf change % change
efr32 lighting-app BRD4161A (read only) 829348 829028 -320 -0.0
.text 829340 829020 -320 -0.0
BRD4161A+rpc (read only) 816992 816224 -768 -0.1
.text 816984 816216 -768 -0.1
window-app BRD4161A (read only) 802812 802492 -320 -0.0
.text 802804 802484 -320 -0.0
linux thermostat-no-ble arm64 (read only) 2034188 2033580 -608 -0.0
.text 1691408 1690800 -608 -0.0
p6 all-clusters-app default (read/write) 2399760 2399712 -48 -0.0
.text 1358024 1357976 -48 -0.0
light-app default (read/write) 2323856 2323808 -48 -0.0
.text 1282120 1282072 -48 -0.0
lock-app default (read/write) 2296080 2296032 -48 -0.0
.text 1254344 1254296 -48 -0.0
Full report (14 builds for efr32, k32w, linux, p6, qpg, telink)
platform target config section 46cd8db 15ffbdf change % change
efr32 lighting-app BRD4161A (read only) 829348 829028 -320 -0.0
(read/write) 126996 126996 0 0.0
.bss 125120 125120 0 0.0
.data 1876 1876 0 0.0
.text 829340 829020 -320 -0.0
BRD4161A+rpc (read only) 816992 816224 -768 -0.1
(read/write) 143656 143656 0 0.0
.bss 141680 141680 0 0.0
.data 1976 1976 0 0.0
.text 816984 816216 -768 -0.1
window-app BRD4161A (read only) 802812 802492 -320 -0.0
(read/write) 125936 125936 0 0.0
.bss 124104 124104 0 0.0
.data 1832 1832 0 0.0
.text 802804 802484 -320 -0.0
k32w light k32w061+release (read/write) 655396 655396 0 0.0
.bss 76776 76776 0 0.0
.data 1848 1848 0 0.0
.text 570972 570972 0 0.0
lock k32w061+release (read/write) 659736 659736 0 0.0
.bss 77072 77072 0 0.0
.data 1868 1868 0 0.0
.text 574996 574996 0 0.0
linux chip-tool-ipv6only arm64 (read only) 7105612 7116396 10784 0.2
(read/write) 327041 327249 208 0.1
.bss 54865 54865 0 0.0
.data 1096 1096 0 0.0
.data.rel.ro 209424 209424 0 0.0
.dynamic 560 560 0 0.0
.got 57976 58184 208 0.4
.init 24 24 0 0.0
.init_array 168 168 0 0.0
.rodata 388916 389956 1040 0.3
.text 6020036 6029156 9120 0.2
thermostat-no-ble arm64 (read only) 2034188 2033580 -608 -0.0
(read/write) 145137 145137 0 0.0
.bss 64657 64657 0 0.0
.data 880 880 0 0.0
.data.rel.ro 72656 72656 0 0.0
.dynamic 560 560 0 0.0
.got 4008 4008 0 0.0
.init 24 24 0 0.0
.init_array 296 296 0 0.0
.rodata 129004 129004 0 0.0
.text 1691408 1690800 -608 -0.0
p6 all-clusters-app default (read/write) 2399760 2399712 -48 -0.0
.bss 116804 116804 0 0.0
.data 2592 2592 0 0.0
.text 1358024 1357976 -48 -0.0
light-app default (read/write) 2323856 2323808 -48 -0.0
.bss 105672 105672 0 0.0
.data 2384 2384 0 0.0
.text 1282120 1282072 -48 -0.0
lock-app default (read/write) 2296080 2296032 -48 -0.0
.bss 104552 104552 0 0.0
.data 2336 2336 0 0.0
.text 1254344 1254296 -48 -0.0
qpg lighting-app qpg6105+debug (read only) 533296 533296 0 0.0
(read/write) 146936 146936 0 0.0
.bss 86624 86624 0 0.0
.data 1004 1004 0 0.0
.text 527976 527976 0 0.0
lock-app qpg6105+debug (read only) 505072 505072 0 0.0
(read/write) 146940 146940 0 0.0
.bss 85760 85760 0 0.0
.data 952 952 0 0.0
.text 499752 499752 0 0.0
persistent-storage-app qpg6105+debug (read only) 106448 106448 0 0.0
(read/write) 146938 146938 0 0.0
.bss 36146 36146 0 0.0
.data 288 288 0 0.0
.text 101128 101128 0 0.0
telink lighting-app tlsr9518adk80d (read/write) 834638 834638 0 0.0
bss 86924 86924 0 0.0
noinit 37160 37160 0 0.0
text 582846 582846 0 0.0

@andy31415
Copy link
Contributor Author

/rebase

@woody-apple woody-apple force-pushed the fix_minmdns_client_crash branch from 15ffbdf to 25e873e Compare January 11, 2022 02:54
@github-actions
Copy link

github-actions bot commented Jan 11, 2022

PR #13423: Size comparison from 19f61eb to 25e873e

Decreases (11 builds for esp32, linux, mbed, p6)
platform target config section 19f61eb 25e873e change % change
esp32 all-clusters-app c3devkit (read only) 890494 890438 -56 -0.0
.flash.text 890494 890438 -56 -0.0
m5stack (read only) 950619 950591 -28 -0.0
.flash.text 945235 945207 -28 -0.0
linux chip-tool-ipv6only arm64 (read only) 7109708 7109356 -352 -0.0
.text 6022996 6022644 -352 -0.0
thermostat-no-ble arm64 (read only) 2031916 2031564 -352 -0.0
.text 1689136 1688784 -352 -0.0
mbed all-clusters-app CY8CPROTO_062_4343W+release (read/write) 2346888 2346824 -64 -0.0
.text 1309464 1309400 -64 -0.0
lighting-app CY8CPROTO_062_4343W+release (read/write) 2330496 2330432 -64 -0.0
.text 1293096 1293032 -64 -0.0
lock-app CY8CPROTO_062_4343W+release (read/write) 2303648 2303584 -64 -0.0
.text 1266248 1266184 -64 -0.0
shell CY8CPROTO_062_4343W+release (read/write) 2054432 2054368 -64 -0.0
.text 1017032 1016968 -64 -0.0
p6 all-clusters-app default (read/write) 2399760 2399712 -48 -0.0
.text 1358024 1357976 -48 -0.0
light-app default (read/write) 2323744 2323696 -48 -0.0
.text 1282008 1281960 -48 -0.0
lock-app default (read/write) 2295968 2295920 -48 -0.0
.text 1254232 1254184 -48 -0.0
Full report (32 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
platform target config section 19f61eb 25e873e change % change
efr32 lighting-app BRD4161A (read only) 828916 828916 0 0.0
(read/write) 126996 126996 0 0.0
.bss 125120 125120 0 0.0
.data 1876 1876 0 0.0
.text 828908 828908 0 0.0
BRD4161A+rpc (read only) 816112 816112 0 0.0
(read/write) 143656 143656 0 0.0
.bss 141680 141680 0 0.0
.data 1976 1976 0 0.0
.text 816104 816104 0 0.0
window-app BRD4161A (read only) 802380 802380 0 0.0
(read/write) 125936 125936 0 0.0
.bss 124104 124104 0 0.0
.data 1832 1832 0 0.0
.text 802372 802372 0 0.0
esp32 all-clusters-app c3devkit (read only) 890494 890438 -56 -0.0
(read/write) 1313594 1313594 0 0.0
.dram0.bss 69472 69472 0 0.0
.dram0.data 14244 14244 0 0.0
.flash.rodata 176816 176816 0 0.0
.flash.text 890494 890438 -56 -0.0
.iram0.text 62254 62254 0 0.0
m5stack (read only) 950619 950591 -28 -0.0
(read/write) 445204 445204 0 0.0
.dram0.bss 73968 73968 0 0.0
.dram0.data 34064 34064 0 0.0
.flash.rodata 206164 206164 0 0.0
.flash.text 945235 945207 -28 -0.0
.iram0.text 122671 122671 0 0.0
k32w light k32w061+release (read/write) 655316 655316 0 0.0
.bss 76776 76776 0 0.0
.data 1848 1848 0 0.0
.text 570892 570892 0 0.0
lock k32w061+release (read/write) 659656 659656 0 0.0
.bss 77072 77072 0 0.0
.data 1868 1868 0 0.0
.text 574916 574916 0 0.0
linux chip-tool-ipv6only arm64 (read only) 7109708 7109356 -352 -0.0
(read/write) 327041 327041 0 0.0
.bss 54865 54865 0 0.0
.data 1096 1096 0 0.0
.data.rel.ro 209264 209264 0 0.0
.dynamic 560 560 0 0.0
.got 58136 58136 0 0.0
.init 24 24 0 0.0
.init_array 168 168 0 0.0
.rodata 389860 389860 0 0.0
.text 6022996 6022644 -352 -0.0
thermostat-no-ble arm64 (read only) 2031916 2031564 -352 -0.0
(read/write) 145137 145137 0 0.0
.bss 64657 64657 0 0.0
.data 880 880 0 0.0
.data.rel.ro 72656 72656 0 0.0
.dynamic 560 560 0 0.0
.got 4008 4008 0 0.0
.init 24 24 0 0.0
.init_array 296 296 0 0.0
.rodata 129004 129004 0 0.0
.text 1689136 1688784 -352 -0.0
mbed all-clusters-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2346888 2346824 -64 -0.0
.bss 188716 188716 0 0.0
.data 5312 5312 0 0.0
.text 1309464 1309400 -64 -0.0
lighting-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2330496 2330432 -64 -0.0
.bss 180544 180544 0 0.0
.data 5552 5552 0 0.0
.text 1293096 1293032 -64 -0.0
lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2303648 2303584 -64 -0.0
.bss 179592 179592 0 0.0
.data 5544 5544 0 0.0
.text 1266248 1266184 -64 -0.0
pigweed-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 1139712 1139712 0 0.0
.bss 11756 11756 0 0.0
.data 4368 4368 0 0.0
.text 103096 103096 0 0.0
shell CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2054432 2054368 -64 -0.0
.bss 157060 157060 0 0.0
.data 4864 4864 0 0.0
.text 1017032 1016968 -64 -0.0
nrfconnect lighting-app nrf52840dk_nrf52840 (read/write) 938287 938287 0 0.0
bss 119232 119232 0 0.0
rodata 108156 108156 0 0.0
text 633348 633348 0 0.0
nrf52840dk_nrf52840+rpc (read/write) 923751 923751 0 0.0
bss 116276 116276 0 0.0
rodata 100604 100604 0 0.0
text 628700 628700 0 0.0
nrf52840dongle_nrf52840 (read/write) 988963 988963 0 0.0
bss 122076 122076 0 0.0
rodata 112908 112908 0 0.0
text 665544 665544 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 848142 848142 0 0.0
bss 116020 116020 0 0.0
rodata 101328 101328 0 0.0
text 550272 550272 0 0.0
lock-app nrf52840dk_nrf52840 (read/write) 910431 910431 0 0.0
bss 118420 118420 0 0.0
rodata 103428 103428 0 0.0
text 611212 611212 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 820498 820498 0 0.0
bss 115236 115236 0 0.0
rodata 96652 96652 0 0.0
text 528176 528176 0 0.0
pigweed-app nrf52840dk_nrf52840 (read/write) 541835 541835 0 0.0
bss 52588 52588 0 0.0
rodata 50104 50104 0 0.0
text 376940 376940 0 0.0
pump-app nrf52840dk_nrf52840 (read/write) 911707 911707 0 0.0
bss 118180 118180 0 0.0
rodata 103640 103640 0 0.0
text 612424 612424 0 0.0
pump-controller-app nrf52840dk_nrf52840 (read/write) 908511 908511 0 0.0
bss 118208 118208 0 0.0
rodata 102900 102900 0 0.0
text 609960 609960 0 0.0
shell nrf52840dk_nrf52840 (read/write) 798063 798063 0 0.0
bss 109768 109768 0 0.0
rodata 78180 78180 0 0.0
text 533608 533608 0 0.0
nrf5340dk_nrf5340_cpuapp (read/write) 710882 710882 0 0.0
bss 107656 107656 0 0.0
rodata 72484 72484 0 0.0
text 451288 451288 0 0.0
p6 all-clusters-app default (read/write) 2399760 2399712 -48 -0.0
.bss 116804 116804 0 0.0
.data 2592 2592 0 0.0
.text 1358024 1357976 -48 -0.0
light-app default (read/write) 2323744 2323696 -48 -0.0
.bss 105672 105672 0 0.0
.data 2384 2384 0 0.0
.text 1282008 1281960 -48 -0.0
lock-app default (read/write) 2295968 2295920 -48 -0.0
.bss 104552 104552 0 0.0
.data 2336 2336 0 0.0
.text 1254232 1254184 -48 -0.0
qpg lighting-app qpg6105+debug (read only) 533208 533208 0 0.0
(read/write) 146936 146936 0 0.0
.bss 86624 86624 0 0.0
.data 1004 1004 0 0.0
.text 527888 527888 0 0.0
lock-app qpg6105+debug (read only) 504984 504984 0 0.0
(read/write) 146940 146940 0 0.0
.bss 85760 85760 0 0.0
.data 952 952 0 0.0
.text 499664 499664 0 0.0
persistent-storage-app qpg6105+debug (read only) 106448 106448 0 0.0
(read/write) 146938 146938 0 0.0
.bss 36146 36146 0 0.0
.data 288 288 0 0.0
.text 101128 101128 0 0.0
telink lighting-app tlsr9518adk80d (read/write) 834566 834566 0 0.0
bss 86924 86924 0 0.0
noinit 37160 37160 0 0.0
text 582774 582774 0 0.0

@andy31415
Copy link
Contributor Author

fast track: trivial change in example code, has a checkmark and sufficient time passed for all timezone review.

@andy31415 andy31415 merged commit fa47b31 into project-chip:master Jan 11, 2022
step0035 pushed a commit to hank820/connectedhomeip that referenced this pull request Feb 8, 2022
* Fix SEGFAULT when running minmdns client

* Fix typo
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.

2 participants