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

[AddressResolver] Add a check in shutdown to avoid some crashes if so… #35824

Merged
merged 2 commits into from
Sep 27, 2024

Conversation

vivien-apple
Copy link
Contributor

…meone calls it multiple times

Problem

Some apps calls multiple times Shutdown on the resolver and it crashes a bit after since it tries to access a null pointer. It won't hurt much to just null check mSystemLayer and prevent doing the shutdown twice.

@vivien-apple vivien-apple self-assigned this Sep 27, 2024
Copy link

Review changes with SemanticDiff.

@andy31415
Copy link
Contributor

@vivien-apple could you update the summary to describe "what" applications do this? I can see an argument for the code to be tolerant to multiple shutdowns, however I would also have an argument that application behaviour should be well controlled and known. If they call shutdown multiple times, would they maybe call init multiple times? Should we guard the init as well or should we add logging when this out of order/extra calls are made?

Copy link

github-actions bot commented Sep 27, 2024

PR #35824: Size comparison from f509f67 to 8e2ed1d

Full report (88 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
platform target config section f509f67 8e2ed1d change % change
bl602 lighting-app bl602 FLASH 1280532 1280536 4 0.0
RAM 95848 95848 0 0.0
bl602+mfd FLASH 1294398 1294402 4 0.0
RAM 95992 95992 0 0.0
bl602+rpc FLASH 1320482 1320486 4 0.0
RAM 104272 104272 0 0.0
bl702 lighting-app bl702 FLASH 944362 944368 6 0.0
RAM 15145 15145 0 0.0
bl702+mfd FLASH 946762 946768 6 0.0
RAM 15305 15305 0 0.0
bl702+rpc FLASH 1039926 1039932 6 0.0
RAM 24173 24173 0 0.0
bl706-eth FLASH 646824 646830 6 0.0
RAM 25233 25233 0 0.0
bl706-wifi FLASH 894654 894660 6 0.0
RAM 14477 14477 0 0.0
bl702l lighting-app bl702l FLASH 961022 961028 6 0.0
RAM 16804 16804 0 0.0
bl702l+mfd FLASH 963644 963650 6 0.0
RAM 16964 16964 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 829380 829396 16 0.0
RAM 123300 123300 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 814424 814432 8 0.0
RAM 125172 125172 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 760420 760428 8 0.0
RAM 113664 113664 0 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 744656 744664 8 0.0
RAM 113856 113856 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 616202 616202 0 0.0
RAM 205396 205396 0 0.0
lock CC3235SF_LAUNCHXL FLASH 656258 656258 0 0.0
RAM 205548 205548 0 0.0
cyw30739 light CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 677757 677765 8 0.0
RAM 78516 78516 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 697601 697609 8 0.0
RAM 81148 81148 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 697601 697609 8 0.0
RAM 81148 81148 0 0.0
CYW930739M2EVB-02 unknown 2040 2040 0 0.0
FLASH 654537 654545 8 0.0
RAM 73584 73584 0 0.0
light-switch CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 613821 613829 8 0.0
RAM 71468 71468 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 633449 633457 8 0.0
RAM 74020 74020 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 633449 633457 8 0.0
RAM 74020 74020 0 0.0
lock CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 633117 633125 8 0.0
RAM 74516 74516 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 652825 652833 8 0.0
RAM 77068 77068 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 652825 652833 8 0.0
RAM 77068 77068 0 0.0
thermostat CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 608461 608469 8 0.0
RAM 68604 68604 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 628321 628329 8 0.0
RAM 71236 71236 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 628321 628329 8 0.0
RAM 71236 71236 0 0.0
efr32 lighting-app BRD4187C FLASH 933356 933356 0 0.0
RAM 135884 135884 0 0.0
lock-app BRD2605a FLASH 741024 741016 -8 -0.0
RAM 230240 230240 0 0.0
BRD4338a FLASH 741688 741680 -8 -0.0
RAM 230272 230272 0 0.0
window-app BRD4187C FLASH 1016440 1016432 -8 -0.0
RAM 127804 127804 0 0.0
esp32 all-clusters-app c3devkit DRAM 94080 94080 0 0.0
FLASH 1537628 1537644 16 0.0
IRAM 82538 82538 0 0.0
m5stack DRAM 115032 115032 0 0.0
FLASH 1548078 1548086 8 0.0
IRAM 117039 117039 0 0.0
linux air-purifier-app debug unknown 4688 4688 0 0.0
FLASH 2773595 2773611 16 0.0
RAM 129424 129424 0 0.0
all-clusters-app debug unknown 5528 5528 0 0.0
FLASH 6076992 6077008 16 0.0
RAM 507392 507392 0 0.0
all-clusters-minimal-app debug unknown 5424 5424 0 0.0
FLASH 5410584 5410600 16 0.0
RAM 241136 241136 0 0.0
bridge-app debug unknown 5408 5408 0 0.0
FLASH 4744274 4744290 16 0.0
RAM 218304 218304 0 0.0
chip-tool debug unknown 5960 5960 0 0.0
FLASH 12554724 12554740 16 0.0
RAM 555122 555122 0 0.0
chip-tool-ipv6only arm64 unknown 20512 20512 0 0.0
FLASH 11211744 11211776 32 0.0
RAM 605368 605368 0 0.0
fabric-admin debug unknown 5792 5792 0 0.0
FLASH 10916589 10916605 16 0.0
RAM 554266 554266 0 0.0
fabric-bridge-app debug unknown 4640 4640 0 0.0
FLASH 4567222 4567238 16 0.0
RAM 204888 204888 0 0.0
lighting-app debug+rpc+ui unknown 6056 6056 0 0.0
FLASH 5685217 5685233 16 0.0
RAM 228552 228552 0 0.0
lock-app debug unknown 5344 5344 0 0.0
FLASH 4793392 4793408 16 0.0
RAM 204376 204376 0 0.0
ota-provider-app debug unknown 4720 4720 0 0.0
FLASH 4423196 4423212 16 0.0
RAM 198112 198112 0 0.0
ota-requestor-app debug unknown 4656 4656 0 0.0
FLASH 4562040 4562056 16 0.0
RAM 202680 202680 0 0.0
shell debug unknown 4216 4216 0 0.0
FLASH 3103629 3103645 16 0.0
RAM 159184 159184 0 0.0
thermostat-no-ble arm64 unknown 9448 9448 0 0.0
FLASH 4312336 4312368 32 0.0
RAM 242808 242808 0 0.0
tv-app debug unknown 5624 5624 0 0.0
FLASH 6021653 6021669 16 0.0
RAM 580928 580928 0 0.0
tv-casting-app debug unknown 5208 5208 0 0.0
FLASH 10748989 10749005 16 0.0
RAM 643008 643008 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 913440 913448 8 0.0
RAM 142199 142199 0 0.0
nrf7002dk_nrf5340_cpuapp FLASH 885020 885032 12 0.0
RAM 140338 140338 0 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 FLASH 846948 846960 12 0.0
RAM 141093 141093 0 0.0
nxp contact k32w0+release FLASH 581760 581776 16 0.0
RAM 70776 70776 0 0.0
k32w1+release FLASH 595664 595680 16 0.0
RAM 62992 62992 0 0.0
mcxw71+release FLASH 595416 595432 16 0.0
RAM 62992 62992 0 0.0
light k32w0+release FLASH 617812 617812 0 0.0
RAM 70248 70248 0 0.0
k32w1+release FLASH 681624 681632 8 0.0
RAM 48632 48632 0 0.0
mcxw71+release FLASH 681640 681648 8 0.0
RAM 48632 48632 0 0.0
lock k32w1+release FLASH 703944 703952 8 0.0
RAM 67132 67132 0 0.0
mcxw71+release FLASH 703968 703976 8 0.0
RAM 67132 67132 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1645380 1645380 0 0.0
RAM 210888 210888 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1551364 1551380 16 0.0
RAM 207688 207688 0 0.0
light cy8ckit_062s2_43012 FLASH 1467180 1467196 16 0.0
RAM 200696 200696 0 0.0
lock cy8ckit_062s2_43012 FLASH 1463924 1463940 16 0.0
RAM 225048 225048 0 0.0
qpg lighting-app qpg6105+debug FLASH 659512 659520 8 0.0
RAM 105236 105236 0 0.0
lock-app qpg6105+debug FLASH 617476 617484 8 0.0
RAM 99704 99704 0 0.0
stm32 light STM32WB5MM-DK FLASH 481072 481080 8 0.0
RAM 144692 144692 0 0.0
telink air-quality-sensor-app tlsr9528a_retention FLASH 620082 620088 6 0.0
RAM 50988 50988 0 0.0
all-clusters-app tlsr9118bdk40d FLASH 687314 687320 6 0.0
RAM 148328 148328 0 0.0
all-clusters-minimal-app tlsr9528a FLASH 780248 780254 6 0.0
RAM 110780 110780 0 0.0
bridge-app tlsr9258a FLASH 681084 681090 6 0.0
RAM 91644 91644 0 0.0
contact-sensor-app tlsr9528a_retention FLASH 619844 619850 6 0.0
RAM 50940 50940 0 0.0
light-switch-app-ota-shell-factory-data tlsr9528a FLASH 707786 707792 6 0.0
RAM 74280 74280 0 0.0
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 624806 624812 6 0.0
RAM 144316 144316 0 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 810458 810464 6 0.0
RAM 99448 99448 0 0.0
lock-app-dfu tlsr9528a FLASH 655690 655696 6 0.0
RAM 67000 67000 0 0.0
ota-requestor-app tlsr9258a FLASH 697060 697066 6 0.0
RAM 91236 91236 0 0.0
pump-app-usb tlsr9518adk80d FLASH 633468 633474 6 0.0
RAM 55816 55816 0 0.0
pump-controller-app tlsr9518adk80d FLASH 610658 610664 6 0.0
RAM 53060 53060 0 0.0
shell tlsr9518adk80d FLASH 467336 467342 6 0.0
RAM 68668 68668 0 0.0
smoke_co_alarm-app tlsr9528a_retention FLASH 626974 626980 6 0.0
RAM 52660 52660 0 0.0
temperature-measurement-app-mars-ota tlsr9518adk80d FLASH 652794 652800 6 0.0
RAM 56608 56608 0 0.0
thermostat tlsr9518adk80d FLASH 637388 637394 6 0.0
RAM 53452 53452 0 0.0
window-covering tlsr9118bdk40d FLASH 523574 523580 6 0.0
RAM 97284 97284 0 0.0
tizen all-clusters-app arm unknown 4904 4904 0 0.0
FLASH 1724244 1724256 12 0.0
RAM 89076 89076 0 0.0
chip-tool-ubsan arm unknown 10344 10344 0 0.0
FLASH 17357954 17358034 80 0.0
RAM 7562996 7563028 32 0.0

@mergify mergify bot merged commit 941c1d2 into project-chip:master Sep 27, 2024
69 checks passed
yyzhong-g pushed a commit to yyzhong-g/connectedhomeip that referenced this pull request Dec 12, 2024
project-chip#35824)

* [AddressResolver] Add a check in shutdown to avoid some crashes if someone calls it multiple times

* Apply suggestion from code review.

Co-authored-by: Andrei Litvin <[email protected]>

---------

Co-authored-by: Boris Zbarsky <[email protected]>
Co-authored-by: Andrei Litvin <[email protected]>
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.

3 participants