-
Notifications
You must be signed in to change notification settings - Fork 52
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
Empty Response to a Read operation #579
Comments
In LWM2M in addition of the sentence you share I found about that it :
(In Data Formats for Transferring Resource Information in LWM2M v1.0.2, 1.1.1, 1.2.1) I looked at CoAP RFC and only found :
So I guess this depends a lot if you consider your response contains "no payload" or an "empty payload" which is the result of chosen encoding format. From my point of view, a 2.05 response is "a representation of the target resource" (like explained in CoAP RFC) in a given content format. Sometime this lead to empty byte[] or empty string but this is still the result of a given encoding format. I checked how behave Leshan and it reject 2.05 response without content format and it does not always encode "no lwm2m node" with an empty payload. (e.g. for SenML it returns an empty array "[]") |
What was the interoperability issue exactly ? |
It just so happens that a Leshan-based Server is returning an error "Invalid Response: Unable to decode response payload" when receiving a CoAP response with no payload and no Content-format option ;) And in some cases, it also fails even if a content-format is present. |
😅 OK so now you get the reason (#579 (comment)) Technically we get the decoder from given content format. (We have 1 decoder by content format) But if OMA clarifies that I guess we can adapt Leshan code.
This one is maybe a bug ? do you have more details ? (maybe we should continue that point in a Leshan issue ?) |
|
Per OMA DMSO discussion, should this return 2.04 instead and we clarify how to handle 2.05 response with no content |
is this a question ? OR do you mean that a READ Response should be a 2.04 ? AFAIK, this doesn't follow CoAP RFC... a READ request (so a CoAP GET) should only accept 2.05 Content as successful response. Eventually, 2.03 Valid but this is only when ETAG is used and value doesn't change since last GET, so this is out of topic here. |
I rethink about that and if we strictly follow SenML spec, I don't think the "may be empty" could be about SenML. Why ? because it seems in SenML See rfc8428§section-11 :
So : |
Reading the TS, I understand "empty payload" as the absence of a payload in the CoAP packet, not an empty string. Eg: Type=ACK, Code=2.05, MID=0x7d35, Token=0x20
Hence my point that an "empty payload" should not have a Content-format, since the content-format option "indicates the representation format of the message payload." (RFC 7252) It is not not the same thing as an "Empty SenML payload" which is indeed an empty array as you wrote. Eg: Type=ACK, Code=2.05, MID=0x7d35, Token=0x20, option Content-format=110, Payload= "[]"
|
Shouldn’t the response be 2.04 for no content? https://datatracker.ietf.org/doc/html/rfc7252#section-5.9.1.4
From: David Navarro ***@***.***>
Sent: Monday, June 17, 2024 12:27 PM
To: OpenMobileAlliance/OMA_LwM2M_for_Developers ***@***.***>
Cc: Gillmore, Matthew ***@***.***>; Mention ***@***.***>
Subject: [EXTERNAL] Re: [OpenMobileAlliance/OMA_LwM2M_for_Developers] Empty Response to a Read operation (Issue #579)
Note that the response payload may be empty, for instance when performing a Read operation on an Object with no Object Instance. I rethink about that and if we strictly follow SenML spec, I don't think the "may be empty" could be about SenML.
ZjQcmQRYFpfptBannerStart
Warning! This email comes from outside the company.
This message came from outside of Itron, if you suspect it to be spam, please delete it or if you suspect a phishing attempt, please report it using the Phish Alert Report button. Be careful and think before you click.
ZjQcmQRYFpfptBannerEnd
Note that the response payload may be empty, for instance when performing a Read operation on an Object with no Object
Instance.
I rethink about that and if we strictly follow SenML spec, I don't think the "may be empty" could be about SenML. (It could concern others content format but not SenML)
Reading the TS, I understand "empty payload" as the absence of a payload in the CoAP packet, not an empty string.
Eg: Type=ACK, Code=2.05, MID=0x7d35, Token: 0x20
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 1 | 2 | 1 | 2.05=69 | MID=0x7d35 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| 0x20 |
+-+-+-+-+-+-+-+-+
Hence my point that an "empty payload" should not have a Content-format, since the content-format option "indicates the representation format of the message payload." (RFC 7252<https://urldefense.com/v3/__https:/www.rfc-editor.org/rfc/rfc7252*section-5.10.3__;Iw!!F7jv3iA!2tgywk04nWzr69e_iS_RS51mRokVIjcnMXsRzxFObp5-sjN6yv2dT3AZys3qaVJZFrJDMixsedUspj_CicByZ1aeORYu8Q$>)
—
Reply to this email directly, view it on GitHub<https://urldefense.com/v3/__https:/github.com/OpenMobileAlliance/OMA_LwM2M_for_Developers/issues/579*issuecomment-2173842267__;Iw!!F7jv3iA!2tgywk04nWzr69e_iS_RS51mRokVIjcnMXsRzxFObp5-sjN6yv2dT3AZys3qaVJZFrJDMixsedUspj_CicByZ1ZcpuUwAA$>, or unsubscribe<https://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/AJSSA5U6A264UIVB7DVOHZLZH4E5RAVCNFSM6AAAAABJB5TTBSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNZTHA2DEMRWG4__;!!F7jv3iA!2tgywk04nWzr69e_iS_RS51mRokVIjcnMXsRzxFObp5-sjN6yv2dT3AZys3qaVJZFrJDMixsedUspj_CicByZ1aOtJJvMw$>.
You are receiving this because you were mentioned.Message ID: ***@***.******@***.***>>
|
If you read the section you shared : And reading https://datatracker.ietf.org/doc/html/rfc7252#section-5.8.1 : So for me this is pretty clear : only 2.05 (Content) can be used for GET. IMHO, using 2.04 in this case would be a mistake. |
I also find https://datatracker.ietf.org/doc/html/rfc7252#section-5.5.1 :
Replying to #579 (comment) I understand your point. So the question is :
Should that sentence ☝️ be interpreted as :
It seems we didn't find any argument allowing to reject one of them. 1. No content format allowed :
Con :
Note : if Accept option is used in GET request, it seems that Content Format is mandatory, see : https://datatracker.ietf.org/doc/html/rfc7252#section-5.10.4 2. content format mandatory My personal opinion, I prefer 2.) It seems to me it's more in line with CoAP RFC spirit. |
@mlasch, @LukasWoodtli from Wakaama project. Do you have any opinion about that ? |
Just on this point:
Your implementation already handles the special case of having a Content-format option but no payload. A naive design would invoke the parser matching the content-format value. And for most of the formats, the parser would return an error as a 0-length buffer is not valid. |
I didn't talk about Leshan in particularly. (maybe current Leshan behavior is a mistake)
Yep from my point of view this matches with interpretation : |
Just to summarize my inputs: Following #213, LwM2M allows CoAP 2.05 response messages to have no CoAP payload as stated in the CoAP Transport Binding section:
In such a case, should the CoAP response include a Content-Format option or not? If yes, what should be the indicated content-format? For most of the formats used in LwM2M, an empty input buffer is not valid:
|
I guess this will depend what meaning OMA member will choose for "Note that the response payload may be empty, for instance when performing a Read operation on an Object with no Object Instance. In this case the response code is still 2.05 Content."
As I prefer 2, I would answer Yes it should.
IMHO, the question doesn't really arise.
I'm not sure but an empty string in Text format is valid ? and empty string is encoded as empty payload or I missed something ? Maybe this sentence 👇 should just be deleted ? 🤷♂️ |
My point was that an empty string is the one-byte buffer |
At CoAP level, I don't think it is encoded like this. 🤔 |
Double checking LwM2M dat types and RFC 3629, indeed you are right. I edited the table. |
@dnav is there a pull request for this table edit? |
Sorry for the late answer. I‘m no so involved into the client implementation of Wakaama. In general I think it would be nice if we could send a CoAP packet with no content type and an empty payload in such a case. But not sure if that would comply with the specs of CoAP and LaM2M. |
The response to a Read operation may be empty: An Object Instance may have no readable Resource, or a Resource may not have any Resource Instance. The TS indicates that in this case, the response code is 2.05 Content and there is no attached payload since there are no values to report:
We recently faced an interoperability issue using the CoAP binding. In such a case, should the CoAP response include a Content-Format option or not?
The text was updated successfully, but these errors were encountered: