-
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
KeyValueStoreMgr().Get() fails on Darwin #12174
Labels
Comments
rcasallas-silabs
changed the title
KeyValueStoreMgr().Get() fails on Darwing
KeyValueStoreMgr().Get() fails on Darwin
Nov 30, 2021
@sagar-apple Is this code you know about? Or does @pan-apple ? |
It's possible that #14233 will fix this. At least it fixes the above-pasted test for me.... |
bzbarsky-apple
added a commit
to bzbarsky-apple/connectedhomeip
that referenced
this issue
Jan 26, 2022
There were two remaining issues in the Darwin KVS impl that needed to be fixed to get this to pass: 1) The errors returned did not match the API documentation, which caused some consumers to fail. The most important problem here was returning CHIP_ERROR_KEY_NOT_FOUND instead of CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND from _Get, but I went ahead and aligned the other error cases (not initialized, buffer passed to _Get too small, deleting unknown key, failures to save to persistent storage) with the API documentation. 2) In _Put, if the item already existed the change of "value" was not being picked up by the NSManagedObject machinery, so updating the value of an already-existing key did not work. The fix for this is to use @dynamic instead of @synthesize for the properties of KeyValueItem (shamelessly copy/pasting from the documentation at https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/CoreData/LifeofaManagedObject.html), which I _think_ causes the getter/setter to be provided by the NSMnagedObject bits, which then know about the set we perform and know to update the data store. Fixes project-chip#12174
bzbarsky-apple
added a commit
to bzbarsky-apple/connectedhomeip
that referenced
this issue
Jan 26, 2022
There were two remaining issues in the Darwin KVS impl that needed to be fixed to get this to pass: 1) The errors returned did not match the API documentation, which caused some consumers to fail. The most important problem here was returning CHIP_ERROR_KEY_NOT_FOUND instead of CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND from _Get, but I went ahead and aligned the other error cases (not initialized, buffer passed to _Get too small, deleting unknown key, failures to save to persistent storage) with the API documentation. 2) In _Put, if the item already existed the change of "value" was not being picked up by the NSManagedObject machinery, so updating the value of an already-existing key did not work. The fix for this is to use @dynamic instead of @synthesize for the properties of KeyValueItem (shamelessly copy/pasting from the documentation at https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/CoreData/LifeofaManagedObject.html), which I _think_ causes the getter/setter to be provided by the NSMnagedObject bits, which then know about the set we perform and know to update the data store. Fixes project-chip#12174
bzbarsky-apple
added a commit
to bzbarsky-apple/connectedhomeip
that referenced
this issue
Jan 26, 2022
There were two remaining issues in the Darwin KVS impl that needed to be fixed to get this to pass: 1) The errors returned did not match the API documentation, which caused some consumers to fail. The most important problem here was returning CHIP_ERROR_KEY_NOT_FOUND instead of CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND from _Get, but I went ahead and aligned the other error cases (not initialized, buffer passed to _Get too small, deleting unknown key, failures to save to persistent storage) with the API documentation. 2) In _Put, if the item already existed the change of "value" was not being picked up by the NSManagedObject machinery, so updating the value of an already-existing key did not work. The fix for this is to use @dynamic instead of @synthesize for the properties of KeyValueItem (shamelessly copy/pasting from the documentation at https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/CoreData/LifeofaManagedObject.html), which I _think_ causes the getter/setter to be provided by the NSMnagedObject bits, which then know about the set we perform and know to update the data store. Fixes project-chip#12174
bzbarsky-apple
added a commit
to bzbarsky-apple/connectedhomeip
that referenced
this issue
Jan 27, 2022
There were two remaining issues in the Darwin KVS impl that needed to be fixed to get this to pass: 1) The errors returned did not match the API documentation, which caused some consumers to fail. The most important problem here was returning CHIP_ERROR_KEY_NOT_FOUND instead of CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND from _Get, but I went ahead and aligned the other error cases (not initialized, buffer passed to _Get too small, deleting unknown key, failures to save to persistent storage) with the API documentation. 2) In _Put, if the item already existed the change of "value" was not being picked up by the NSManagedObject machinery, so updating the value of an already-existing key did not work. The fix for this is to use @dynamic instead of @synthesize for the properties of KeyValueItem (shamelessly copy/pasting from the documentation at https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/CoreData/LifeofaManagedObject.html), which I _think_ causes the getter/setter to be provided by the NSMnagedObject bits, which then know about the set we perform and know to update the data store. Fixes project-chip#12174
bzbarsky-apple
added a commit
to bzbarsky-apple/connectedhomeip
that referenced
this issue
Jan 27, 2022
There were two remaining issues in the Darwin KVS impl that needed to be fixed to get this to pass: 1) The errors returned did not match the API documentation, which caused some consumers to fail. The most important problem here was returning CHIP_ERROR_KEY_NOT_FOUND instead of CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND from _Get, but I went ahead and aligned the other error cases (not initialized, buffer passed to _Get too small, deleting unknown key, failures to save to persistent storage) with the API documentation. 2) In _Put, if the item already existed the change of "value" was not being picked up by the NSManagedObject machinery, so updating the value of an already-existing key did not work. The fix for this is to use @dynamic instead of @synthesize for the properties of KeyValueItem (shamelessly copy/pasting from the documentation at https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/CoreData/LifeofaManagedObject.html), which I _think_ causes the getter/setter to be provided by the NSMnagedObject bits, which then know about the set we perform and know to update the data store. But even with this change things were failing with ASAN errors, so for now we just remove the old item and create a new one on every Put() call. Fixes project-chip#12174
bzbarsky-apple
added a commit
to bzbarsky-apple/connectedhomeip
that referenced
this issue
Jan 27, 2022
There were two remaining issues in the Darwin KVS impl that needed to be fixed to get this to pass: 1) The errors returned did not match the API documentation, which caused some consumers to fail. The most important problem here was returning CHIP_ERROR_KEY_NOT_FOUND instead of CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND from _Get, but I went ahead and aligned the other error cases (not initialized, buffer passed to _Get too small, deleting unknown key, failures to save to persistent storage) with the API documentation. 2) In _Put, if the item already existed the change of "value" was not being picked up by the NSManagedObject machinery, so updating the value of an already-existing key did not work. The fix for this is to use @dynamic instead of @synthesize for the properties of KeyValueItem (shamelessly copy/pasting from the documentation at https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/CoreData/LifeofaManagedObject.html), which I _think_ causes the getter/setter to be provided by the NSMnagedObject bits, which then know about the set we perform and know to update the data store. Fixes project-chip#12174
bzbarsky-apple
added a commit
that referenced
this issue
Jan 27, 2022
There were two remaining issues in the Darwin KVS impl that needed to be fixed to get this to pass: 1) The errors returned did not match the API documentation, which caused some consumers to fail. The most important problem here was returning CHIP_ERROR_KEY_NOT_FOUND instead of CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND from _Get, but I went ahead and aligned the other error cases (not initialized, buffer passed to _Get too small, deleting unknown key, failures to save to persistent storage) with the API documentation. 2) In _Put, if the item already existed the change of "value" was not being picked up by the NSManagedObject machinery, so updating the value of an already-existing key did not work. The fix for this is to use @dynamic instead of @synthesize for the properties of KeyValueItem (shamelessly copy/pasting from the documentation at https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/CoreData/LifeofaManagedObject.html), which I _think_ causes the getter/setter to be provided by the NSMnagedObject bits, which then know about the set we perform and know to update the data store. Fixes #12174
selissia
pushed a commit
to selissia/connectedhomeip
that referenced
this issue
Jan 28, 2022
There were two remaining issues in the Darwin KVS impl that needed to be fixed to get this to pass: 1) The errors returned did not match the API documentation, which caused some consumers to fail. The most important problem here was returning CHIP_ERROR_KEY_NOT_FOUND instead of CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND from _Get, but I went ahead and aligned the other error cases (not initialized, buffer passed to _Get too small, deleting unknown key, failures to save to persistent storage) with the API documentation. 2) In _Put, if the item already existed the change of "value" was not being picked up by the NSManagedObject machinery, so updating the value of an already-existing key did not work. The fix for this is to use @dynamic instead of @synthesize for the properties of KeyValueItem (shamelessly copy/pasting from the documentation at https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/CoreData/LifeofaManagedObject.html), which I _think_ causes the getter/setter to be provided by the NSMnagedObject bits, which then know about the set we perform and know to update the data store. Fixes project-chip#12174
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem
This behaviour has been observed on the Darwing implementation of KeyValueStoreMgr:
The following code illustrate the problem:
Proposed Solution
None so far.
The text was updated successfully, but these errors were encountered: