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 CASE Churn caused by subscriptions on tv #23616

Merged
merged 5 commits into from
Nov 24, 2022
Merged

Conversation

chrisdecenzo
Copy link
Contributor

@chrisdecenzo chrisdecenzo commented Nov 15, 2022

Fixes #23618 : CASE session churn observed when tv-casting-app creates subscriptions on tv-app.

  1. The subscription's ReportData was being sent on the ExchangeMgr tied to the static instance of the InteractionModel. Since tv-app is both a server and a controller, it has 2 ExchangeMgr's and so the one tied to the InterctionModel will not always be correct.

The fix here is to grab a reference to the ExchangeMgr used to create the subscription's ReadHandler and use that one to send the ReportData

  1. When the tv-casting-app creates more than one subscription, the second one was killing the first since the KeepSubscriptions param on the subscription creation command was taking its default value of false.

The fix here is to set this optional param to true.

@github-actions
Copy link

github-actions bot commented Nov 15, 2022

PR #23616: Size comparison from 6519b91 to a3e60cf

Increases (21 builds for cc13x2_26x2, cyw30739, efr32, nrfconnect, psoc6)
platform target config section 6519b91 a3e60cf change % change
cc13x2_26x2 all-clusters-app LP_CC2652R7 (read only) 678163 678179 16 0.0
.text 588000 588016 16 0.0
all-clusters-minimal-app LP_CC2652R7 (read only) 642459 642475 16 0.0
.text 563152 563168 16 0.0
lock-ftd LP_CC2652R7 (read only) 676295 676311 16 0.0
.text 598544 598560 16 0.0
lock-mtd LP_CC2652R7 (read only) 660819 660835 16 0.0
.text 557032 557048 16 0.0
pump-app LP_CC2652R7 (read only) 688743 688759 16 0.0
.text 597500 597516 16 0.0
pump-controller-app LP_CC2652R7 (read only) 673027 673051 24 0.0
.text 586240 586264 24 0.0
shell LP_CC2652R7 (read only) 669382 669398 16 0.0
.text 582468 582484 16 0.0
cyw30739 light cyw930739m2evb_01 (read/write) 587230 587246 16 0.0
.app_xip_area 463440 463456 16 0.0
lock cyw930739m2evb_01 (read/write) 591338 591354 16 0.0
.app_xip_area 462252 462268 16 0.0
ota-requestor-no-progress-logging cyw930739m2evb_01 (read/write) 543714 543730 16 0.0
.app_xip_area 425444 425460 16 0.0
efr32 lighting-app BRD4161A+rpc (read/write) 974172 974188 16 0.0
.text 819724 819740 16 0.0
BRD4161A+rs911x (read/write) 1034744 1034760 16 0.0
.text 845972 845988 16 0.0
BRD4187C (read/write) 1146576 1146592 16 0.0
.text 980808 980824 16 0.0
lock-app BRD4161A+wf200 (read/write) 1160144 1160160 16 0.0
.text 999836 999852 16 0.0
window-app BRD4187C (read/write) 1139812 1139828 16 0.0
.text 972604 972620 16 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read/write) 1187855 1187871 16 0.0
text 816982 816998 16 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 (read/write) 1167283 1167299 16 0.0
text 805532 805552 20 0.0
psoc6 all-clusters cy8ckit_062s2_43012 (read/write) 1746244 1746260 16 0.0
.debug_info 27023893 27023904 11 0.0
.text 1546480 1546496 16 0.0
all-clusters-minimal cy8ckit_062s2_43012 (read/write) 1688780 1688796 16 0.0
.debug_info 26760523 26760535 12 0.0
.text 1489752 1489768 16 0.0
light cy8ckit_062s2_43012 (read/write) 1606956 1606972 16 0.0
.debug_info 22225724 22225735 11 0.0
.text 1416112 1416128 16 0.0
lock cy8ckit_062s2_43012 (read/write) 1640964 1640980 16 0.0
.debug_info 22459348 22459358 10 0.0
.text 1445128 1445144 16 0.0
Decreases (10 builds for cc13x2_26x2, psoc6)
platform target config section 6519b91 a3e60cf change % change
cc13x2_26x2 all-clusters-app LP_CC2652R7 (read/write) 173372 173356 -16 -0.0
lock-ftd LP_CC2652R7 (read/write) 172808 172792 -16 -0.0
lock-mtd LP_CC2652R7 (read/write) 183540 183524 -16 -0.0
pump-app LP_CC2652R7 (read/write) 161096 161080 -16 -0.0
pump-controller-app LP_CC2652R7 (read/write) 176908 176884 -24 -0.0
shell LP_CC2652R7 (read/write) 184472 184456 -16 -0.0
psoc6 all-clusters cy8ckit_062s2_43012 .debug_line 3685941 3685935 -6 -0.0
.debug_loc 3603774 3603736 -38 -0.0
all-clusters-minimal cy8ckit_062s2_43012 .debug_line 3706925 3706919 -6 -0.0
.debug_loc 3591380 3591342 -38 -0.0
light cy8ckit_062s2_43012 .debug_line 3276050 3276044 -6 -0.0
.debug_loc 3288865 3288827 -38 -0.0
lock cy8ckit_062s2_43012 .debug_line 3273170 3273164 -6 -0.0
.debug_loc 3316718 3316680 -38 -0.0
Full report (22 builds for cc13x2_26x2, cyw30739, efr32, mbed, nrfconnect, psoc6)
platform target config section 6519b91 a3e60cf change % change
cc13x2_26x2 all-clusters-app LP_CC2652R7 (read only) 678163 678179 16 0.0
(read/write) 173372 173356 -16 -0.0
.bss 81228 81228 0 0.0
.data 3380 3380 0 0.0
.rodata 89851 89851 0 0.0
.text 588000 588016 16 0.0
all-clusters-minimal-app LP_CC2652R7 (read only) 642459 642475 16 0.0
(read/write) 157996 157996 0 0.0
.bss 80500 80500 0 0.0
.data 3380 3380 0 0.0
.rodata 78987 78987 0 0.0
.text 563152 563168 16 0.0
lock-ftd LP_CC2652R7 (read only) 676295 676311 16 0.0
(read/write) 172808 172792 -16 -0.0
.bss 78884 78884 0 0.0
.data 3304 3304 0 0.0
.rodata 77271 77271 0 0.0
.text 598544 598560 16 0.0
lock-mtd LP_CC2652R7 (read only) 660819 660835 16 0.0
(read/write) 183540 183524 -16 -0.0
.bss 74140 74140 0 0.0
.data 3304 3304 0 0.0
.rodata 103307 103307 0 0.0
.text 557032 557048 16 0.0
pump-app LP_CC2652R7 (read only) 688743 688759 16 0.0
(read/write) 161096 161080 -16 -0.0
.bss 78852 78852 0 0.0
.data 3296 3296 0 0.0
.rodata 90759 90759 0 0.0
.text 597500 597516 16 0.0
pump-controller-app LP_CC2652R7 (read only) 673027 673051 24 0.0
(read/write) 176908 176884 -24 -0.0
.bss 78948 78948 0 0.0
.data 3292 3292 0 0.0
.rodata 86307 86307 0 0.0
.text 586240 586264 24 0.0
shell LP_CC2652R7 (read only) 669382 669398 16 0.0
(read/write) 184472 184456 -16 -0.0
.bss 83548 83548 0 0.0
.data 3376 3376 0 0.0
.rodata 86598 86598 0 0.0
.text 582468 582484 16 0.0
cyw30739 light cyw930739m2evb_01 (read/write) 587230 587246 16 0.0
.app_xip_area 463440 463456 16 0.0
.bss 66208 66208 0 0.0
.data 728 728 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
lock cyw930739m2evb_01 (read/write) 591338 591354 16 0.0
.app_xip_area 462252 462268 16 0.0
.bss 71496 71496 0 0.0
.data 736 736 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
ota-requestor-no-progress-logging cyw930739m2evb_01 (read/write) 543714 543730 16 0.0
.app_xip_area 425444 425460 16 0.0
.bss 60736 60736 0 0.0
.data 684 684 0 0.0
.rodata 0 0 0 0.0
.text 112 112 0 0.0
efr32 lighting-app BRD4161A+rpc (read/write) 974172 974188 16 0.0
.bss 152260 152260 0 0.0
.data 2168 2168 0 0.0
.text 819724 819740 16 0.0
BRD4161A+rs911x (read/write) 1034744 1034760 16 0.0
.bss 186736 186736 0 0.0
.data 2012 2012 0 0.0
.text 845972 845988 16 0.0
BRD4187C (read/write) 1146576 1146592 16 0.0
.bss 138656 138656 0 0.0
.data 2516 2516 0 0.0
.text 980808 980824 16 0.0
lock-app BRD4161A+wf200 (read/write) 1160144 1160160 16 0.0
.bss 158264 158264 0 0.0
.data 2020 2020 0 0.0
.text 999836 999852 16 0.0
window-app BRD4187C (read/write) 1139812 1139828 16 0.0
.bss 140072 140072 0 0.0
.data 2540 2540 0 0.0
.text 972604 972620 16 0.0
mbed lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2452336 2452336 0 0.0
.bss 215012 215012 0 0.0
.data 5872 5872 0 0.0
.text 1414980 1414980 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read/write) 1187855 1187871 16 0.0
bss 145285 145285 0 0.0
rodata 144516 144516 0 0.0
text 816982 816998 16 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 (read/write) 1167283 1167299 16 0.0
bss 144512 144512 0 0.0
rodata 136304 136304 0 0.0
text 805532 805552 20 0.0
psoc6 all-clusters cy8ckit_062s2_43012 (read only) 841968 841968 0 0.0
(read/write) 1746244 1746260 16 0.0
.ARM.attributes 46 46 0 0.0
.ARM.exidx 8 8 0 0.0
.bss 188712 188712 0 0.0
.comment 204 204 0 0.0
.copy.table 24 24 0 0.0
.cy_m0p_image 6216 6216 0 0.0
.cy_sharedmem 8 8 0 0.0
.data 2664 2664 0 0.0
.debug_abbrev 1235716 1235716 0 0.0
.debug_aranges 110704 110704 0 0.0
.debug_frame 371284 371284 0 0.0
.debug_info 27023893 27023904 11 0.0
.debug_line 3685941 3685935 -6 -0.0
.debug_loc 3603774 3603736 -38 -0.0
.debug_ranges 339544 339544 0 0.0
.debug_str 3431051 3431051 0 0.0
.heap 841968 841968 0 0.0
.noinit 148 148 0 0.0
.ramVectors 736 736 0 0.0
.shstrtab 288 288 0 0.0
.stab 156 156 0 0.0
.stabstr 335 335 0 0.0
.stack_dummy 4096 4096 0 0.0
.strtab 570257 570257 0 0.0
.symtab 421440 421440 0 0.0
.text 1546480 1546496 16 0.0
.zero.table 8 8 0 0.0
text 0 0 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 (read only) 842704 842704 0 0.0
(read/write) 1688780 1688796 16 0.0
.ARM.attributes 46 46 0 0.0
.ARM.exidx 8 8 0 0.0
.bss 187976 187976 0 0.0
.comment 204 204 0 0.0
.copy.table 24 24 0 0.0
.cy_m0p_image 6216 6216 0 0.0
.cy_sharedmem 8 8 0 0.0
.data 2664 2664 0 0.0
.debug_abbrev 1227559 1227559 0 0.0
.debug_aranges 110176 110176 0 0.0
.debug_frame 374364 374364 0 0.0
.debug_info 26760523 26760535 12 0.0
.debug_line 3706925 3706919 -6 -0.0
.debug_loc 3591380 3591342 -38 -0.0
.debug_ranges 338160 338160 0 0.0
.debug_str 3420071 3420071 0 0.0
.heap 842704 842704 0 0.0
.noinit 148 148 0 0.0
.ramVectors 736 736 0 0.0
.shstrtab 288 288 0 0.0
.stab 156 156 0 0.0
.stabstr 335 335 0 0.0
.stack_dummy 4096 4096 0 0.0
.strtab 534346 534346 0 0.0
.symtab 407872 407872 0 0.0
.text 1489752 1489768 16 0.0
.zero.table 0 0 0 0.0
8 8 0 0.0
light cy8ckit_062s2_43012 (read only) 850888 850888 0 0.0
(read/write) 1606956 1606972 16 0.0
.ARM.attributes 46 46 0 0.0
.ARM.exidx 8 8 0 0.0
.bss 180000 180000 0 0.0
.comment 204 204 0 0.0
.copy.table 24 24 0 0.0
.cy_m0p_image 6216 6216 0 0.0
.cy_sharedmem 8 8 0 0.0
.data 2456 2456 0 0.0
.debug_abbrev 1062020 1062020 0 0.0
.debug_aranges 102376 102376 0 0.0
.debug_frame 344676 344676 0 0.0
.debug_info 22225724 22225735 11 0.0
.debug_line 3276050 3276044 -6 -0.0
.debug_loc 3288865 3288827 -38 -0.0
.debug_ranges 303440 303440 0 0.0
.debug_str 3225606 3225606 0 0.0
.heap 850888 850888 0 0.0
.noinit 148 148 0 0.0
.ramVectors 736 736 0 0.0
.shstrtab 288 288 0 0.0
.stab 156 156 0 0.0
.stabstr 335 335 0 0.0
.stack_dummy 4096 4096 0 0.0
.strtab 470671 470671 0 0.0
.symtab 376240 376240 0 0.0
.text 1416112 1416128 16 0.0
.zero.table 0 0 0 0.0
8 8 0 0.0
lock cy8ckit_062s2_43012 (read only) 845896 845896 0 0.0
(read/write) 1640964 1640980 16 0.0
.ARM.attributes 46 46 0 0.0
.ARM.exidx 8 8 0 0.0
.bss 184976 184976 0 0.0
.comment 204 204 0 0.0
.copy.table 24 24 0 0.0
.cy_m0p_image 6216 6216 0 0.0
.cy_sharedmem 8 8 0 0.0
.data 2472 2472 0 0.0
.debug_abbrev 1063995 1063995 0 0.0
.debug_aranges 102776 102776 0 0.0
.debug_frame 346552 346552 0 0.0
.debug_info 22459348 22459358 10 0.0
.debug_line 3273170 3273164 -6 -0.0
.debug_loc 3316718 3316680 -38 -0.0
.debug_ranges 305400 305400 0 0.0
.debug_str 3244977 3244977 0 0.0
.heap 845896 845896 0 0.0
.noinit 148 148 0 0.0
.ramVectors 736 736 0 0.0
.shstrtab 288 288 0 0.0
.stab 156 156 0 0.0
.stabstr 335 335 0 0.0
.stack_dummy 4096 4096 0 0.0
.strtab 473074 473074 0 0.0
.symtab 377936 377936 0 0.0
.text 1445128 1445144 16 0.0
.zero.table 0 0 0 0.0
8 8 0 0.0

@github-actions
Copy link

github-actions bot commented Nov 16, 2022

PR #23616: Size comparison from 6519b91 to 02a202e

Increases (6 builds for bl602, bl702, nrfconnect)
platform target config section 6519b91 02a202e change % change
bl602 lighting-app bl602 (read/write) 1375258 1375274 16 0.0
.text 1059186 1059204 18 0.0
bl602+rpc (read/write) 1421074 1421090 16 0.0
.text 1090680 1090696 16 0.0
bl702 lighting-app bl702 (read/write) 1195127 1195143 16 0.0
.debug_abbrev 1523919 1523951 32 0.0
.debug_info 39161306 39161332 26 0.0
.text 955516 955534 18 0.0
bl702+rpc (read/write) 1283267 1283283 16 0.0
.debug_abbrev 1667931 1667963 32 0.0
.debug_info 43430527 43430554 27 0.0
.text 1029212 1029232 20 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read/write) 1187855 1187887 32 0.0
text 816982 817002 20 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 (read/write) 1167283 1167299 16 0.0
text 805532 805552 20 0.0
Decreases (2 builds for bl702)
platform target config section 6519b91 02a202e change % change
bl702 lighting-app bl702 .debug_line 5271709 5271708 -1 -0.0
.debug_loc 3367110 3367091 -19 -0.0
bl702+rpc .debug_line 5667078 5667077 -1 -0.0
.debug_loc 3561346 3561342 -4 -0.0
Full report (9 builds for bl602, bl702, linux, mbed, nrfconnect)
platform target config section 6519b91 02a202e change % change
bl602 lighting-app bl602 (read/write) 1375258 1375274 16 0.0
.bss 90041 90041 0 0.0
.data 9984 9984 0 0.0
.text 1059186 1059204 18 0.0
bl602+rpc (read/write) 1421074 1421090 16 0.0
.bss 98081 98081 0 0.0
.data 10376 10376 0 0.0
.text 1090680 1090696 16 0.0
bl702 lighting-app bl702 (read only) 3262 3262 0 0.0
(read/write) 1195127 1195143 16 0.0
.bleromro 6296 6296 0 0.0
.bleromrw 124 124 0 0.0
.boot2 688 688 0 0.0
.bss 67166 67166 0 0.0
.bss_psram 30048 30048 0 0.0
.comment 48 48 0 0.0
.data 4048 4048 0 0.0
.debug_abbrev 1523919 1523951 32 0.0
.debug_aranges 132304 132304 0 0.0
.debug_frame 485212 485212 0 0.0
.debug_info 39161306 39161332 26 0.0
.debug_line 5271709 5271708 -1 -0.0
.debug_loc 3367110 3367091 -19 -0.0
.debug_ranges 360272 360272 0 0.0
.debug_str 3462160 3462160 0 0.0
.hbn 509 509 0 0.0
.hbn_noinit 260 260 0 0.0
.init 342 342 0 0.0
.init_array 144 144 0 0.0
.psram 0 0 0 0.0
.riscv.attributes 47 47 0 0.0
.rodata 116488 116488 0 0.0
.rsvd 3188 3188 0 0.0
.shstrtab 293 293 0 0.0
.stack 2048 2048 0 0.0
.strtab 566531 566531 0 0.0
.symtab 171808 171808 0 0.0
.tcm_data 36 36 0 0.0
.tcmcode 3262 3262 0 0.0
.text 0 0 0 0.0
955516 955534 18 0.0
bl702+rpc (read only) 3262 3262 0 0.0
(read/write) 1283267 1283283 16 0.0
.bleromro 6296 6296 0 0.0
.bleromrw 124 124 0 0.0
.boot2 688 688 0 0.0
.bss 75214 75214 0 0.0
.bss_psram 30320 30320 0 0.0
.comment 48 48 0 0.0
.data 4576 4576 0 0.0
.debug_abbrev 1667931 1667963 32 0.0
.debug_aranges 140368 140368 0 0.0
.debug_frame 512416 512416 0 0.0
.debug_info 43430527 43430554 27 0.0
.debug_line 5667078 5667077 -1 -0.0
.debug_loc 3561346 3561342 -4 -0.0
.debug_ranges 383296 383296 0 0.0
.debug_str 3859469 3859469 0 0.0
.hbn 509 509 0 0.0
.hbn_noinit 260 260 0 0.0
.init 342 342 0 0.0
.init_array 160 160 0 0.0
.psram 0 0 0 0.0
.riscv.attributes 47 47 0 0.0
.rodata 130120 130120 0 0.0
.rsvd 3188 3188 0 0.0
.shstrtab 293 293 0 0.0
.stack 2048 2048 0 0.0
.strtab 626746 626746 0 0.0
.symtab 189920 189920 0 0.0
.tcm_data 36 36 0 0.0
.tcmcode 3262 3262 0 0.0
.text 0 0 0 0.0
1029212 1029232 20 0.0
linux chip-tool-ipv6only arm64 (read only) 10433596 10433596 0 0.0
(read/write) 706353 706353 0 0.0
.bss 33905 33905 0 0.0
.data 2768 2768 0 0.0
.data.rel.ro 650672 650672 0 0.0
.dynamic 560 560 0 0.0
.got 13912 13912 0 0.0
.init 24 24 0 0.0
.init_array 208 208 0 0.0
.rodata 518220 518220 0 0.0
.text 8260020 8260020 0 0.0
thermostat-no-ble arm64 (read only) 2392812 2392812 0 0.0
(read/write) 143489 143489 0 0.0
.bss 55329 55329 0 0.0
.data 1816 1816 0 0.0
.data.rel.ro 77096 77096 0 0.0
.dynamic 560 560 0 0.0
.got 5176 5176 0 0.0
.init 24 24 0 0.0
.init_array 440 440 0 0.0
.rodata 144788 144788 0 0.0
.text 2004560 2004560 0 0.0
mbed lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2452336 2452336 0 0.0
.bss 215012 215012 0 0.0
.data 5872 5872 0 0.0
.text 1414980 1414980 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read/write) 1187855 1187887 32 0.0
bss 145285 145285 0 0.0
rodata 144516 144516 0 0.0
text 816982 817002 20 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 (read/write) 1167283 1167299 16 0.0
bss 144512 144512 0 0.0
rodata 136304 136304 0 0.0
text 805532 805552 20 0.0

@bzbarsky-apple bzbarsky-apple dismissed their stale review November 18, 2022 16:34

Removing changes requested so this is not blocked while I am on vacation

Copy link
Contributor

@mrjerryjohns mrjerryjohns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our stack is not at all built to deal with multiple instances of canonical singletons like ExchangeMgr, and a patch like this gives the semblance of fixing the problem, when in fact, the problem is much deeper.

ReadHandler adopting the ExchangeMgr alone is insufficient, since there are plenty of complex interactions that go through InteractionModelEngine and the ReportingEngine that results in them accessing again the ExchangeMgr instance behind the InteractionModelEngine.

The correct fix is one of two possibilities:

  1. Fix the stack to do away with the singleton nature of these entities, and permit true multi-instancing of the core state of the stack (not at all trivial).
  2. Live with the current constraints, and to achieve dual server/client modality, you dont need to instantiate multiple instances of these singletons. That is the approach most people have adopted (including us at Google).

Copy link
Contributor

@mrjerryjohns mrjerryjohns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving to unblock Chris in the short term, since he's committing to working on exploring a fix that involves running commissioner/server using a single instance of the singletons.

@chrisdecenzo chrisdecenzo merged commit 4115fc3 into master Nov 24, 2022
@chrisdecenzo chrisdecenzo deleted the tvapps-android31 branch November 24, 2022 14:24
sharadb-amazon pushed a commit to sharadb-amazon/connectedhomeip that referenced this pull request Nov 28, 2022
* Fix CASE Churn caused by subscriptions on tv

* Address comments

* User feature flag for IM fix since it only applies when both server and controller are enabled

* Address feedback

* fix build
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.

[BUG] CASE Session churn on tv-app subscriptions
6 participants