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 multiple subscriptions to the same attribute in chip-tool. #18758

Merged
merged 1 commit into from
May 24, 2022

Conversation

bzbarsky-apple
Copy link
Contributor

Because the command object is the same for subscriptions to the same attribute, we were reusing the same mSubscribeClient unique_ptr for the new subscription, which killed off the old one.

The changes here are as follows:

  1. Keep track of a list of subscribe clients in InteractionModelReports.
  2. To fix a (pre-existing) issue where we would crash on exit from
    interactive mode if we had alive subscription, introduce a Cleanup
    function on CHIPCommand which is called either immediately after
    Shutdown or when we exit interactive mode, depending on what the
    command wants.
  3. Rearrange the attribute/event read/report commands to make sure we
    handle cleanup correctly and don't leak ReadClients (even
    temporarily, in the error cases).

Fixes #18245

Problem

See above.

Change overview

See above.

Testing

Used steps from #18245.

Because the command object is the same for subscriptions to the same attribute, we were reusing the same mSubscribeClient unique_ptr for the new subscription, which killed off the old one.

The changes here are as follows:

1) Keep track of a list of subscribe clients in InteractionModelReports.
2) To fix a (pre-existing) issue where we would crash on exit from
   interactive mode if we had alive subscription, introduce a Cleanup
   function on CHIPCommand which is called either immediately after
   Shutdown or when we exit interactive mode, depending on what the
   command wants.
3) Rearrange the attribute/event read/report commands to make sure we
   handle cleanup correctly and don't leak ReadClients (even
   temporarily, in the error cases).

Fixes project-chip#18245
@github-actions
Copy link

github-actions bot commented May 24, 2022

PR #18758: Size comparison from 7582608 to 7e30c37

Increases above 0.2%:

platform target config section 7582608 7e30c373 change % change
linux chip-tool debug (read only) 9490797 9557517 66720 0.7
(read/write) 579704 596856 17152 3.0
.bss 23936 24000 64 0.3
.data.rel.ro 548328 565400 17072 3.1
.text 7677685 7693573 15888 0.2
chip-tool-no-interactive-ipv6only arm64 (read only) 9234132 9297268 63136 0.7
(read/write) 645937 663009 17072 2.6
.data.rel.ro 583656 600712 17056 2.9
Increases (2 builds for linux)
platform target config section 7582608 7e30c373 change % change
linux chip-tool debug (read only) 9490797 9557517 66720 0.7
(read/write) 579704 596856 17152 3.0
.bss 23936 24000 64 0.3
.data.rel.ro 548328 565400 17072 3.1
.text 7677685 7693573 15888 0.2
chip-tool-no-interactive-ipv6only arm64 (read only) 9234132 9297268 63136 0.7
(read/write) 645937 663009 17072 2.6
.bss 42225 42241 16 0.0
.data.rel.ro 583656 600712 17056 2.9
.got 15016 15024 8 0.1
.text 7322180 7334308 12128 0.2
Full report (37 builds for cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
platform target config section 7582608 7e30c373 change % change
cc13x2_26x2 all-clusters-app LP_CC2652R7 (read only) 669447 669447 0 0.0
(read/write) 182408 182408 0 0.0
.bss 74836 74836 0 0.0
.data 3404 3404 0 0.0
.rodata 100783 100783 0 0.0
.text 568440 568440 0 0.0
lock-ftd LP_CC2652R7 (read only) 676199 676199 0 0.0
(read/write) 166648 166648 0 0.0
.bss 72884 72884 0 0.0
.data 3236 3236 0 0.0
.rodata 94679 94679 0 0.0
.text 581036 581036 0 0.0
lock-mtd LP_CC2652R7 (read only) 625607 625607 0 0.0
(read/write) 145716 145716 0 0.0
.bss 68620 68620 0 0.0
.data 3236 3236 0 0.0
.rodata 94559 94559 0 0.0
.text 530556 530556 0 0.0
pump-app LP_CC2652R7 (read only) 676075 676075 0 0.0
(read/write) 168196 168196 0 0.0
.bss 73284 73284 0 0.0
.data 3272 3272 0 0.0
.rodata 88899 88899 0 0.0
.text 586692 586692 0 0.0
pump-controller-app LP_CC2652R7 (read only) 654035 654035 0 0.0
(read/write) 189836 189836 0 0.0
.bss 73140 73140 0 0.0
.data 3232 3232 0 0.0
.rodata 83675 83675 0 0.0
.text 569880 569880 0 0.0
shell LP_CC2652R7 (read only) 662470 662470 0 0.0
(read/write) 184944 184944 0 0.0
.bss 77196 77196 0 0.0
.data 3408 3408 0 0.0
.rodata 97750 97750 0 0.0
.text 564492 564492 0 0.0
cyw30739 light cyw930739m2evb_01 (read/write) 624630 624630 0 0.0
.app_xip_area 527908 527908 0 0.0
.bss 79364 79364 0 0.0
.data 708 708 0 0.0
.rodata 0 0 0 0.0
.text 0 0 0 0.0
lock cyw930739m2evb_01 (read/write) 627298 627298 0 0.0
.app_xip_area 532048 532048 0 0.0
.bss 77924 77924 0 0.0
.data 672 672 0 0.0
.rodata 0 0 0 0.0
.text 0 0 0 0.0
ota-requestor-no-progress-logging cyw930739m2evb_01 (read/write) 571066 571066 0 0.0
.app_xip_area 466132 466132 0 0.0
.bss 87312 87312 0 0.0
.data 584 584 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
efr32 lighting-app BRD4161A (read only) 916036 916036 0 0.0
(read/write) 133452 133452 0 0.0
.bss 131392 131392 0 0.0
.data 2060 2060 0 0.0
.text 916028 916028 0 0.0
BRD4161A+rpc (read only) 950224 950224 0 0.0
(read/write) 150136 150136 0 0.0
.bss 147872 147872 0 0.0
.data 2264 2264 0 0.0
.text 950216 950216 0 0.0
BRD4161A+rs911x (read only) 790596 790596 0 0.0
(read/write) 129720 129720 0 0.0
.bss 127652 127652 0 0.0
.data 2068 2068 0 0.0
.text 790588 790588 0 0.0
lock-app BRD4161A+wf200 (read only) 947048 947048 0 0.0
(read/write) 124188 124188 0 0.0
.bss 122164 122164 0 0.0
.data 2024 2024 0 0.0
.text 947040 947040 0 0.0
window-app BRD4161A (read only) 897244 897244 0 0.0
(read/write) 133504 133504 0 0.0
.bss 131456 131456 0 0.0
.data 2048 2048 0 0.0
.text 897236 897236 0 0.0
esp32 all-clusters-app c3devkit (read only) 1002992 1002992 0 0.0
(read/write) 1479978 1479978 0 0.0
.dram0.bss 69392 69392 0 0.0
.dram0.data 14624 14624 0 0.0
.flash.rodata 210536 210536 0 0.0
.flash.text 1002992 1002992 0 0.0
.iram0.text 62954 62954 0 0.0
m5stack (read only) 1057795 1057795 0 0.0
(read/write) 481992 481992 0 0.0
.dram0.bss 74912 74912 0 0.0
.dram0.data 34200 34200 0 0.0
.flash.rodata 240884 240884 0 0.0
.flash.text 1052411 1052411 0 0.0
.iram0.text 123267 123267 0 0.0
k32w light k32w061+release (read/write) 682968 682968 0 0.0
.bss 80432 80432 0 0.0
.data 2016 2016 0 0.0
.text 598816 598816 0 0.0
lock k32w061+release (read/write) 728996 728996 0 0.0
.bss 80856 80856 0 0.0
.data 1976 1976 0 0.0
.text 644460 644460 0 0.0
linux all-clusters-app debug (read only) 2760297 2760297 0 0.0
(read/write) 178752 178752 0 0.0
.bss 86496 86496 0 0.0
.data 2064 2064 0 0.0
.data.rel.ro 84024 84024 0 0.0
.dynamic 608 608 0 0.0
.got 4496 4496 0 0.0
.init 27 27 0 0.0
.init_array 1016 1016 0 0.0
.rodata 241437 241437 0 0.0
.text 2344258 2344258 0 0.0
bridge-app debug+rpc (read only) 2035385 2035385 0 0.0
(read/write) 148440 148440 0 0.0
.bss 73184 73184 0 0.0
.data 3936 3936 0 0.0
.data.rel.ro 65736 65736 0 0.0
.dynamic 592 592 0 0.0
.got 4272 4272 0 0.0
.init 27 27 0 0.0
.init_array 688 688 0 0.0
.rodata 169065 169065 0 0.0
.text 1709202 1709202 0 0.0
chip-tool debug (read only) 9490797 9557517 66720 0.7
(read/write) 579704 596856 17152 3.0
.bss 23936 24000 64 0.3
.data 1152 1152 0 0.0
.data.rel.ro 548328 565400 17072 3.1
.dynamic 624 624 0 0.0
.got 5000 5000 0 0.0
.init 27 27 0 0.0
.init_array 656 656 0 0.0
.rodata 484957 484957 0 0.0
.text 7677685 7693573 15888 0.2
chip-tool-no-interactive-ipv6only arm64 (read only) 9234132 9297268 63136 0.7
(read/write) 645937 663009 17072 2.6
.bss 42225 42241 16 0.0
.data 1192 1192 0 0.0
.data.rel.ro 583656 600712 17056 2.9
.dynamic 560 560 0 0.0
.got 15016 15024 8 0.1
.init 24 24 0 0.0
.init_array 184 184 0 0.0
.rodata 448564 448564 0 0.0
.text 7322180 7334308 12128 0.2
lighting-app debug+rpc (read only) 2327737 2327737 0 0.0
(read/write) 154016 154016 0 0.0
.bss 74976 74976 0 0.0
.data 2048 2048 0 0.0
.data.rel.ro 71240 71240 0 0.0
.dynamic 608 608 0 0.0
.got 4344 4344 0 0.0
.init 27 27 0 0.0
.init_array 792 792 0 0.0
.rodata 188073 188073 0 0.0
.text 1973314 1973314 0 0.0
lock-app debug (read only) 2240593 2240593 0 0.0
(read/write) 148632 148632 0 0.0
.bss 73664 73664 0 0.0
.data 1568 1568 0 0.0
.data.rel.ro 67688 67688 0 0.0
.dynamic 592 592 0 0.0
.got 4336 4336 0 0.0
.init 27 27 0 0.0
.init_array 752 752 0 0.0
.rodata 198713 198713 0 0.0
.text 1881922 1881922 0 0.0
ota-provider-app debug (read only) 2065801 2065801 0 0.0
(read/write) 141456 141456 0 0.0
.bss 73088 73088 0 0.0
.data 1768 1768 0 0.0
.data.rel.ro 60792 60792 0 0.0
.dynamic 608 608 0 0.0
.got 4504 4504 0 0.0
.init 27 27 0 0.0
.init_array 648 648 0 0.0
.rodata 179872 179872 0 0.0
.text 1727362 1727362 0 0.0
ota-requestor-app debug (read only) 2094753 2094753 0 0.0
(read/write) 144264 144264 0 0.0
.bss 73760 73760 0 0.0
.data 1992 1992 0 0.0
.data.rel.ro 62856 62856 0 0.0
.dynamic 592 592 0 0.0
.got 4344 4344 0 0.0
.init 27 27 0 0.0
.init_array 672 672 0 0.0
.rodata 175840 175840 0 0.0
.text 1758882 1758882 0 0.0
shell debug (read only) 2576409 2576409 0 0.0
(read/write) 202776 202776 0 0.0
.bss 117416 117416 0 0.0
.data 1376 1376 0 0.0
.data.rel.ro 78224 78224 0 0.0
.dynamic 608 608 0 0.0
.got 4192 4192 0 0.0
.init 27 27 0 0.0
.init_array 936 936 0 0.0
.rodata 222418 222418 0 0.0
.text 2192770 2192770 0 0.0
thermostat-no-ble arm64 (read only) 2357644 2357644 0 0.0
(read/write) 177409 177409 0 0.0
.bss 88193 88193 0 0.0
.data 1520 1520 0 0.0
.data.rel.ro 79896 79896 0 0.0
.dynamic 560 560 0 0.0
.got 4768 4768 0 0.0
.init 24 24 0 0.0
.init_array 376 376 0 0.0
.rodata 147596 147596 0 0.0
.text 1981024 1981024 0 0.0
tv-app debug (read only) 2874185 2874185 0 0.0
(read/write) 280160 280160 0 0.0
.bss 191288 191288 0 0.0
.data 4672 4672 0 0.0
.data.rel.ro 77920 77920 0 0.0
.dynamic 592 592 0 0.0
.got 4728 4728 0 0.0
.init 27 27 0 0.0
.init_array 928 928 0 0.0
.rodata 221713 221713 0 0.0
.text 2470130 2470130 0 0.0
tv-casting-app debug (read only) 5451825 5451825 0 0.0
(read/write) 226880 226880 0 0.0
.bss 78936 78936 0 0.0
.data 2400 2400 0 0.0
.data.rel.ro 139336 139336 0 0.0
.dynamic 608 608 0 0.0
.got 4728 4728 0 0.0
.init 27 27 0 0.0
.init_array 864 864 0 0.0
.rodata 340929 340929 0 0.0
.text 4750178 4750178 0 0.0
mbed lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2419208 2419208 0 0.0
.bss 202860 202860 0 0.0
.data 5872 5872 0 0.0
.text 1381852 1381852 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read/write) 1184523 1184523 0 0.0
bss 139560 139560 0 0.0
rodata 153684 153684 0 0.0
text 812436 812436 0 0.0
p6 all-clusters-app default (read/write) 2541288 2541288 0 0.0
.bss 137360 137360 0 0.0
.data 2808 2808 0 0.0
.text 1499552 1499552 0 0.0
light-app default (read/write) 2424616 2424616 0 0.0
.bss 129696 129696 0 0.0
.data 2608 2608 0 0.0
.text 1382880 1382880 0 0.0
lock-app default (read/write) 2435176 2435176 0 0.0
.bss 129504 129504 0 0.0
.data 2568 2568 0 0.0
.text 1393440 1393440 0 0.0
telink light-switch-app tlsr9518adk80d (read/write) 782860 782860 0 0.0
bss 70828 70828 0 0.0
noinit 40416 40416 0 0.0
text 553468 553468 0 0.0
lighting-app tlsr9518adk80d (read/write) 802884 802884 0 0.0
bss 71080 71080 0 0.0
noinit 40416 40416 0 0.0
text 570202 570202 0 0.0

@andy31415 andy31415 merged commit dfd8e4e into project-chip:master May 24, 2022
@bzbarsky-apple bzbarsky-apple deleted the fix-chip-tool-subs branch May 24, 2022 18:33
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.

[TE9] [TC-IDM-4.2] Multiple subscriptions to the same attribute only generate a report for one subscription
3 participants