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

the tv-app occurred native crash,when wrote onoff attribute #21708

Closed
nicelyjust opened this issue Aug 8, 2022 · 10 comments
Closed

the tv-app occurred native crash,when wrote onoff attribute #21708

nicelyjust opened this issue Aug 8, 2022 · 10 comments
Assignees
Labels
android crash tv TV-related features

Comments

@nicelyjust
Copy link
Contributor

nicelyjust commented Aug 8, 2022

Problem

the tv-app was commissioned by chip-tool,when i tested TC-OO-2.2, the tv-app occurred native crash:
app-onoff-error.txt
i found that if you execute app::Clusters::OnOff::Attributes::OnOff::Set(static_cast<chip::EndpointId>(endpoint), value);,the tv-app must be crashed

@nicelyjust
Copy link
Contributor Author

full log

@bzbarsky-apple bzbarsky-apple added android tv TV-related features labels Aug 8, 2022
@bzbarsky-apple
Copy link
Contributor

Relevant part of the log:

08-08 16:51:28.376 E/DL      (19400): Chip stack locking error at '../../examples/tv-app/android/third_party/connectedhomeip/src/app/util/attribute-storage.cpp:549'. Code is unsafe/racy
...
08-08 16:51:28.699 F/DEBUG   (19480):       #03 pc 00000000001be0cc  /data/app/~~RL33Ljpo3ELRX4IAaR5Ynw==/com.matter.tv.server-wX8VRolotStmt3f9FXbxyA==/lib/arm64/libTvApp.so (chip::Platform::Internal::AssertChipStackLockedByCurrentThread(char const*, int)+60)
08-08 16:51:28.699 F/DEBUG   (19480):       #04 pc 00000000000733f4  /data/app/~~RL33Ljpo3ELRX4IAaR5Ynw==/com.matter.tv.server-wX8VRolotStmt3f9FXbxyA==/lib/arm64/libTvApp.so (emAfReadOrWriteAttribute(EmberAfAttributeSearchRecord*, EmberAfAttributeMetadata const**, unsigned char*, unsigned short, bool)+80)
08-08 16:51:28.699 F/DEBUG   (19480):       #05 pc 000000000007577c  /data/app/~~RL33Ljpo3ELRX4IAaR5Ynw==/com.matter.tv.server-wX8VRolotStmt3f9FXbxyA==/lib/arm64/libTvApp.so (emAfWriteAttribute(unsigned short, unsigned int, unsigned int, unsigned char*, unsigned char, bool, bool)+140)
08-08 16:51:28.699 F/DEBUG   (19480):       #06 pc 0000000000075b74  /data/app/~~RL33Ljpo3ELRX4IAaR5Ynw==/com.matter.tv.server-wX8VRolotStmt3f9FXbxyA==/lib/arm64/libTvApp.so (emberAfWriteAttribute(unsigned short, unsigned int, unsigned int, unsigned char*, unsigned char)+72)
08-08 16:51:28.699 F/DEBUG   (19480):       #07 pc 00000000000820b4  /data/app/~~RL33Ljpo3ELRX4IAaR5Ynw==/com.matter.tv.server-wX8VRolotStmt3f9FXbxyA==/lib/arm64/libTvApp.so (chip::app::Clusters::OnOff::Attributes::OnOff::Set(unsigned short, bool)+124)
08-08 16:51:28.699 F/DEBUG   (19480):       #08 pc 000000000006bfc4  /data/app/~~RL33Ljpo3ELRX4IAaR5Ynw==/com.matter.tv.server-wX8VRolotStmt3f9FXbxyA==/lib/arm64/libTvApp.so (OnOffManager::SetOnOff(int, bool)+48)
08-08 16:51:28.699 F/DEBUG   (19480):       #09 pc 000000000006c664  /data/app/~~RL33Ljpo3ELRX4IAaR5Ynw==/com.matter.tv.server-wX8VRolotStmt3f9FXbxyA==/lib/arm64/libTvApp.so (Java_com_matter_tv_server_tvapp_TvApp_setOnOff+56)
08-08 16:51:28.699 F/DEBUG   (19480):       #10 pc 000000000013ced4  /apex/com.android.art/lib64/libart.so (art_quick_generic_jni_trampoline+148) (BuildId: 2cc47e90cab939f919f347ffb2e8950a)
08-08 16:51:28.699 F/DEBUG   (19480):       #11 pc 0000000000133564  /apex/com.android.art/lib64/libart.so (art_quick_invoke_stub+548) (BuildId: 2cc47e90cab939f919f347ffb2e8950a)
08-08 16:51:28.699 F/DEBUG   (19480):       #12 pc 00000000001a8a78  /apex/com.android.art/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+200) (BuildId: 2cc47e90cab939f919f347ffb2e8950a)

At first glance, OnOffManager::SetOnOff should be either taking locks or queuing things to the Matter thread.

@xylophone21 @chrisdecenzo

@nicelyjust
Copy link
Contributor Author

nicelyjust commented Aug 9, 2022

it seems be good through add stacklock lock

jboolean OnOffManager::SetOnOff(jint endpoint, bool value)
{
    chip::DeviceLayer::StackLock stack;
    EmberAfStatus status = app::Clusters::OnOff::Attributes::OnOff::Set(static_cast<chip::EndpointId>(endpoint), value);
    return status == EMBER_ZCL_STATUS_SUCCESS;
}

I'm not sure this is the correct way to solve the problem @bzbarsky-apple @chrisdecenzo @lazarkov

@bzbarsky-apple
Copy link
Contributor

That is certainly one valid way to solve the problem, yes.

@stale
Copy link

stale bot commented Mar 19, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the stale Stale issue or PR label Mar 19, 2023
@bzbarsky-apple bzbarsky-apple added crash and removed stale Stale issue or PR labels Mar 21, 2023
@stale
Copy link

stale bot commented Oct 15, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@yunhanw-google
Copy link
Contributor

@nicelyjust is this crash happening in latest code?

@chrisdecenzo
Copy link
Contributor

I will fix

@chrisdecenzo
Copy link
Contributor

should be fixed now

@chrisdecenzo chrisdecenzo removed their assignment Jan 20, 2024
@nicelyjust
Copy link
Contributor Author

yes,it's good now @yunhanw-google @chrisdecenzo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android crash tv TV-related features
Projects
Archived in project
Archived in project
Development

No branches or pull requests

5 participants