salt icon indicating copy to clipboard operation
salt copied to clipboard

Tracebacks from walkthrough

Open MountainX opened this issue 13 years ago • 20 comments

Hi. basepi (Colton Myers) suggested that I should create an issue ("We do not like tracebacks.")

I have known about salt for less than 24 hours. I'm following the walkthrough at http://docs.saltstack.com/topics/tutorials/walkthrough.html. I have the master set up on a Ubuntu 12.04 server (Linode) and the minion is a Virtual Box Kubuntu 12.04. Salt was installed from the Ubuntu repos on both machines, as per the walkthrough instructions.

Here's my report:

root@myserver:/etc/salt# salt-key -L
Accepted Keys:
minion.example.com
tester-VirtualBox
Unaccepted Keys:
Rejected Keys:

minion.example.com is publicly accessible (it's another Linode). tester-VirtualBox is the Kubuntu 12.04 minion I mentioned.

So far, so good. But the next three examples from the walkthrough all failed. I appreciate any tips. Here are the details.

Traceback (most recent call last):
  File "/usr/bin/salt", line 10, in <module>
    salt_main()
  File "/usr/lib/pymodules/python2.7/salt/scripts.py", line 103, in salt_main
    client.run()
  File "/usr/lib/pymodules/python2.7/salt/cli/__init__.py", line 111, in run
    for full_ret in local.cmd_cli(**kwargs):
  File "/usr/lib/pymodules/python2.7/salt/client.py", line 357, in cmd_cli
    **kwargs)
  File "/usr/lib/pymodules/python2.7/salt/client.py", line 213, in run_job
    **kwargs)
  File "/usr/lib/pymodules/python2.7/salt/client.py", line 1062, in pub
    payload = sreq.send('clear', payload_kwargs)
  File "/usr/lib/pymodules/python2.7/salt/payload.py", line 187, in send
    timeout * tried
salt.exceptions.SaltReqTimeoutError: Waited 60 seconds
root@myserver:/etc/salt# salt '*' sys.doc
Traceback (most recent call last):
  File "/usr/bin/salt", line 10, in <module>
    salt_main()
  File "/usr/lib/pymodules/python2.7/salt/scripts.py", line 103, in salt_main
    client.run()
  File "/usr/lib/pymodules/python2.7/salt/cli/__init__.py", line 104, in run
    for full_ret in local.cmd_cli(**kwargs):
  File "/usr/lib/pymodules/python2.7/salt/client.py", line 357, in cmd_cli
    **kwargs)
  File "/usr/lib/pymodules/python2.7/salt/client.py", line 213, in run_job
    **kwargs)
  File "/usr/lib/pymodules/python2.7/salt/client.py", line 1062, in pub
    payload = sreq.send('clear', payload_kwargs)
  File "/usr/lib/pymodules/python2.7/salt/payload.py", line 187, in send
    timeout * tried
salt.exceptions.SaltReqTimeoutError: Waited 60 seconds
root@myserver:/etc/salt# salt '*' cmd.run 'ls -l /etc'
Traceback (most recent call last):
  File "/usr/bin/salt", line 10, in <module>
    salt_main()
  File "/usr/lib/pymodules/python2.7/salt/scripts.py", line 103, in salt_main
    client.run()
  File "/usr/lib/pymodules/python2.7/salt/cli/__init__.py", line 111, in run
    for full_ret in local.cmd_cli(**kwargs):
  File "/usr/lib/pymodules/python2.7/salt/client.py", line 357, in cmd_cli
    **kwargs)
  File "/usr/lib/pymodules/python2.7/salt/client.py", line 213, in run_job
    **kwargs)
  File "/usr/lib/pymodules/python2.7/salt/client.py", line 1062, in pub
    payload = sreq.send('clear', payload_kwargs)
  File "/usr/lib/pymodules/python2.7/salt/payload.py", line 187, in send
    timeout * tried
salt.exceptions.SaltReqTimeoutError: Waited 60 seconds

MountainX avatar Jun 25 '13 20:06 MountainX

Thanks for creating the issue. We'll look into it.

basepi avatar Jun 25 '13 20:06 basepi

Looks like something must have gone funny with the install. I've never seen this kind of a problem before. What happens if you run a salt --versions-report? Can you give me the output please?

basepi avatar Jun 25 '13 21:06 basepi

Looks like something must have gone funny with the install.

I agree. I removed salt (using apt-get purge). I am trying to install from git at the moment...

MountainX avatar Jun 25 '13 21:06 MountainX

...but I could reinstall from the Ubuntu repos if you prefer (and want to help me troubleshoot the problem). Thanks.

MountainX avatar Jun 25 '13 21:06 MountainX

I reinstalled from git. The problems persist.

How I installed (thanks to David Boucha):

If you just want to install a salt master and minion on Ubuntu from git I would just use the salt-bootstrap script:
https://github.com/saltstack/salt-bootstrap#one-line-bootstrap
Install a salt master from git: curl -L http://bootstrap.saltstack.org | sudo sh -s -- -M -N git develop

Install a salt minion from git: curl -L http://bootstrap.saltstack.org | sudo sh -s -- git develop

Here are the details of my results with the traceback:

First, on the minion:

root@minion2:~# cat /etc/hosts
127.0.0.1       localhost.localdomain   localhost
111.222.333.444  salt salt.example.com

curl -L http://bootstrap.saltstack.org | sudo sh -s -- git develop
[snip]
*  INFO: Running install_ubuntu_git_post()
*  WARN: Upstart does not apparently know anything about salt-minion
*  INFO: Running install_ubuntu_restart_daemons()
salt-minion stop/waiting
salt-minion start/running, process 17024
*  INFO: Running daemons_running()
*  INFO: Salt installed!
root@minion2:~/Workspaces# salt --versions-report
        Salt: 0.15.90
        Python: 2.6.5 (r265:79063, Oct  1 2012, 22:07:21)
        Jinja2: 2.3.1
    M2Crypto: 0.20.1
msgpack-python: 0.1.9.final
msgpack-pure: Not Installed
    pycrypto: 2.0.1
        PyYAML: 3.09
        PyZMQ: 13.0.0
            ZMQ: 3.2.2

On the master:

*  INFO: Running install_ubuntu_git_post()
*  WARN: Upstart does not apparently know anything about salt-master
*  INFO: Running install_ubuntu_restart_daemons()
salt-master stop/waiting
salt-master start/running, process 15452
*  INFO: Running daemons_running()
*  INFO: Salt installed!
root@master:~/Workspaces# salt-key -L
Accepted Keys:
Unaccepted Keys:
minion2.example.com
tester-VirtualBox
Rejected Keys:
root@master:~/Workspaces# salt-key -A
The following keys are going to be accepted:
Unaccepted Keys:
minion2.example.com
tester-VirtualBox
Proceed? [n/Y] y      
Key for minion minion2.example.com accepted.
Key for minion tester-VirtualBox accepted.
root@master:~/Workspaces# salt-key -L
Accepted Keys:
minion2.example.com
tester-VirtualBox
Unaccepted Keys:
Rejected Keys:
root@master:~/Workspaces# salt '*' test.ping
Traceback (most recent call last):
File "/usr/bin/salt", line 10, in <module>
    salt_main()
File "/usr/lib/python2.7/dist-packages/salt/scripts.py", line 103, in salt_main
    client.run()
File "/usr/lib/python2.7/dist-packages/salt/cli/__init__.py", line 117, in run
    for full_ret in cmd_func(**kwargs):
File "/usr/lib/python2.7/dist-packages/salt/client.py", line 357, in cmd_cli
    **kwargs)
File "/usr/lib/python2.7/dist-packages/salt/client.py", line 213, in run_job
    **kwargs)
File "/usr/lib/python2.7/dist-packages/salt/client.py", line 1087, in pub
    payload = sreq.send('clear', payload_kwargs)
File "/usr/lib/python2.7/dist-packages/salt/payload.py", line 187, in send
    timeout * tried
salt.exceptions.SaltReqTimeoutError: Waited 60 seconds

\# ls -la /var/log/salt/master
-rw-r--r-- 1 root root 0 Jun 25 21:19 /var/log/salt/master

\# ls -la /var/log/salt/
total 8
drwxr-xr-x  2 root root 4096 Jun 25 21:19 .
drwxr-xr-x 17 root root 4096 Jun 25 21:19 ..
-rw-r--r--  1 root root    0 Jun 25 00:58 key
-rw-r--r--  1 root root    0 Jun 25 21:19 master

\# salt --versions-report
        Salt: 0.15.90
        Python: 2.7.3 (default, Aug  1 2012, 05:16:07)
        Jinja2: 2.6
    M2Crypto: 0.21.1
msgpack-python: 0.1.10
msgpack-pure: Not Installed
    pycrypto: 2.4.1
        PyYAML: 3.10
        PyZMQ: 13.0.0
            ZMQ: 3.2.2

MountainX avatar Jun 25 '13 21:06 MountainX

more info:

root@minion2:~# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 10.04.4 LTS Release: 10.04 Codename: lucid

root@mysaltmaster:/etc/salt# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 12.04.2 LTS Release: 12.04 Codename: precise

Selected lines from bash istory: 636 iptables -A INPUT -m state --state new -m tcp -p tcp --dport 4505 -j ACCEPT 637 iptables -A INPUT -m state --state new -m tcp -p tcp --dport 4506 -j ACCEPT

MountainX avatar Jun 25 '13 21:06 MountainX

This is very strange -- like I said I've never seen this error before. But we will figure it out, we want you to be able to use Salt!

basepi avatar Jun 26 '13 16:06 basepi

Talked to @thatch45 and he still thinks it's a communication issue, perhaps a firewall issue.

Can you give us the output of iptables -L? Thanks.

basepi avatar Jun 27 '13 21:06 basepi

Has this issue been resolved yet? I'm having the same problem :( Installed from the Ubuntu Repos

swiftimundo avatar Jul 22 '13 19:07 swiftimundo

We think this is a communication issue on the user's network, do you have a firewall anywhere in the mix @swiftimundo ?

thatch45 avatar Jul 22 '13 20:07 thatch45

@thatch45 There is no firewall in the mix. IPtables are empty and hosts are on the same network.

swiftimundo avatar Jul 22 '13 22:07 swiftimundo

Is the minion configured to the correct master?

thatch45 avatar Jul 23 '13 01:07 thatch45

@thatch45 It is. I've been able to issue commands and had states run properly.

swiftimundo avatar Jul 23 '13 12:07 swiftimundo

To clarify the command that gave me the error is: # salt '*' sys.doc

swiftimundo avatar Jul 23 '13 12:07 swiftimundo

@thatch45 We're seeing this issue as well. Definitely not a firewall issue and @clusterfudge says that the failure occurs a low percentage of time. @clusterfudge reports that the failures occur periodically and is a big issue for him. Any ideas on what could cause the issue? Packet loss? Is there anything I can do? The timeout in the code around where the exception is thrown doesn't appear to be configurable either...

We're using:

$ salt-minion --versions-report
           Salt: 0.15.3
         Python: 2.7.3 (default, Aug  1 2012, 05:14:39)
         Jinja2: 2.6
       M2Crypto: 0.21.1
 msgpack-python: 0.1.10
   msgpack-pure: Not Installed
       pycrypto: 2.4.1
         PyYAML: 3.10
          PyZMQ: 13.0.0
            ZMQ: 3.2.2

dlindquist avatar Aug 22 '13 01:08 dlindquist

Hmm, this would error out only if the master's req_port was not returning, and since I cannot reliably reproduce this it will be tricky to debug. I am thinking that there is a race condition hidden in the master's evaluation of the publication before firing it off causing the master to never return (although the master is made to ALWAYS return...)

Can I persuade you to try and just add tries=3 to the sreq.send method? payload = sreq.send('clear', payload_kwargs, tries=3) and let me know if it makes it any better?

thatch45 avatar Aug 26 '13 18:08 thatch45

Thanks @thatch45!!

Applied the following patch on the master:

--- salt/client.py.old  2013-08-26 11:41:45.009976905 -0700
+++ salt/client.py      2013-08-26 11:42:06.969506663 -0700
@@ -1059,7 +1059,7 @@
         sreq = salt.payload.SREQ(
             'tcp://{0[interface]}:{0[ret_port]}'.format(self.opts),
         )
-        payload = sreq.send('clear', payload_kwargs)
+        payload = sreq.send('clear', payload_kwargs, tries=3)

         if not payload:
             # The master key could have changed out from under us! Regen

@clusterfudge and I will keep an eye out over the next week or so and see if this resolves the issue. It's been hard for us to reproduce as well...

dlindquist avatar Aug 26 '13 18:08 dlindquist

this MIGHT be related to #4617 so that patch might be worth trying as well

thatch45 avatar Aug 26 '13 21:08 thatch45

Please try the patch posted by thatch45 in bug #4617 to see if it fixes your woes. I will try it today.

ManuelAmadorAditazz avatar Aug 26 '13 23:08 ManuelAmadorAditazz

I can't reproduce this anymore and we have not heard back, closing

thatch45 avatar Sep 09 '13 16:09 thatch45