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 KeepSubscription flag handling #22805

Merged
merged 2 commits into from
Sep 23, 2022

Conversation

mrjerryjohns
Copy link
Contributor

@mrjerryjohns mrjerryjohns commented Sep 21, 2022

Fixes #22774

This fixes the KeepSubscription flag handling to be done right at the onset of processing a SubscribeRequest message as per the spec. This ensures that matching existing subscriptions are evicted before we attempt to continue further processing and allocation of ReadHandlers.

This also removes logic in ReadClient that checks we have at least some paths in the request. By removing this bit of logic, it permits subscriptions with empty paths to be sent to effect a 'cancel subscription' operation of sorts. The validation of that will now happen server-side and an IM error will be sent back, but this can be used to cancel any prior subscriptions on the target.

Testing:

In addition to the new test in TestRead, validated setting up a sub in chip-tool and then cancelling it by sending another sub to an invalid endpoint:

basic subscribe location  0 5 2 0
any subscribe-by-id 0xFFFFFFFF 0xFFFFFFFF 0 5 2 100

Also tested by sending an empty subscribe request with the REPL.

This fixes the KeepSubscription flag handling to be done right at the
onset of processing a SubscribeRequest message. This ensures that
matching existing subscriptions are evicted before we attempt to
continue further processing and allocation of ReadHandlers.

Testing:

In addition to the new test in TestRead, validated setting up a sub in
chip-tool and then cancelling it by sending another sub to an invalid
endpoint:

basic subscribe location  0 5 2 0
any subscribe-by-id 0xFFFFFFFF 0xFFFFFFFF 0 5 2 100

Also tested by sending an empty subscribe request with the REPL.
@mrjerryjohns mrjerryjohns force-pushed the fix-keepalive-flag-final branch from dd0dc99 to be34d23 Compare September 21, 2022 21:13
@github-actions
Copy link

github-actions bot commented Sep 21, 2022

PR #22805: Size comparison from 388c27c to be34d23

Increases (11 builds for bl602, esp32, linux, nrfconnect, telink)
platform target config section 388c27c be34d23 change % change
bl602 lighting-app bl602 (read/write) 1383310 1383434 124 0.0
.text 1064954 1065046 92 0.0
bl602+rpc (read/write) 1428506 1428638 132 0.0
.text 1096302 1096396 94 0.0
esp32 all-clusters-app c3devkit (read only) 1222926 1222960 34 0.0
(read/write) 1788046 1788086 40 0.0
.flash.rodata 257616 257656 40 0.0
.flash.text 1222926 1222960 34 0.0
m5stack (read only) 1232991 1233003 12 0.0
(read/write) 563940 563980 40 0.0
.flash.rodata 314672 314712 40 0.0
.flash.text 1227607 1227619 12 0.0
linux chip-tool-ipv6only arm64 (read only) 10361076 10361092 16 0.0
.rodata 505940 505972 32 0.0
thermostat-no-ble arm64 (read only) 2387420 2387452 32 0.0
.rodata 143636 143684 48 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read/write) 1182835 1182903 68 0.0
rodata 144196 144232 36 0.0
text 815288 815316 28 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 (read/write) 1161487 1161539 52 0.0
rodata 135768 135804 36 0.0
text 803160 803184 24 0.0
telink light-switch-app tlsr9518adk80d (read/write) 814468 814536 68 0.0
text 574568 574600 32 0.0
lighting-app tlsr9518adk80d (read/write) 836572 836640 68 0.0
text 592788 592820 32 0.0
ota-requestor-app tlsr9518adk80d (read/write) 844532 844600 68 0.0
text 598970 599002 32 0.0
Decreases (2 builds for linux)
platform target config section 388c27c be34d23 change % change
linux chip-tool-ipv6only arm64 .text 8201140 8201124 -16 -0.0
thermostat-no-ble arm64 .text 2001472 2001456 -16 -0.0
Full report (11 builds for bl602, esp32, linux, nrfconnect, telink)
platform target config section 388c27c be34d23 change % change
bl602 lighting-app bl602 (read/write) 1383310 1383434 124 0.0
.bss 89537 89537 0 0.0
.data 9816 9816 0 0.0
.text 1064954 1065046 92 0.0
bl602+rpc (read/write) 1428506 1428638 132 0.0
.bss 96969 96969 0 0.0
.data 10200 10200 0 0.0
.text 1096302 1096396 94 0.0
esp32 all-clusters-app c3devkit (read only) 1222926 1222960 34 0.0
(read/write) 1788046 1788086 40 0.0
.dram0.bss 76944 76944 0 0.0
.dram0.data 13840 13840 0 0.0
.flash.rodata 257616 257656 40 0.0
.flash.text 1222926 1222960 34 0.0
.iram0.text 65204 65204 0 0.0
m5stack (read only) 1232991 1233003 12 0.0
(read/write) 563940 563980 40 0.0
.dram0.bss 82304 82304 0 0.0
.dram0.data 34296 34296 0 0.0
.flash.rodata 314672 314712 40 0.0
.flash.text 1227607 1227619 12 0.0
.iram0.text 123939 123939 0 0.0
linux chip-tool-ipv6only arm64 (read only) 10361076 10361092 16 0.0
(read/write) 706273 706273 0 0.0
.bss 33953 33953 0 0.0
.data 2864 2864 0 0.0
.data.rel.ro 650560 650560 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 505940 505972 32 0.0
.text 8201140 8201124 -16 -0.0
thermostat-no-ble arm64 (read only) 2387420 2387452 32 0.0
(read/write) 143649 143649 0 0.0
.bss 55361 55361 0 0.0
.data 1912 1912 0 0.0
.data.rel.ro 77208 77208 0 0.0
.dynamic 560 560 0 0.0
.got 5192 5192 0 0.0
.init 24 24 0 0.0
.init_array 440 440 0 0.0
.rodata 143636 143684 48 0.0
.text 2001472 2001456 -16 -0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read/write) 1182835 1182903 68 0.0
bss 144433 144433 0 0.0
rodata 144196 144232 36 0.0
text 815288 815316 28 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 (read/write) 1161487 1161539 52 0.0
bss 143660 143660 0 0.0
rodata 135768 135804 36 0.0
text 803160 803184 24 0.0
telink light-switch-app tlsr9518adk80d (read/write) 814468 814536 68 0.0
bss 72172 72172 0 0.0
noinit 43488 43488 0 0.0
text 574568 574600 32 0.0
lighting-app tlsr9518adk80d (read/write) 836572 836640 68 0.0
bss 73028 73028 0 0.0
noinit 43488 43488 0 0.0
text 592788 592820 32 0.0
ota-requestor-app tlsr9518adk80d (read/write) 844532 844600 68 0.0
bss 73936 73936 0 0.0
noinit 43488 43488 0 0.0
text 598970 599002 32 0.0

@andy31415 andy31415 merged commit 61b9498 into project-chip:master Sep 23, 2022
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] KeepExistingSubscriptions flag is not being handled correctly
3 participants