Code Monkey home page Code Monkey logo

Comments (14)

ciarmcom avatar ciarmcom commented on August 16, 2024

ARM Internal Ref: IOTCLT-760

from mbed-client-c.

anttiylitokola avatar anttiylitokola commented on August 16, 2024

Hi, thanks for your report. We will look into this and get back to you when we have reproduced and investigated this issue.

from mbed-client-c.

markus-becker-tridonic-com avatar markus-becker-tridonic-com commented on August 16, 2024

@EduardPon have you set SN_COAP_DUPLICATION_MAX_MSGS_COUNT? this looks to me, that it enables message de-duplication. see https://github.com/ARMmbed/mbed-client-c/blob/master/source/libCoap/src/sn_coap_protocol.c#L50

from mbed-client-c.

EduardPon avatar EduardPon commented on August 16, 2024

No I haven't. I was not aware about this definition.

Strange that this is disabled by default because it violates the CoAP standard. I would suggest to remove this switchable option and enable the duplication detection.

from mbed-client-c.

yogpan01 avatar yogpan01 commented on August 16, 2024

Hi,
This is an option we can enable from configuration so that application can turn it on or off based on their requirement. I will add this to our backlog to provide configuration for enabling this flag. We have similar configuration for BLOCKWISE transfer.

from mbed-client-c.

EduardPon avatar EduardPon commented on August 16, 2024

Hello,
@yogpan01, can you confirm this configuration option deletes duplicates and fixes the reason why I have opened this issue report.

What I don't understand is why it has a maximum count value? I would expect to enable or disable duplicate discarding.

Why would you allow to disable it and hereby violate the CoAP specification?

The recipient SHOULD acknowledge each
duplicate copy of a Confirmable message using the same
Acknowledgement or Reset message but SHOULD process any request or
response in the message only once.

from mbed-client-c.

yogpan01 avatar yogpan01 commented on August 16, 2024

Hi,
I checked and found that configuration is already present for enabling/disabling duplication logic.
https://docs.mbed.com/docs/mbed-client-guide/en/latest/Introduction/
Check section "CoAP message deduplication"
Defining non-zero value for this setting enables this feature, the count is mainly coap library implementation for keeping track of "n" number of duplicate messages.

from mbed-client-c.

EduardPon avatar EduardPon commented on August 16, 2024

Thanks for the info. But what I have understood, this relates to the duplication of messages to be transmitted, and not detecting duplicates at receiver side. These must only be acknowledged and don't be processed again. The current implementation processes every duplicate at the receiver side (CoAP spec violation).

from mbed-client-c.

yogpan01 avatar yogpan01 commented on August 16, 2024

Hi,
So in case the duplicate message is detected , this is how it is currently handled
https://github.com/ARMmbed/mbed-client-c/blob/master/source/libCoap/src/sn_coap_protocol.c#L664

/* Set returned status to User /
returned_dst_coap_msg_ptr->coap_status = COAP_STATUS_PARSER_DUPLICATED_MSG;
/
Because duplicate message, return with coap_status set */
return returned_dst_coap_msg_ptr;

Perhaps , we should check this status in our end before invoking callback to application.
Are you using mbed Client C++ API for your application ? We can add logic of checking this status code and avoid processing of these messages.

from mbed-client-c.

EduardPon avatar EduardPon commented on August 16, 2024

Hello,

Yes we are using the C++ API.

from mbed-client-c.

yogpan01 avatar yogpan01 commented on August 16, 2024

Thanks ! We will check now, how to handle this case safely on C++ side. I will keep you updated, hopefully we need not merge your PR if we are able to make the fix working from our end.

from mbed-client-c.

yogpan01 avatar yogpan01 commented on August 16, 2024

Hi @EduardPon , if you can try this PR ARMmbed/mbed-client#251 to verify that duplication detection is working for you. We will merge and release the update.

from mbed-client-c.

EduardPon avatar EduardPon commented on August 16, 2024

Hello,

I tested the implementation change https://github.com/ARMmbed/mbed-client/pull/251, but not in the M2MNsdlInterface but in our NSDL CoAP resource_callback function. I did not get a COAP_STATUS_PARSER_DUPLICATED_MSG coap_status. So enabled the SN_COAP_DUPLICATION_MAX_MSGS_COUNT. Still the COAP_STATUS_PARSER_DUPLICATED_MSG coap_status is not returned, BUT the duplicates are discarded. So I would suggest to enable the COAP_STATUS_PARSER_DUPLICATED_MSG by default to be compliant with the CoAP specification. I know there is a resource penalty. I would suggest to add a remark about the CoAP non conformance when disabling the COAP_STATUS_PARSER_DUPLICATED_MSG.

Summary:

from mbed-client-c.

yogpan01 avatar yogpan01 commented on August 16, 2024

Hi,
Thanks for the confirmation. mbed-client-c is internally handling the duplicated message so we will not need to handle it on resource level.
We will check if there is any issue with enabling the duplication by default, hopefully it should not break anything but we would need to confirm this.

from mbed-client-c.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.