-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SSH Commands Occasionally Hanging #271
Comments
Nope, I haven't experienced this issue, sorry :/ |
Here is a little clue:
The deleteFolder command never closes. This could be an issue with the USB Daemon. Perhaps it's getting packets out of sync and isn't able to close the process. This is pretty hard to debug b/c it's very occasional for me (maybe 5% of deploys). |
Scratch that - it is not an issue with the USB Daemon - as you can see in the logs above, this is a LAN connection. |
@johnnyman727 does #342 fix this ? |
@Student007 it's hard to say because the issue comes up so rarely and inconsistently. I will try it out though. |
@Student007 I was able to reproduce the issue and unfortunately, nether |
Another clue:
|
I believe I've tracked down the source of this error. We run There are two ways I can think of to resolve this:
Tessel.prototype.simpleExec = function(command) {
// Stop processes and delete everything in the folder
return this.connection.exec(command)
.then((remote) => {
var error = '';
var received = new Buffer(0);
remote.stderr.on('data', function(buffer) {
error += buffer.toString();
});
remote.stdout.on('data', function(buffer) {
received = Buffer.concat([received, buffer]);
});
remote.once('close', function() {
if (error) {
return reject(new Error(error));
} else {
return resolve(received);
}
});
});
}; The downside being a fair amount of code refactoring (all the functions that call
Tessel.prototype.receive = function(remote) {
var error = '';
var received = new Buffer(0);
// End early if this process already completed
if (remote._readableState.ended === true) {
return Promise.resolve(received);
}
remote.stderr.on('data', function(buffer) {
error += buffer.toString();
});
remote.stdout.on('data', function(buffer) {
received = Buffer.concat([received, buffer]);
});
return new Promise(function(resolve, reject) {
console.log('waiting for close...', remote);
remote.once('close', function() {
console.log('closed. was there an error in receive?', error.length, error);
if (error) {
return reject(new Error(error));
} else {
return resolve(received);
}
});
});
}; The major downside here being that neither Node streams nor the I'm in favor of fix 2. I think it the most simple, logical, and robust but I do wish there was a public API for checking stream lifecycle state. Any other thoughts? |
@rwaldron have you seen SSH commands just hanging recently? It seems like every 3rd or 4th time I deploy, the CLI just hangs. It's not failing on any particular bash command, one of them just ends up not closing. Perhaps it closes before event listener is ready?
The text was updated successfully, but these errors were encountered: