-
Notifications
You must be signed in to change notification settings - Fork 2.3k
[Python] fixed subscription crash #32257
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
[Python] fixed subscription crash #32257
Conversation
|
@tianfeng-yang I would suggest to use ShutdownSubscriptions from https://github.com/project-chip/connectedhomeip/blob/master/src/app/InteractionModelEngine.cpp#L296, and remove abort API. and leave the below unchanged. |
Changing the API like this is a bit extensive, and I can't confirm whether it will cause a chain reaction. |
|
PR #32257: Size comparison from a629204 to e10817e Full report (20 builds for cc13x4_26x4, cc32xx, nrfconnect, nxp, qpg, stm32, tizen)
|
|
PR #32257: Size comparison from a629204 to d5f2d56 Full report (88 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
|
NOTE on old PR staleness review: this PR seems to be under active development and could use some reviews. |
This reverts commit dcb4444.
This reimplements project-chip#32257 without reformatting Python files.
* [Python] After SubscriptionTransaction has an error, calling Shutdown() will crash * Add a comment * update comment
Fixed #32310
ReadClientlife cycle isOnDone. IfOnErrorhappend,OnDonewill eventually be executed. In the existing Python code,delete itis executed inOnDone. At this time,pCallbackandpReadClient(moved frompychip_ReadClient_Read) have both been deleted. , After that, if the python application executesSubscriptionTransaction.Shutdown()ordelete,pychip_ReadClient_Abortwill be executed, which will causepCallbackto be deleted again, causing the application to crash. Therefore, when callingShuddown()ordeleteon the python side, you need to determine whetherOnErrorhappend. IfOnErrorhappend, you do not need to callpychip_ReadClient_Abortagain. If not, it is a normal delete behavior on the application side.ReadClientalso describes that after deletingReadClient,OnDonewill not be executed, so we can directly deleteReadClientin the callback ofOnDone(the life cycle ofReadClienthas ended), so that there is no need to move the memory ofpReadClienttoReadClientCallbackinpychip_ReadClient_Read.@notes: There is no problem moving
ReadClienttopCallbackhere, butWriteClientCallbackis also not moved, just for consistency reasons.Follow the advice
The following two points are split into PR #32308
chip-toolGetSubscriptionTimeoutMsinterface to check if the subscription is alive.