B4R Question MQTT disconnect

Discussion in 'B4R Questions' started by derez, Jul 18, 2019.

  1. derez

    derez Expert Licensed User

    Using two NodeMcu and one Wemos D1 with the same problem...
    The mqtt broker is on a b4j server and works fine. The micros are clients for the same topic which is a date and time string like this : "18 07 19 16 37 00 5" . After about 20 (+-2) received messages the clients report MQTT disconnect, try to reconnect but without success, and usually restarts.
    It does not matter if the rate is one message every 1.5 minute or 30 minutes.
    Looks like a buildup of used memory. Any idea how to clean it while still working to prevent the disconnection ?
    Thanks.
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Check the available ram and stack usage.
    Code:
    Log(AvailableRAM)
    Log(StackBufferUsage)
    Also check your code and make sure that you are not building too many strings with JoinStrings.
     
  3. derez

    derez Expert Licensed User

    StackbufferUsage is 16 , not changing.
    The available ram starts with 48912 and reduces in each received message by 2640. After 19 messages there is none left...
    The JoinString is done every second but without effect on the available ram. The ram is reduced by the received message !
     
  4. derez

    derez Expert Licensed User

    The available ram is reduced like this, see what happens below 1000 :
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    You need to debug it. What happens if you don't do anything with the received message? Where is the MessageReceived code?
     
  6. derez

    derez Expert Licensed User

    Problem solved, unrelated to MQTT.
     
  7. thetahsk

    thetahsk Active Member Licensed User

    Unrelated to Mqtt but related to all the forum members.
     
    MarkusR likes this.
  8. derez

    derez Expert Licensed User

    Because of communication problem I initialized a softserial every time I got MQTT message, this init caused the ram to reduce.
    When moved to app_start it behaves normally.
     
    Erel likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice