-
Notifications
You must be signed in to change notification settings - Fork 409
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
LwM2mObservationStore 'remove(Token token)' is not functionnal #1384
Comments
Thx for reporting this. 🙏 I take a look at this quickly and this smells not so good, you probably find a bug in I will first try to see if we have a unit test which should cover this. |
Ok we have test for this : (which is tested with Redis via RedisObserveTest) It use When you say :
I guess this is related to : But even if I'm curious to know how you reproduce it exactly. 😁 (Note that I also see the multiple call issue reported by #1385) Anyway, I will try to propose a fix for |
Thanks again for your analysis ! |
I created a PR about this #1388. @cyril2maq if you want you can take a look at it. (better to read it commit by commit I guess) |
This is not integrated in master 🙂 |
Version(s)
fa38111
Which components
leshan server
Tested With
No response
What happened
LwM2mObservationStore.remove(Token token) calls registrationStore.removeObservation(String registrationId, ObservationIdentifier observationId) : https://github.com/eclipse/leshan/blob/fa38111cf1d4787ead04bd04002c2df7cccc8dc1/leshan-server-cf/src/main/java/org/eclipse/leshan/server/californium/observation/LwM2mObservationStore.java#L95-L96
But it does call it with 'null' registrationId.
And RedisRegistrationStore 'needs' a non null registrationId as it uses it as lock; and does nothing if it does not exist :
https://github.com/eclipse/leshan/blob/fa38111cf1d4787ead04bd04002c2df7cccc8dc1/leshan-server-redis/src/main/java/org/eclipse/leshan/server/redis/RedisRegistrationStore.java#L557-L564
May be the bug is more on the RedisRegistrationStore side who could allow a null registrationId and still remove the observationId.
How to reproduce
Create a 'bad' Observation (e.g. unknown path) with a server using RedisRegistrationStore : the observation is not deleted from the store.
In this use case, the BaseMatcher.ObservationObserverAdapter.onResponse callback from californium library will call the LwM2mObservationStore.remove(Token token) method (due to the if (response.isError()...) l.332) wich will trigger no deletion as explained.
As a consequence, the Observation will still be registered in the store whereas it should have been deleted.
Relevant Output
No response
The text was updated successfully, but these errors were encountered: