Avatar for .Neil

.Neil

Member since Nov 2016 • Last active May 2017
  • 4 conversations
  • 12 comments

.

Most recent activity

    • 4 comments
    • 761 views
    • 9 comments
    • 457 views
  • in General
    Avatar for .Neil

    Thanks Gordon. Seeing a partial fix with 1v90; but now there's a clear memory leak.

    I updated with 1v90.
    I also soldered a 10uF ceramic capacitor between Vcc and GND on the ESP8266 Wifi Module.

    Adding process.memory() to the code the leak is clearly visible. It makes about 15 require("http").get() calls before it's out of memory. I then see ERROR: Out of memory! followed by ERROR: Error processing Serial data handler - removing it.

    Here's the code I used:

    
    var tries=0;
    function onInit() {
      digitalWrite(B9,1); // enable on Pico Shim V2
      Serial2.setup(115200, { rx: A3, tx : A2 });
      var wifi = require("ESP8266WiFi_0v25").connect(Seri­al2, function(err) {
        if (err) throw err;
        wifi.reset(function(err) {
          if (err) throw err;
          console.log("Connecting to WiFi");
          wifi.connect("SSID","password", function(err) {
            if (err) throw err;
            console.log("Connected");
            setInterval(function () {
              require("http").get("http://www.espruino­.com", function(res) {
              });
              console.log("Attempt #" + ++tries);
              console.log(process.memory());
            }, 15000);
          });
        });
      });
      
    }
    onInit();
    

    It's leaking 100-200 with each call. Oddly, it's not constant.

    Any idea where the leak is?

  • in General
    Avatar for .Neil

    Ok, ran some tests over the last few days:

    1) I'm using firmware 1v89.
    2) With the 15-second interval the interpreter is unresponsive when connected via USB and there are no error messages.
    3) I retried with a one-hour interval and the results are the same.
    4) Even the number of attempts are the same before it locks up: google.com still makes 8 attempts and locks up, espruino.com makes only 4. Same JS code as above, only changed the interval.
    5) I added another interval to blink an LED every couple seconds to see if the results change when connecting to a simple power-only USB vs. a PC's USB: eventually the LED stops blinking, indicating the lock ups are still occurring.

    I can certainly solder a cap between Vcc and GND, but I'm seeing a clear correspondence between the website and the number of require("http").get() calls before failure. This leads me to believe it's a problem in the software reading data rather than hardware. But what's different about the website data eludes me (nasa.gov's homepage has much more data than google.com but espruino makes more successful .get() calls before locking up...)

    Does websockets use different underlying routines? I remember you saying to try websockets when I made 4 calls a second; can you tell me why?

    Thanks,

    Neil

  • in General
    Avatar for .Neil

    Hi Gordon, thanks for getting back to me so quickly.

    I only reduced the interval to 250ms to quickly illustrate the problem BUT I think what I've done is created a new one (and obscured the still-present issue.)

    Increase the interval to 15000 (15 seconds) and you'll see the real issue: the Espruino locks up after a few attempts and no longer makes the require("http") call.

    My project only demands a one-hour interval but that's a long time to wait to see it lock up. The same lock-ups appear with a 15-second interval, occuring on two Espruino/ESP8266 boards I soldered up. (They still respond to pings for some reason...)

    And different websites fail after a different number of attempts, but are consistent for each site (google.com always fails with 8 tries, espruino.com always with 4):
    google.com: 8 attempts
    espruino.com 4 attempts
    travelocity.com 20 attempts
    youtube.com 22 attempts
    nasa.gov 23 attempts

    I hope this helps.

    Thanks,
    -Neil

  • in General
    Avatar for .Neil

    My code needs to load a web page multiple times. But after a few successful http calls it fails with "Uncaught Error: No free sockets".

    I've removed my project-specific code to provide the simplest example of this error:

    var tries=0;
    
    function onInit() {
      digitalWrite(B9,1); // enable on Pico Shim V2
      Serial2.setup(115200, { rx: A3, tx : A2 });
      var wifi = require("ESP8266WiFi_0v25").connect(Seri­al2, function(err) {
        if (err) throw err;
        wifi.reset(function(err) {
          if (err) throw err;
          console.log("Connecting to WiFi");
          wifi.connect("SSID","password", function(err) {
            if (err) throw err;
            console.log("Connected");
    
            setInterval(function () {
              require("http").get("http://www.google.c­om", function(res) {
              });
              console.log("Attempt #" + ++tries);
            }, 250);
    
    
          });
        });
      });
      
    }
    
    onInit();
    

    Google.com is simply an example; it fails with any website.

    When running the code you'll see the number of attempts increment until it fails around #7 or #8. Apparently the require("http") call generates it. Oddly, changing the interval from 250 to something larger generates different errors but the end result is the same: the Espruino freezes.

    I really need this to work as there is no workaround. Can anyone provide some guidance?

    Thanks,

    -Neil

  • in General
    Avatar for .Neil

    Thanks all.

  • in General
    Avatar for .Neil

    I see some examples where espruino pins are used to power LEDs. Does anyone know how much current one of these pins can source? Or sink?

    ("sink" as in set to FALSE and act as a 0v ground for an external device. Sinking traditionally has a higher current limit as in the old 555 timer IC)

    -Neil

  • in ESP8266
    Avatar for .Neil

    Thanks for your response. Your post was actually quite helpful. I discovered powercycling is a must when working with the ESP8266. After each failed flash the Espruino MUST be removed and reinserted or it won't properly connect and the Web IDE will ignore everything I type in the left edit screen. My ESP-01 however only produces one blue flash when put in bootloader mode. And I did erase using esptool.py but it didn't seem to be required to flash. What WAS required was dozens of attempts to finally get to 100% complete. Other forums suggested this very thing.

    Beyond that I noticed the Espruino is very finicky about its USB slot, and after trying multiple computers only one slot in one PC recognized it. But what seemed to finally work was applying some physical pressure while flashing. Could be coincidence but after nearly 30 tries the flash worked flawlessly when I applied some finger pressure, pushing it down and into the USB slot.

    Has anyone else noticed these eccentricities?

Actions