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

[IM] Handle internal fatal error in BufferReadCallback #36187

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yunhanw-google
Copy link
Contributor

@yunhanw-google yunhanw-google commented Oct 21, 2024

Revive #30965

Issue: If onError has been called from BufferedReadCallback when processing multiple attrbitues, potentially onError or onAttribute or onEvent could be called again from ReadClient, as a result, the behavior in application could be unexpected, crash is possible. note: the errors in BufferredReadCallback are treated as fatal ones.

Solution: In order to resolve the above issue, we introduce a new callback, CheckInternalError
We could set a flag in the buffered read callback that returns error for the next call from ReadClient, then we can call CheckInternalError after we handle onAttribute, and lead to a Error for ReadClient::Close and mpCallback.OnError, which also imply we can remove onError call inside BufferedReadCallback, and make sure onError should be called only with close path from readClient.

Copy link

semanticdiff-com bot commented Oct 21, 2024

Review changes with  SemanticDiff

@github-actions github-actions bot added the app label Oct 21, 2024
@yunhanw-google yunhanw-google force-pushed the feature/handle_error_BufferReaderCallback branch from f615c29 to a75bf72 Compare October 21, 2024 22:04
Copy link

github-actions bot commented Oct 21, 2024

PR #36187: Size comparison from 9ee0499 to 2167712

Full report (67 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
platform target config section 9ee0499 2167712 change % change
bl602 lighting-app bl602+mfd+littlefs+rpc FLASH 1350008 1350020 12 0.0
RAM 104120 104120 0 0.0
bl702 lighting-app bl702+eth FLASH 647788 647788 0 0.0
RAM 25233 25233 0 0.0
bl702+wifi FLASH 825274 825274 0 0.0
RAM 13965 13965 0 0.0
bl706+mfd+rpc+littlefs FLASH 1054200 1054200 0 0.0
RAM 23821 23821 0 0.0
bl702l lighting-app bl702l+mfd+littlefs FLASH 975048 975048 0 0.0
RAM 16468 16468 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 829564 829580 16 0.0
RAM 123452 123452 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 814872 814888 16 0.0
RAM 125332 125332 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 761460 761476 16 0.0
RAM 113824 113824 0 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 745704 745720 16 0.0
RAM 114016 114016 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 617258 617266 8 0.0
RAM 205908 205908 0 0.0
lock CC3235SF_LAUNCHXL FLASH 657306 657322 16 0.0
RAM 206060 206060 0 0.0
cyw30739 light CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 678589 678613 24 0.0
RAM 78668 78668 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 698433 698457 24 0.0
RAM 81300 81300 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 698433 698457 24 0.0
RAM 81300 81300 0 0.0
CYW930739M2EVB-02 unknown 2040 2040 0 0.0
FLASH 655377 655393 16 0.0
RAM 73736 73736 0 0.0
light-switch CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 614933 614973 40 0.0
RAM 71628 71628 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 634569 634601 32 0.0
RAM 74180 74180 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 634569 634601 32 0.0
RAM 74180 74180 0 0.0
lock CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 634213 634229 16 0.0
RAM 74676 74676 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 653921 653937 16 0.0
RAM 77228 77228 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 653921 653937 16 0.0
RAM 77228 77228 0 0.0
thermostat CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 609525 609541 16 0.0
RAM 68764 68764 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 629385 629401 16 0.0
RAM 71396 71396 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 629385 629401 16 0.0
RAM 71396 71396 0 0.0
efr32 lock-app BRD4187C FLASH 925248 925280 32 0.0
RAM 159708 159708 0 0.0
BRD4338a FLASH 741432 741440 8 0.0
RAM 231008 231008 0 0.0
window-app BRD4187C FLASH 1018236 1018236 0 0.0
RAM 128052 128052 0 0.0
esp32 all-clusters-app c3devkit DRAM 95256 95256 0 0.0
FLASH 1539960 1539978 18 0.0
IRAM 82538 82538 0 0.0
m5stack DRAM 116192 116192 0 0.0
FLASH 1550166 1550178 12 0.0
IRAM 117039 117039 0 0.0
linux air-purifier-app debug unknown 4688 4688 0 0.0
FLASH 2781331 2781479 148 0.0
RAM 129520 129520 0 0.0
all-clusters-app debug unknown 5528 5528 0 0.0
FLASH 6092456 6092660 204 0.0
RAM 523840 523856 16 0.0
all-clusters-minimal-app debug unknown 5424 5424 0 0.0
FLASH 5423032 5423180 148 0.0
RAM 242416 242416 0 0.0
bridge-app debug unknown 5408 5408 0 0.0
FLASH 4751960 4752108 148 0.0
RAM 218384 218384 0 0.0
chip-tool debug unknown 5960 5960 0 0.0
FLASH 13159438 13159962 524 0.0
RAM 584402 584554 152 0.0
chip-tool-ipv6only arm64 unknown 21408 21408 0 0.0
FLASH 11718768 11718928 160 0.0
RAM 635328 635480 152 0.0
fabric-admin debug unknown 5792 5792 0 0.0
FLASH 11388889 11389413 524 0.0
RAM 584794 584954 160 0.0
fabric-bridge-app debug unknown 4632 4632 0 0.0
FLASH 4578356 4578504 148 0.0
RAM 205336 205336 0 0.0
lighting-app debug+rpc+ui unknown 6056 6056 0 0.0
FLASH 5693889 5693889 0 0.0
RAM 228488 228488 0 0.0
lock-app debug unknown 5344 5344 0 0.0
FLASH 4801506 4801654 148 0.0
RAM 204472 204472 0 0.0
ota-provider-app debug unknown 4720 4720 0 0.0
FLASH 4430888 4431036 148 0.0
RAM 198192 198192 0 0.0
ota-requestor-app debug unknown 4656 4656 0 0.0
FLASH 4569660 4569808 148 0.0
RAM 202760 202760 0 0.0
shell debug unknown 4216 4216 0 0.0
FLASH 3115949 3116157 208 0.0
RAM 160368 160368 0 0.0
thermostat-no-ble arm64 unknown 9448 9448 0 0.0
FLASH 4319872 4319968 96 0.0
RAM 242896 242896 0 0.0
tv-app debug unknown 5624 5624 0 0.0
FLASH 6031989 6032453 464 0.0
RAM 596256 596304 48 0.0
tv-casting-app debug unknown 5208 5208 0 0.0
FLASH 11364621 11365053 432 0.0
RAM 675776 675888 112 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 915528 915552 24 0.0
RAM 143357 143357 0 0.0
nrf7002dk_nrf5340_cpuapp FLASH 885992 886012 20 0.0
RAM 141496 141496 0 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 FLASH 848936 848936 0 0.0
RAM 142265 142265 0 0.0
nxp contact k32w0+release FLASH 582296 582312 16 0.0
RAM 70948 70948 0 0.0
mcxw71+release FLASH 596928 596944 16 0.0
RAM 63184 63184 0 0.0
light k32w0+release FLASH 618932 618948 16 0.0
RAM 70412 70412 0 0.0
k32w1+release FLASH 683160 683176 16 0.0
RAM 48816 48816 0 0.0
lock mcxw71+release FLASH 746712 746728 16 0.0
RAM 67340 67340 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1647604 1647628 24 0.0
RAM 212408 212408 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1553684 1553700 16 0.0
RAM 209208 209208 0 0.0
light cy8ckit_062s2_43012 FLASH 1468004 1468020 16 0.0
RAM 201200 201200 0 0.0
lock cy8ckit_062s2_43012 FLASH 1464980 1464996 16 0.0
RAM 225560 225560 0 0.0
qpg lighting-app qpg6105+debug FLASH 660600 660616 16 0.0
RAM 105396 105396 0 0.0
lock-app qpg6105+debug FLASH 618612 618628 16 0.0
RAM 99864 99864 0 0.0
stm32 light STM32WB5MM-DK FLASH 481936 481952 16 0.0
RAM 144844 144844 0 0.0
telink bridge-app tlsr9258a FLASH 681164 681170 6 0.0
RAM 91304 91304 0 0.0
contact-sensor-app tlsr9528a_retention FLASH 620814 620820 6 0.0
RAM 50600 50600 0 0.0
light-switch-app-ota-shell-factory-data tlsr9528a FLASH 708794 708712 -82 -0.0
RAM 73940 73940 0 0.0
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 625764 625770 6 0.0
RAM 144468 144468 0 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 811772 811778 6 0.0
RAM 99100 99100 0 0.0
tizen all-clusters-app arm unknown 4912 4912 0 0.0
FLASH 1729708 1729784 76 0.0
RAM 90108 90116 8 0.0
chip-tool-ubsan arm unknown 10792 10792 0 0.0
FLASH 18324534 18324966 432 0.0
RAM 7969228 7969464 236 0.0

src/app/ReadClient.h Outdated Show resolved Hide resolved
@yunhanw-google yunhanw-google force-pushed the feature/handle_error_BufferReaderCallback branch 2 times, most recently from bb45a1c to 7a20bd8 Compare October 29, 2024 23:17
Copy link

github-actions bot commented Oct 29, 2024

PR #36187: Size comparison from fef41bd to 7a20bd8

Full report (3 builds for cc32xx, stm32)
platform target config section fef41bd 7a20bd83 change % change
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 625798 625798 0 0.0
RAM 206132 206132 0 0.0
lock CC3235SF_LAUNCHXL FLASH 665774 665774 0 0.0
RAM 206284 206284 0 0.0
stm32 light STM32WB5MM-DK FLASH 481392 481400 8 0.0
RAM 144844 144844 0 0.0

@yunhanw-google yunhanw-google force-pushed the feature/handle_error_BufferReaderCallback branch from 7a20bd8 to 44484ae Compare October 29, 2024 23:32
Copy link

github-actions bot commented Oct 29, 2024

PR #36187: Size comparison from fef41bd to 44484ae

Full report (68 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
platform target config section fef41bd 44484ae change % change
bl602 lighting-app bl602+mfd+littlefs+rpc FLASH 1349306 1349302 -4 -0.0
RAM 104120 104120 0 0.0
bl702 lighting-app bl702+eth FLASH 647028 647064 36 0.0
RAM 25233 25233 0 0.0
bl702+wifi FLASH 824592 824628 36 0.0
RAM 13965 13965 0 0.0
bl706+mfd+rpc+littlefs FLASH 1053582 1053618 36 0.0
RAM 23821 23821 0 0.0
bl702l lighting-app bl702l+mfd+littlefs FLASH 974366 974402 36 0.0
RAM 16468 16468 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 836124 836132 8 0.0
RAM 123676 123676 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 821768 821768 0 0.0
RAM 125556 125556 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 768476 768484 8 0.0
RAM 114048 114048 0 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 752720 752728 8 0.0
RAM 114240 114240 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 625798 625798 0 0.0
RAM 206132 206132 0 0.0
lock CC3235SF_LAUNCHXL FLASH 665774 665774 0 0.0
RAM 206284 206284 0 0.0
cyw30739 light CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 678085 678093 8 0.0
RAM 78692 78692 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 697937 697945 8 0.0
RAM 81324 81324 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 697937 697945 8 0.0
RAM 81324 81324 0 0.0
CYW930739M2EVB-02 unknown 2040 2040 0 0.0
FLASH 654873 654881 8 0.0
RAM 73760 73760 0 0.0
light-switch CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 614637 614661 24 0.0
RAM 71644 71644 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 634273 634297 24 0.0
RAM 74196 74196 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 634273 634297 24 0.0
RAM 74196 74196 0 0.0
lock CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 634149 634157 8 0.0
RAM 74692 74692 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 653857 653865 8 0.0
RAM 77244 77244 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 653857 653865 8 0.0
RAM 77244 77244 0 0.0
thermostat CYW30739B2-P5-EVK-01 unknown 2040 2040 0 0.0
FLASH 609429 609437 8 0.0
RAM 68780 68780 0 0.0
CYW30739B2-P5-EVK-02 unknown 2040 2040 0 0.0
FLASH 629281 629289 8 0.0
RAM 71412 71412 0 0.0
CYW30739B2-P5-EVK-03 unknown 2040 2040 0 0.0
FLASH 629281 629289 8 0.0
RAM 71412 71412 0 0.0
efr32 lock-app BRD4187C FLASH 926068 926068 0 0.0
RAM 159920 159920 0 0.0
BRD4338a FLASH 740568 740552 -16 -0.0
RAM 232580 232580 0 0.0
window-app BRD4187C FLASH 1017272 1017272 0 0.0
RAM 128264 128264 0 0.0
esp32 all-clusters-app c3devkit DRAM 95256 95256 0 0.0
FLASH 1537464 1537508 44 0.0
IRAM 82538 82538 0 0.0
m5stack DRAM 116192 116192 0 0.0
FLASH 1548126 1548126 0 0.0
IRAM 117039 117039 0 0.0
linux air-purifier-app debug unknown 4688 4688 0 0.0
FLASH 2731595 2731605 10 0.0
RAM 129616 129616 0 0.0
all-clusters-app debug unknown 5528 5528 0 0.0
FLASH 6021350 6021416 66 0.0
RAM 523872 523888 16 0.0
all-clusters-minimal-app debug unknown 5424 5424 0 0.0
FLASH 5358592 5358602 10 0.0
RAM 242448 242448 0 0.0
bridge-app debug unknown 5408 5408 0 0.0
FLASH 4700450 4700460 10 0.0
RAM 218400 218400 0 0.0
chip-tool debug unknown 5960 5960 0 0.0
FLASH 12901220 12901606 386 0.0
RAM 584466 584618 152 0.0
chip-tool-ipv6only arm64 unknown 21416 21416 0 0.0
FLASH 11029376 11029456 80 0.0
RAM 635400 635552 152 0.0
fabric-admin debug unknown 5792 5792 0 0.0
FLASH 11308753 11309139 386 0.0
RAM 584922 585114 192 0.0
fabric-bridge-app debug unknown 4632 4632 0 0.0
FLASH 4527502 4527512 10 0.0
RAM 205368 205368 0 0.0
fabric-sync debug unknown 4840 4840 0 0.0
FLASH 5239621 5239893 272 0.0
RAM 465432 465464 32 0.0
lighting-app debug+rpc+ui unknown 6056 6056 0 0.0
FLASH 5638961 5638961 0 0.0
RAM 228520 228520 0 0.0
lock-app debug unknown 5344 5344 0 0.0
FLASH 4748870 4748880 10 0.0
RAM 204520 204520 0 0.0
ota-provider-app debug unknown 4720 4720 0 0.0
FLASH 4375630 4375640 10 0.0
RAM 198240 198240 0 0.0
ota-requestor-app debug unknown 4656 4656 0 0.0
FLASH 4513870 4513880 10 0.0
RAM 202808 202808 0 0.0
shell debug unknown 4216 4216 0 0.0
FLASH 3048605 3048685 80 0.0
RAM 160336 160336 0 0.0
thermostat-no-ble arm64 unknown 9456 9456 0 0.0
FLASH 4117192 4117192 0 0.0
RAM 242936 242936 0 0.0
tv-app debug unknown 5624 5624 0 0.0
FLASH 5971893 5972197 304 0.0
RAM 596304 596352 48 0.0
tv-casting-app debug unknown 5208 5208 0 0.0
FLASH 11108589 11108877 288 0.0
RAM 694552 694664 112 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 913336 913348 12 0.0
RAM 143357 143357 0 0.0
nrf7002dk_nrf5340_cpuapp FLASH 884780 884804 24 0.0
RAM 141496 141496 0 0.0
all-clusters-minimal-app nrf52840dk_nrf52840 FLASH 847396 847396 0 0.0
RAM 142265 142265 0 0.0
nxp contact k32w0+release FLASH 582296 582312 16 0.0
RAM 71092 71092 0 0.0
mcxw71+release FLASH 596784 596784 0 0.0
RAM 63184 63184 0 0.0
light k32w0+release FLASH 618852 618868 16 0.0
RAM 70556 70556 0 0.0
k32w1+release FLASH 682936 682944 8 0.0
RAM 48816 48816 0 0.0
lock mcxw71+release FLASH 746560 746560 0 0.0
RAM 67340 67340 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1641508 1641500 -8 -0.0
RAM 212408 212408 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1549052 1549052 0 0.0
RAM 209208 209208 0 0.0
light cy8ckit_062s2_43012 FLASH 1465636 1465636 0 0.0
RAM 201200 201200 0 0.0
lock cy8ckit_062s2_43012 FLASH 1463300 1463300 0 0.0
RAM 225560 225560 0 0.0
qpg lighting-app qpg6105+debug FLASH 660304 660312 8 0.0
RAM 105420 105420 0 0.0
lock-app qpg6105+debug FLASH 618380 618380 0 0.0
RAM 99880 99880 0 0.0
stm32 light STM32WB5MM-DK FLASH 481392 481400 8 0.0
RAM 144844 144844 0 0.0
telink bridge-app tlsr9258a FLASH 680800 680832 32 0.0
RAM 91304 91304 0 0.0
contact-sensor-app tlsr9528a_retention FLASH 620426 620458 32 0.0
RAM 50600 50600 0 0.0
light-switch-app-ota-shell-factory-data tlsr9528a FLASH 708260 708204 -56 -0.0
RAM 73940 73940 0 0.0
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 625062 625094 32 0.0
RAM 144468 144468 0 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 811072 811104 32 0.0
RAM 99100 99100 0 0.0
tizen all-clusters-app arm unknown 4912 4912 0 0.0
FLASH 1712792 1712844 52 0.0
RAM 90140 90148 8 0.0
chip-tool-ubsan arm unknown 10792 10792 0 0.0
FLASH 1794227 17942654 384 0.0
RAM 7811564 7811840 276 0.0

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