tessel / t1-firmware

[UNMAINTAINED] Tessel 1 Firmware
Other
68 stars 20 forks source link

A few dozen small, but rapid, socket exchanges kills CC3K #128

Open natevw opened 9 years ago

natevw commented 9 years ago

Run this somewhere the Tessel can talk to:

require('net').createServer(function (sock) {
  sock.on('data', sock.write);
}).listen(5004, function () {
  console.log("listening", this.address().port);
});

Run this with tessel run -l all -s script.js:

require('net').connect(5004, "192.168.4.114", function () {
  console.log("connected, initiating writes");
  for (var i = 0; i < 25; i += 1) this.write(".");
  this.end();
});

Gets stuck in a loop like the following, and then needs a power cycle before doing any other WiFi stuff:

… Sending 1 bytes <Buffer 2e> tSLInformation.usNumberOfFreeBuffers 1 HCI Event error on command: 1008 HCI Event error on command: 1008 HCI Event error on command: 1008 HCI Event error on command: 1008 kicking out of buffer wait HostFlowControlConsumeBuff is bad -5 Sending 1 bytes <Buffer 2e> tSLInformation.usNumberOfFreeBuffers 1 HCI Event error on command: 1008 …

Full log at https://gist.github.com/natevw/6c39419e1e3bca9bf17c

natevw commented 9 years ago

UPDATE: disregard, I don't think this is particularly relevant.


Another potential way to trigger (at least something similar).

Server:

require('net').createServer(function (sock) {
  sock.setNoDelay();
  for (var i = 0; i < 25; i += 1) setTimeout(function () {
    sock.write(".");
  }, i*.1e3);
}).listen(5004, function () {
  console.log("listening", this.address().port);
});

Tessel:

require('net').connect(5004, "192.168.4.114", function () {
  console.log("connected, waiting");
  setInterval(function () {
    console.log("spin");
    var i = 100000;
    while (--i) ;
    console.log("done");
  }, 1e3);
});

There's no timeout errors, but the Tessel doesn't seem to read as much as expected (though it doesn't totally stop either!)the pattern of data read is a little weird. Full log is https://gist.github.com/natevw/ec2ce0be64ad41f6773c. Maybe this is simply due to event loop scheduling?

natevw commented 9 years ago

Will https://github.com/tessel/runtime/pull/713 improve this situation at least by making it detectable?