Skip to content

Instantly share code, notes, and snippets.

@bahamas10
Last active December 26, 2015 20:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bahamas10/7205828 to your computer and use it in GitHub Desktop.
Save bahamas10/7205828 to your computer and use it in GitHub Desktop.
manta-sync / node-ssh-agent possible issues

1. manta-sync is cloned and npm install is ran

dave @ [ arbiter :: (SunOS) ] ~ $ git clone git://github.com/bahamas10/node-manta-sync.git
Cloning into 'node-manta-sync'...
remote: Counting objects: 15, done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 15 (delta 6), reused 14 (delta 5)
Receiving objects: 100% (15/15), 6.52 KiB, done.
Resolving deltas: 100% (6/6), done.
dave @ [ arbiter :: (SunOS) ] ~ $ cd node-manta-sync/
dave @ [ arbiter :: (SunOS) ] ~/node-manta-sync (git:master) $ npm install &>/dev/null; echo $?
0

2. ssh-agent@latest is patched to log when net.createConnection is called on the ssh-agent socket

dave @ [ arbiter :: (SunOS) ] ~/node-manta-sync (git:master) $ cd node_modules/manta/node_modules/ssh-agent/
dave @ [ arbiter :: (SunOS) ] ~/node-manta-sync/node_modules/manta/node_modules/ssh-agent (git:master) $ patch
diff --git a/lib/ssh_agent_client.js b/lib/ssh_agent_client.js
index 37f204d..e78847a 100644
--- a/lib/ssh_agent_client.js
+++ b/lib/ssh_agent_client.js
@@ -258,6 +258,7 @@ SSHAgentClient.prototype._request = function(getRequest,
   assert.ok(callback && typeof(callback) === 'function');
 
   var self = this;
+  console.log('net.createConnection called');
   var socket = net.createConnection(this.sockFile);
 
   socket.on('data', function(data) {
can't find file to patch at input line 5
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/lib/ssh_agent_client.js b/lib/ssh_agent_client.js
|index 37f204d..e78847a 100644
|--- a/lib/ssh_agent_client.js
|+++ b/lib/ssh_agent_client.js
--------------------------
File to patch: lib/ssh_agent_client.js
patching file lib/ssh_agent_client.js
dave @ [ arbiter :: (SunOS) ] ~/node-manta-sync/node_modules/manta/node_modules/ssh-agent (git:master) $ cd -
/home/dave/node-manta-sync

3. A test directory with 1000 files is created

dave @ [ arbiter :: (SunOS) ] ~/node-manta-sync (git:master) $ mkdir foo
dave @ [ arbiter :: (SunOS) ] ~/node-manta-sync (git:master) $ touch foo/{1..1000}.txt

4. A dry run is initiated with a concurrency of 1000

dave @ [ arbiter :: (SunOS) ] ~/node-manta-sync (git:master) $ ./manta-sync.js --dry-run -c 1000 ./foo/ ~~/stor/foo 2>&1 | grep -c 'net\.createConnection called'
1001

results

With 1000 concurrent connections, 1001 connections are created to the ssh socket. this uses the latest node-manta so the signing cache should be in place.

@bahamas10
Copy link
Author

Just tested with the latest node-manta. I'm able to HEAD all of the data just fine, but PUT still seems to fail.

dave @ [ bahamas10 :: (Darwin) ] ~/dev/node-manta-sync (git:master) $ mrm -r ~~/stor/foo
dave @ [ bahamas10 :: (Darwin) ] ~/dev/node-manta-sync (git:master) $ ./manta-sync.js -c 1000 ~/temp/foo/ ~~/stor/foo 2>/dev/null | grep -c 'createConnection called' 
2248

@bahamas10
Copy link
Author

dave @ [ bahamas10 :: (Darwin) ] ~/dev/node-manta-sync (git:master) $ mls ~~/stor/foo | wc -l
881

@bahamas10
Copy link
Author

with

dave @ [ bahamas10 :: (Darwin) ] ~/dev/forks/node-ssh-agent (git:master) $ git diff
diff --git a/lib/ssh_agent_client.js b/lib/ssh_agent_client.js
index 37f204d..25066d1 100644
--- a/lib/ssh_agent_client.js
+++ b/lib/ssh_agent_client.js
@@ -284,6 +284,7 @@ SSHAgentClient.prototype._request = function(getRequest,
   });

   socket.on('error', function(err) {
+    console.log('ssh-agent threw %s', err.message);
     return callback(err);
   });

i get

dave @ [ bahamas10 :: (Darwin) ] ~/dev/node-manta-sync (git:master) $ ./manta-sync.js -c 1000 ~/temp/foo/ ~~/stor/foo 2>/dev/null | grep -c 'ssh-agent threw connect ECONNREFUSED'
433

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment