eclipse-leshan / leshan

Java Library for LWM2M
https://www.eclipse.org/leshan/
BSD 3-Clause "New" or "Revised" License
653 stars 407 forks source link

Problem in the project "Leshan-server-demo", The tens of Seconds delay occured in the Method -> LeshanServer.send(Registration registration, WriteRequest writeRequest) #1368

Closed kijSims closed 1 year ago

kijSims commented 1 year ago

Question

Now I have a problem with my project. In the project leshan-server-demo, I used leshanServer to connect to device A. And I defined an interface which is called by the third party system. In the interface, it first calls the method leshanServer.send() to send information to device A, then device A will do some processing and send the information to the connected device B, and finally return the result to my system.

Interface delays now occur every dozen or so times, I don't know whether threr is a problem from my system to device A or the problem from device A to device B. I have done a lot of tests, but it doesn't help. To sum up, I would like to know the stability of leshan-server's connection to devices through LwM2m protocol.
sbernard31 commented 1 year ago

I didn't get too much your explanation :grimacing: anyway note that leshan-server-demo is not intended to be reused to build some production server. This is just a demo ... Leshan library aims to be reused for production.

To sum up, I would like to know the stability of leshan-server's connection to devices through LwM2m protocol.

At least, I can say we use it in production environment without any issue. I believe that Leshan and Californium are largely used.

Interface delays now occur every dozen or so times,

If this happens so frequently, this should be not so hard to understand what happens with log or tcp dump capture :thinking:

Bonus question : Are you using leshanServer.send() sync or async way ?

kijSims commented 1 year ago

Thank you for taking the time to answer my question !

I used leshanServer.send() sync in my project.

After I tested the interface last night and found that there was a communication problem between devices A and B, it seems that Leshan and Californium are really trustworthy. Therefore, I want to sort out the test data and ask the provider of device A to check their problems.

jvermillard commented 1 year ago

send() can block for tens of seconds if there is some packet drop and re-transmission (which is normal with CoAP/UDP). It's probably more a link issue.

sbernard31 commented 1 year ago

I used leshanServer.send() sync in my project.

Most of the time for production server this is better to use async way. sync way is more for demo or testing.

sbernard31 commented 1 year ago

@kijSims let us know if/when we can close this issue.

kijSims commented 1 year ago

I'm sorry about that.

I've identified the source of the problem. I used Wireshark to capture packets and found that the target device responded late or even did not respond to the packets. Leshan is no problem.

Thank you very much ! Thank you Leshan !

sbernard31 commented 1 year ago

You're welcome :wink: