nrf9160 - lwm2m_client (Connection issue)

 Good day
I have a program whereby I collected data and send it away every 10 minutes on a lwm2m object.  I am using the lwm2m_send function to do so.  Every ten minutes I send 10 messages to the server.  When I do this, I get this:
 [00:30:24.401,855] <err> net_lwm2m_engine: Failed to send packet, err 11
[00:30:26.183,837] <inf> net_lwm2m_message_handling: Send done!
[00:30:27.303,710] <inf> net_lwm2m_message_handling: Send done!
[00:30:27.559,753] <inf> net_lwm2m_message_handling: Send done!
[00:30:27.753,753] <inf> net_lwm2m_message_handling: Send done!
[00:30:27.943,756] <inf> net_lwm2m_message_handling: Send done!
[00:30:28.136,779] <inf> net_lwm2m_message_handling: Send done!
[00:30:28.295,776] <inf> net_lwm2m_message_handling: Send done!
[00:30:28.493,774] <inf> net_lwm2m_message_handling: Send done!
[00:30:28.648,773] <inf> net_lwm2m_message_handling: Send done!
[00:30:28.808,807] <inf> net_lwm2m_message_handling: Send done!
I get an error for the first message but it seems to resend and eventually go through afterwards.  Is there a reason why this happens as I would like to resolve warnings and issues now before further development.  I have also noticed that after a couple of hours, the program seems to shut down and restart again only after a couple of hours.  I was running the client while logging and I found that sometimes when the network isn't available, the AT MONITOR cannot trigger a network error and the program remains stuck and not sending anything.  I eventually get this error:
[00:10:26.773,284] <err> net_lwm2m_engine: Failed to send packet, err 11
[00:10:28.231,842] <err> net_lwm2m_engine: Poll reported a socket error, 08.
[00:10:28.231,842] <err> net_lwm2m_rd_client: RD Client socket error: 5
[00:10:28.489,715] <wrn> at_monitor: No heap space for incoming notification: +CSCON: 0
The client can therefore never trigger a network error I cannot start offline processes! I have to increase the heap size but the client already uses a big heap size.  However, the handler is suppose to clear notifications.  Is there a way I can check for a network connection before attempting to send something?  I am in power saving mode. 
It is also important to note that this doesn't happen all the time.  Could that be attributed to a memory leak?
For context this is what happens sometimes:
[00:10:07.361,846] <err> net_lwm2m_engine: Failed to send packet, err 11
[00:10:07.964,141] <dbg> app_lwm2m_client: lwm2m_lte_reg_handler_notify: LTE NW status: 90
[00:10:08.486,633] <err> net_lwm2m_engine: Poll reported a socket error, 08.
[00:10:08.486,663] <err> net_lwm2m_rd_client: RD Client socket error: 5
[00:10:08.587,921] <dbg> app_lwm2m_client: lwm2m_lte_reg_handler_notify: LTE NW status: 0
[00:10:08.902,130] <err> net_lwm2m_engine: Cannot connect UDP (-114)
[00:10:08.903,747] <err> net_lwm2m_rd_client: Failed to start socket -114
[00:10:09.983,673] <err> net_lwm2m_engine: Cannot connect UDP (-114)
[00:10:09.983,947] <err> net_lwm2m_rd_client: Failed to start socket -114
[00:10:12.064,117] <err> net_lwm2m_engine: Cannot connect UDP (-114)
[00:10:12.064,392] <err> net_lwm2m_rd_client: Failed to start socket -114
[00:10:16.145,050] <err> net_lwm2m_engine: Cannot connect UDP (-114)
[00:10:16.145,324] <err> net_lwm2m_rd_client: Failed to start socket -114
[00:10:24.226,623] <err> net_lwm2m_engine: Cannot connect UDP (-114)
[00:10:24.226,898] <err> net_lwm2m_rd_client: Failed to start socket -114
[00:10:24.226,928] <err> app_lwm2m_client: LwM2M engine reported a network error.
[00:10:40.227,905] <err> net_lwm2m_engine: Cannot connect UDP (-114)
[00:10:40.228,179] <err> net_lwm2m_rd_client: Failed to start socket -114
[00:10:40.808,044] <err> net_lwm2m_engine: Cannot connect UDP (-114)
[00:10:40.808,319] <err> net_lwm2m_rd_client: Failed to start socket -114
[00:10:41.888,244] <err> net_lwm2m_engine: Cannot connect UDP (-114)
[00:10:41.888,519] <err> net_lwm2m_rd_client: Failed to start socket -114
[00:10:43.968,688] <err> net_lwm2m_engine: Cannot connect UDP (-114)
[00:10:43.968,963] <err> net_lwm2m_rd_client: Failed to start socket -114
[00:10:48.049,621] <err> net_lwm2m_engine: Cannot connect UDP (-114)
[00:10:48.049,896] <err> net_lwm2m_rd_client: Failed to start socket -114
[00:10:56.131,347] <err> net_lwm2m_engine: Cannot connect UDP (-114)
[00:10:56.131,622] <err> net_lwm2m_rd_client: Failed to start socket -114
[00:10:56.131,652] <err> app_lwm2m_client: LwM2M engine reported a network error.
It takes a while to trigger a network error which is not ideal as well as fills up the notifications! Please assist .
I have noticed an increasing amount of issues and limitations regarding lwm2m and am wondering if it would be a better to stick to a standard mqtt system.  
Kind regards,
Hassan
Parents
  • Hello Hassan, 

    During the summer season, our workforce is currently operating with reduced staff levels throughout the company, which may lead to slight delays in our response time as we await additional resources. Rest assured, we are actively addressing all issues and working diligently to resolve them promptly.


    What version of the nRF Connect SDK are you running, and with what modem FW? Is this your application or one of our samples? Are you seeing the same with default LwM2M client sample?

    [00:10:07.964,141] &lt;dbg&gt; app_lwm2m_client: lwm2m_lte_reg_handler_notify: LTE NW status: 90

    [00:10:08.587,921] <dbg> app_lwm2m_client: lwm2m_lte_reg_handler_notify: LTE NW status: 0

    There seems to be some connectivity issue with the board. From nrf\include\modem\lte_lc.h

    /* NOTE: enum lte_lc_nw_reg_status maps directly to the registration status
     *	 as returned by the AT command "AT+CEREG?"
     */
    LTE_LC_NW_REG_UICC_FAIL            = 90
    LTE_LC_NW_REG_NOT_REGISTERED       = 0,
    There might be an issue with the SIM card. Could there be a soldering point that is not optimal on the SIM card tray?
    [00:10:41.888,244] <err> net_lwm2m_engine: Cannot connect UDP (-114)
    [00:10:41.888,519] <err> net_lwm2m_rd_client: Failed to start socket -114

    Hence, the natural response from the device will then be

    #define NRF_ENETUNREACH 114     /**< Network unreachable */

    All errors can be found in nrfxlib\nrf_modem\include\nrf_errno.h

     [00:30:24.401,855] <err> net_lwm2m_engine: Failed to send packet, err 11
    [00:30:26.183,837] <inf> net_lwm2m_message_handling: Send done!

    Your first error in the OP, errno 11, indicates that the resource is not available. As you mention a retry fixes this as it should. Looking at the code this seems to be an issue with the socket not being ready. zephyr\subsys\net\lib\lwm2m\lwm2m_engine.c which is also confirmed by the two errors:

    [00:10:28.231,842] <err> net_lwm2m_engine: Poll reported a socket error, 08.
    [00:10:28.231,842] <err> net_lwm2m_rd_client: RD Client socket error: 5

    #define NRF_EAGAIN 11           /**< Resource unavailable, try again */
    #define NRF_EIO 5               /**< I/O error */
    #define NRF_ENOEXEC 8           /**< Executable file format error */

    Difficult to tell why this happnes unfortunately. Can you please provide a modem trace?

    Kind regards,
    Øyvind

Reply
  • Hello Hassan, 

    During the summer season, our workforce is currently operating with reduced staff levels throughout the company, which may lead to slight delays in our response time as we await additional resources. Rest assured, we are actively addressing all issues and working diligently to resolve them promptly.


    What version of the nRF Connect SDK are you running, and with what modem FW? Is this your application or one of our samples? Are you seeing the same with default LwM2M client sample?

    [00:10:07.964,141] &lt;dbg&gt; app_lwm2m_client: lwm2m_lte_reg_handler_notify: LTE NW status: 90

    [00:10:08.587,921] <dbg> app_lwm2m_client: lwm2m_lte_reg_handler_notify: LTE NW status: 0

    There seems to be some connectivity issue with the board. From nrf\include\modem\lte_lc.h

    /* NOTE: enum lte_lc_nw_reg_status maps directly to the registration status
     *	 as returned by the AT command "AT+CEREG?"
     */
    LTE_LC_NW_REG_UICC_FAIL            = 90
    LTE_LC_NW_REG_NOT_REGISTERED       = 0,
    There might be an issue with the SIM card. Could there be a soldering point that is not optimal on the SIM card tray?
    [00:10:41.888,244] <err> net_lwm2m_engine: Cannot connect UDP (-114)
    [00:10:41.888,519] <err> net_lwm2m_rd_client: Failed to start socket -114

    Hence, the natural response from the device will then be

    #define NRF_ENETUNREACH 114     /**< Network unreachable */

    All errors can be found in nrfxlib\nrf_modem\include\nrf_errno.h

     [00:30:24.401,855] <err> net_lwm2m_engine: Failed to send packet, err 11
    [00:30:26.183,837] <inf> net_lwm2m_message_handling: Send done!

    Your first error in the OP, errno 11, indicates that the resource is not available. As you mention a retry fixes this as it should. Looking at the code this seems to be an issue with the socket not being ready. zephyr\subsys\net\lib\lwm2m\lwm2m_engine.c which is also confirmed by the two errors:

    [00:10:28.231,842] <err> net_lwm2m_engine: Poll reported a socket error, 08.
    [00:10:28.231,842] <err> net_lwm2m_rd_client: RD Client socket error: 5

    #define NRF_EAGAIN 11           /**< Resource unavailable, try again */
    #define NRF_EIO 5               /**< I/O error */
    #define NRF_ENOEXEC 8           /**< Executable file format error */

    Difficult to tell why this happnes unfortunately. Can you please provide a modem trace?

    Kind regards,
    Øyvind

Children
No Data
Related