-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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 java im sub crash #25505
Merged
yunhanw-google
merged 2 commits into
project-chip:master
from
yunhanw-google:feature/fix_java_im_sub
Mar 10, 2023
Merged
Fix java im sub crash #25505
yunhanw-google
merged 2 commits into
project-chip:master
from
yunhanw-google:feature/fix_java_im_sub
Mar 10, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PR #25505: Size comparison from a7cc2cf to eb5b85f Increases (1 build for cc32xx)
Full report (1 build for cc32xx)
|
yunhanw-google
force-pushed
the
feature/fix_java_im_sub
branch
from
March 7, 2023 09:40
eb5b85f
to
d24046e
Compare
PR #25505: Size comparison from fc0e4a2 to d24046e Full report (1 build for cc32xx)
|
yunhanw-google
force-pushed
the
feature/fix_java_im_sub
branch
from
March 7, 2023 18:52
d24046e
to
293d016
Compare
g-coppock
suggested changes
Mar 7, 2023
...ler/java/src/com/matter/controller/commands/pairing/PairOnNetworkLongImSubscribeCommand.java
Outdated
Show resolved
Hide resolved
...ler/java/src/com/matter/controller/commands/pairing/PairOnNetworkLongImSubscribeCommand.java
Outdated
Show resolved
Hide resolved
...ler/java/src/com/matter/controller/commands/pairing/PairOnNetworkLongImSubscribeCommand.java
Outdated
Show resolved
Hide resolved
...ler/java/src/com/matter/controller/commands/pairing/PairOnNetworkLongImSubscribeCommand.java
Outdated
Show resolved
Hide resolved
...ler/java/src/com/matter/controller/commands/pairing/PairOnNetworkLongImSubscribeCommand.java
Outdated
Show resolved
Hide resolved
...ler/java/src/com/matter/controller/commands/pairing/PairOnNetworkLongImSubscribeCommand.java
Outdated
Show resolved
Hide resolved
src/controller/java/src/chip/devicecontroller/ChipDeviceController.java
Outdated
Show resolved
Hide resolved
src/controller/java/src/chip/devicecontroller/ChipDeviceController.java
Outdated
Show resolved
Hide resolved
This was referenced Mar 8, 2023
joonhaengHeo
reviewed
Mar 8, 2023
yunhanw-google
force-pushed
the
feature/fix_java_im_sub
branch
from
March 8, 2023 00:40
ca631a7
to
c207e29
Compare
yunhanw-google
force-pushed
the
feature/fix_java_im_sub
branch
2 times, most recently
from
March 8, 2023 01:43
659a6cd
to
2a15f26
Compare
pullapprove
bot
requested review from
amitnj,
andy31415,
anush-apple,
arkq,
Byungjoo-Lee,
bzbarsky-apple,
carol-apple and
chrisdecenzo
March 8, 2023 01:44
yunhanw-google
force-pushed
the
feature/fix_java_im_sub
branch
3 times, most recently
from
March 9, 2023 06:32
1311c9a
to
d645d1f
Compare
PR #25505: Size comparison from ecd60f3 to d645d1f Increases (1 build for cc32xx)
Decreases (1 build for cc32xx)
Full report (4 builds for cc32xx, mbed, qpg)
|
bzbarsky-apple
requested changes
Mar 9, 2023
g-coppock
approved these changes
Mar 9, 2023
src/controller/java/src/chip/devicecontroller/ChipDeviceController.java
Outdated
Show resolved
Hide resolved
src/controller/java/src/chip/devicecontroller/ChipDeviceController.java
Outdated
Show resolved
Hide resolved
src/controller/java/src/chip/devicecontroller/ChipDeviceController.java
Outdated
Show resolved
Hide resolved
src/controller/java/src/chip/devicecontroller/ChipDeviceController.java
Outdated
Show resolved
Hide resolved
src/controller/java/src/chip/devicecontroller/ChipDeviceController.java
Outdated
Show resolved
Hide resolved
...id/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/SensorClientFragment.kt
Outdated
Show resolved
Hide resolved
yunhanw-google
force-pushed
the
feature/fix_java_im_sub
branch
from
March 10, 2023 10:36
d645d1f
to
174ec11
Compare
yunhanw-google
force-pushed
the
feature/fix_java_im_sub
branch
from
March 10, 2023 10:36
174ec11
to
c46c94b
Compare
yunhanw-google
requested review from
bzbarsky-apple
and removed request for
pjzander-signify
March 10, 2023 10:38
yunhanw-google
force-pushed
the
feature/fix_java_im_sub
branch
from
March 10, 2023 10:39
c46c94b
to
0f3029d
Compare
PR #25505: Size comparison from bdee2ef to 0f3029d Increases (1 build for cc32xx)
Decreases (1 build for cc32xx)
Full report (1 build for cc32xx)
|
When onDone is triggered from ShutdownSubscription API in android ui thread, RAII unlock in OnDone could cause context switch, then eventloop in matter would acquire the lock in matter thread, complete the work, switch back with the lock acquired from matter thread, then it delete readClient, and session, where it crash when it find the lock's thread id is different from ui thread. The fix is to move the stackUnlock after readClient delete operation. enable lock error detection
yunhanw-google
force-pushed
the
feature/fix_java_im_sub
branch
from
March 10, 2023 10:53
0f3029d
to
65f801f
Compare
PR #25505: Size comparison from bdee2ef to 65f801f Increases (1 build for cc32xx)
Decreases (1 build for cc32xx)
Full report (1 build for cc32xx)
|
bzbarsky-apple
approved these changes
Mar 10, 2023
pierredelisle
added a commit
to google-home/sample-apps-for-matter-android
that referenced
this pull request
Mar 10, 2023
- Pull in latest Matter SDK (SHA: 3c6bed3bb2) which includes required fixes for subscriptions (project-chip/connectedhomeip#25505, project-chip/connectedhomeip#25623, project-chip/connectedhomeip#25625) - Strip the .so's prior to copying them to jniLibs. libCHIPController.so now has a reasonable size (went from 352MB to 26MB). - Made SubscriptionHelper functions that interact with a device as "suspend" functions so that the coroutine scope is established by the caller. - Removed flag UNSUBSCRIBE_ENABLED since shutdownSubscriptions has now been fixed in the Matter SDK.
pierredelisle
added a commit
to google-home/sample-apps-for-matter-android
that referenced
this pull request
Mar 11, 2023
- Pull in latest Matter SDK (SHA: 3c6bed3bb2) which includes required fixes for subscriptions (project-chip/connectedhomeip#25505, project-chip/connectedhomeip#25623, project-chip/connectedhomeip#25625) - Strip the .so's prior to copying them to jniLibs. libCHIPController.so now has a reasonable size (went from 352MB to 26MB). - Made SubscriptionHelper functions that interact with a device as "suspend" functions so that the coroutine scope is established by the caller. - Removed flag UNSUBSCRIBE_ENABLED since shutdownSubscriptions has now been fixed in the Matter SDK.
lecndav
pushed a commit
to lecndav/connectedhomeip
that referenced
this pull request
Mar 22, 2023
* Fix java im sub crash * address comments When onDone is triggered from ShutdownSubscription API in android ui thread, RAII unlock in OnDone could cause context switch, then eventloop in matter would acquire the lock in matter thread, complete the work, switch back with the lock acquired from matter thread, then it delete readClient, and session, where it crash when it find the lock's thread id is different from ui thread. The fix is to move the stackUnlock after readClient delete operation. enable lock error detection
mwswartwout
pushed a commit
to mwswartwout/connectedhomeip
that referenced
this pull request
Mar 27, 2023
* Fix java im sub crash * address comments When onDone is triggered from ShutdownSubscription API in android ui thread, RAII unlock in OnDone could cause context switch, then eventloop in matter would acquire the lock in matter thread, complete the work, switch back with the lock acquired from matter thread, then it delete readClient, and session, where it crash when it find the lock's thread id is different from ui thread. The fix is to move the stackUnlock after readClient delete operation. enable lock error detection
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#24056
#25044
For active subscription, when we wanna tear down subscription, we need do two things,
When reviewing the Android/Java API,
When reviewing the darwin code, it seems we also only delete the pointer, it would shutdown subscription when shutdown commissioning.
In order to fix this issue, we need expose the right ShutdownInteraction API from interactionModelEngine to Java/JNI,
1, user needs explicitly call ShutdownSubscription, which further call ReadClient::Close, then destroy client in onDone
2. when fabric is removed, it trigger ReadClient::Close, then destroy client in onDone.
3. when Response timeout or liveness timeout happens, it trigger ReadClient::Close, then destroy client in onDone.
In addition, when onDone is triggered from ShutdownSubscription API in android ui
thread(it acquire lock immediately in ShutdownSubscription ), it further call onDone, but there is another RAII unlock in OnDone which could cause context switch, then eventloop in matter would
acquire the lock in matter thread(https://github.com/project-chip/connectedhomeip/blob/master/src/include/platform/internal/GenericPlatformManagerImpl_POSIX.ipp#L177), complete the work, switch back with
the lock acquired from matter thread, then it delete readClient, and
session, where crash happens when it find the lock's thread id is different
from ui thread since this new lock is from matter thread