Skip to content
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

Low level socket error when trying to upload template #575

Closed
azizmb opened this issue Mar 7, 2012 · 5 comments
Closed

Low level socket error when trying to upload template #575

azizmb opened this issue Mar 7, 2012 · 5 comments

Comments

@azizmb
Copy link

azizmb commented Mar 7, 2012

Im trying to deploy a project to webfaction using the scripts here, and face errors when running a task that installs the application. A previous task that installs supervisor runs fine.

Ive posted this on stackoverflow, and on webfaction, with whom I also followed up on support tickets, but still couldnt resolve the issue.

The stack traces is below:

(project_name)aziz@ynl:~/workspace/project_name$ fab -f webfaction-django-fabfile/fabfile.py deploy --show debug
Using fabfile '/home/aziz/workspace/project_name/webfaction-django-fabfile/fabfile.py'
Commands to run: deploy
Parallel tasks now using pool size of 1
[username.webfactional.com] Executing task 'deploy'
[username.webfactional.com] run: /bin/bash -l -c "test -e \"\$(echo /home/username/webapps/supervisor)\""
[username.webfactional.com] run: /bin/bash -l -c "test -d /home/username/webapps/supervisor/conf.d/project_name.conf"
Timed out trying to connect to username.webfactional.com (attempt 1 of 1), giving up)

Fatal error: Low level socket error connecting to host username.webfactional.com: Connection refused (tried 1 time)

Traceback (most recent call last):
File "/home/aziz/.virtualenvs/project_name/local/lib/python2.7/site-packages/fabric/tasks.py", line 292, in execute
multiprocessing
File "/home/aziz/.virtualenvs/project_name/local/lib/python2.7/site-packages/fabric/tasks.py", line 191, in _execute
return task.run(*args, **kwargs)
File "/home/aziz/.virtualenvs/project_name/local/lib/python2.7/site-packages/fabric/tasks.py", line 113, in run
return self.wrapped(*args, **kwargs)
File "/home/aziz/workspace/project_name/webfaction-django-fabfile/fabfile.py", line 38, in deploy
install_app()
File "/home/aziz/workspace/project_name/webfaction-django-fabfile/fabfile.py", line 63, in install_app
'user': env.user,
File "/home/aziz/.virtualenvs/project_name/local/lib/python2.7/site-packages/fabric/contrib/files.py", line 85, in upload_template
if func('test -d %s' % destination).succeeded:
File "/home/aziz/.virtualenvs/project_name/local/lib/python2.7/site-packages/fabric/network.py", line 457, in host_prompting_wrapper
return func(*args, **kwargs)
File "/home/aziz/.virtualenvs/project_name/local/lib/python2.7/site-packages/fabric/operations.py", line 904, in run
return _run_command(command, shell, pty, combine_stderr)
File "/home/aziz/.virtualenvs/project_name/local/lib/python2.7/site-packages/fabric/operations.py", line 814, in _run_command
stdout, stderr, status = _execute(default_channel(), wrapped_command, pty,
File "/home/aziz/.virtualenvs/project_name/local/lib/python2.7/site-packages/fabric/state.py", line 340, in default_channel
chan = connections[env.host_string].get_transport().open_session()
File "/home/aziz/.virtualenvs/project_name/local/lib/python2.7/site-packages/fabric/network.py", line 84, in __getitem__
self.connect(key)
File "/home/aziz/.virtualenvs/project_name/local/lib/python2.7/site-packages/fabric/network.py", line 76, in connect
self[key] = connect(user, host, port)
File "/home/aziz/.virtualenvs/project_name/local/lib/python2.7/site-packages/fabric/network.py", line 393, in connect
raise NetworkError(msg, e)
NetworkError: Low level socket error connecting to host username.webfactional.com: Connection refused (tried 1 time)


Aborting.
Disconnecting from username.webfactional.com... done.
@azizmb
Copy link
Author

azizmb commented Mar 7, 2012

Just to add, looking at the comments here, more people are experiencing the same problem.

@bitprophet
Copy link
Member

The core problem -- a connection error -- does imply the issue is on the remote end. There's two issues here:

  1. Fabric should be displaying a "normal" abort/error message here instead of a traceback. That's a bug (NetworkError bubbles to top by default on cxn errors #614). (Edit: actually, it's probably due to the fabfile you're using, so please direct the author to NetworkError bubbles to top by default on cxn errors #614 for a quick explanation.)
  2. The actual cannot-connect problem. See below.

A connection issue like this only has a few causes:

  1. The hostname is wrong.
    • Fab prints this out in your traceback, so hopefully it's obvious whether this is the problem...
  2. The hostname resolves to the wrong IP address.
    • You can test this with host username.webfactional.com or nslookup username.webfactional.com.
  3. The IP address is right, but the port is wrong (e.g. you're trying 22 and the host is using port, say, 123)
    • You can test this by printing env.port in your Fab task before any run or sudo statements.
  4. The remote end's SSH daemon is actually down or firewalled.
    • You can test this by simply using manual SSH with the above parameters (hostname, port etc) and seeing what happens.

Anyway, assuming this is still a problem (there's a comment just over a week old on that issue you linked, so I assume it is) please check on the above and let me know!

@aamiryu
Copy link

aamiryu commented Sep 5, 2016

Sorry to comment on a closed issue but here's my situation, when I warn only to true it justs warns and skips the bad host and continues. I wanted to know how to catch this type of exception and do some tasks ?

@aamiryu
Copy link

aamiryu commented Sep 5, 2016

fabric version I'm using is v1.12

@aamiryu
Copy link

aamiryu commented Sep 6, 2016

In v1.8 it is there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants