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:When reading's value is string type, it will be released prematurely #506

Merged
merged 1 commit into from
Jan 16, 2024

Conversation

ych988
Copy link
Contributor

@ych988 ych988 commented Jan 2, 2024

When reading's value is string type, it will be released prematurely.

ae_runner → edgex_data_process_event → devsdk_commandresult_free
string of IOT_DATA_REF will be release prematurely by devsdk_commandresult_free

@ych988
Copy link
Contributor Author

ych988 commented Jan 2, 2024

Issue #493

@FelixTing
Copy link
Member

@ych988 Please add "fix: " at the beginning of the commit message to pass Semantic PR checks.

In addition, EdgeXFoundry currently requires signed commit. For instructions on setting up a GPG key for signing commits, see https://wiki.edgexfoundry.org/display/FA/Secrets+of+GitHub+Signing%2C+Keys+and+Commits+Setup.

@FelixTing
Copy link
Member

String values with ownership IOT_DATA_REF will not be freed by devsdk_commandresult_free. @iain-anderson Please correct me if I am wrong.

@ych988 Could you please provide steps to reproduce the issue and describe the scenario in which the problem occurred?

@ych988
Copy link
Contributor Author

ych988 commented Jan 3, 2024

This problem is not easy to reproduce. Because if the released memory data area is not overwritten when data is uploaded, the problem will not occur.
Steps:
1 Prepare a resource which attributes are R/W.
2 Events triggered by ae_runner are reported regularly.
3 Send write events on the web page.
Scenario:
The reading will be garbled character if the released memory data area is overwrittren.

@FelixTing
Copy link
Member

@ych988 May I ask which EdgeX device service you are using?

@ych988
Copy link
Contributor Author

ych988 commented Jan 3, 2024

Sorry, My service depends on the device environment. This might be useful. [
HikPlatFaceAcsCtrProfile.json
](url)

"name": "doorStatusCtr",

@FelixTing
Copy link
Member

Thanks for the information. I will test this with an existing edgex device service.

@FelixTing
Copy link
Member

Verified this fix with device-bacnet. This fix also applies to GET commands for string type resources.

Copy link
Member

@FelixTing FelixTing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@FelixTing FelixTing merged commit c533cd2 into edgexfoundry:main Jan 16, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants