Copyright © https://mongoose-os.com

Mongoose OS Forum

frame
ATTENTION! This forum has moved to:

https://community.mongoose-os.com

Do not post any new messages.

memory leaks, then crash?

I wrote some Smart.js code that establishes a websocket client connection with a server on a PC and then it just replies to a 'ping' message from the server that gets sent every 5 seconds. The response message from the client includes the available memory as reported by GC.stat().

I'm seeing a steady decline from about 25k to 7.8k over the course of about 22 minutes, and then the ESP8266 abruptly reboots.

 "ets Jan 8 2013,rst cause:2, boot mode:(3,6)"

Comments

  • Hi!
    Could you share you code? ..or part of it.
    I'll try to reproduce
  • CapstanCapstan Texas, USA
    Please see;
    https://github.com/carterw/smartjsFileUploader

    The server side (running on a PC) requires Node.js, probably you have worked with it? Clone the project and do 'npm install'.

    Adjust your server IP address in 8266/wsClient.js and put the file  on the device, then do File.eval('wsClient.js') there.
    Then on the PC do;
    $ node commandLine/runServer.js

    ... and on the 8266 invoke makews()

    On the server side should see;

    connection
    received: {"state":1,"type":"H_REQ"}
    received: {"devID":"device1","timestamp":1460415173759,"state":1,"type":"H_ACK"}
    received: {"files":["blink.js","index.html","conf_sys_defaults.json","conf_sys_schema.json","sys_init.js","wsClient.js","utils.js","conf.json","conflib.js","conf_app_defaults.json","conf_app_schema.json","demo.js","I2C.js"],"devID":"device1","stat":{"owned_max":16,"owned":10,"bcode_lit_deser":0,"bcode_lit_total":880,"bcode_ops":1545,"astsize":0,"funcncell":16,"funcnfree":8,"propncell":24,"propnfree":8,"objncell":12,"objfree":4,"struse":3638,"strres":3762,"jsfree":368,"jssize":7916,"sysfree":20640},"timestamp":1460415173817,"state":3,"type":"INFO_ACK"}
    INFO_ACK received
    infoHandler!! blink.js,index.html,conf_sys_defaults.json,conf_sys_schema.json,sys_init.js,wsClient.js,utils.js,conf.json,conflib.js,conf_app_defaults.json,conf_app_schema.json,demo.js,I2C.js
    received: {"memory":19996,"timestamp":1460415176958,"state":3,"type":"PING_ACK"}
    PING_ACK received
    pingAckHandler!!
    received: {"memory":18024,"timestamp":1460415181959,"state":3,"type":"PING_ACK"}
    PING_ACK received

    ... etc until it resets. I have seen the device reset when there is no data going back and forth which is why I added the ping, so there may be an ongoing leak even with no traffic.
  • CapstanCapstan Texas, USA
    I extracted, built, and flashed firmware today, looks like this problem was fixed! Awesome, thanks!
  • SergeySergey Dublin, Ireland
    edited April 2016
    Thanks Bill & Alex!
Sign In or Register to comment.