salt icon indicating copy to clipboard operation
salt copied to clipboard

salt-minion in restart loop

Open leonhedding opened this issue 12 years ago • 27 comments

Running salt-minion 2014.1.1 on our Windows servers. Over the last couple of days the minions on random different servers are breaking and in a constant service restart loop. So far I have seen it on Windows 2008 R2 64-bit and 32-bit servers. Not seen it yet on Windows 2003 R2 or Windows 2012 R2.

This is what I see in the event viewer. It repeats every 10 seconds. It has taken my Windows server out a couple of times and made them inoperable so I have to disable the salt-minion service on the Windows servers until further notice. When it is in the restart loop the salt-minion does not respond to test.pings from the master.

           Salt: 2014.1.1
         Python: 2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)]
         Jinja2: 2.7.1
       M2Crypto: 0.21.1
 msgpack-python: 0.4.2
   msgpack-pure: Not Installed
       pycrypto: 2.6
         PyYAML: 3.10
          PyZMQ: 14.1.1
            ZMQ: 4.0.4


Log Name:      Application
Source:        nssm
Date:          4/17/2014 5:17:46 PM
Event ID:      1013
Task Category: None
Level:         Information
Keywords:      Classic
User:          N/A
Computer:      QTS-MBX1-1.global.local
Description:
Program c:\salt\salt-minion.exe for service salt-minion exited with return code 1.
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name="nssm" />
    <EventID Qualifiers="16384">1013</EventID>
    <Level>4</Level>
    <Task>0</Task>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2014-04-17T17:17:46.000Z" />
    <EventRecordID>304248336</EventRecordID>
    <Channel>Application</Channel>
    <Computer>QTS-MBX1-1.global.local</Computer>
    <Security />
  </System>
  <EventData>
    <Data>c:\salt\salt-minion.exe</Data>
    <Data>salt-minion</Data>
    <Data>1</Data>
  </EventData>
</Event>
Log Name:      Application
Source:        nssm
Date:          4/17/2014 5:17:46 PM
Event ID:      1023
Task Category: None
Level:         Information
Keywords:      Classic
User:          N/A
Computer:      QTS-MBX1-1.global.local
Description:
Killing process tree of process 8672 for service salt-minion with exit code 1
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name="nssm" />
    <EventID Qualifiers="16384">1023</EventID>
    <Level>4</Level>
    <Task>0</Task>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2014-04-17T17:17:46.000Z" />
    <EventRecordID>304248337</EventRecordID>
    <Channel>Application</Channel>
    <Computer>QTS-MBX1-1.global.local</Computer>
    <Security />
  </System>
  <EventData>
    <Data>salt-minion</Data>
    <Data>8672</Data>
    <Data>1</Data>
  </EventData>
</Event>
Log Name:      Application
Source:        nssm
Date:          4/17/2014 5:17:46 PM
Event ID:      1027
Task Category: None
Level:         Information
Keywords:      Classic
User:          N/A
Computer:      QTS-MBX1-1.global.local
Description:
Killing PID 8672 in process tree of PID 8672 because service salt-minion is stopping.
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name="nssm" />
    <EventID Qualifiers="16384">1027</EventID>
    <Level>4</Level>
    <Task>0</Task>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2014-04-17T17:17:46.000Z" />
    <EventRecordID>304248338</EventRecordID>
    <Channel>Application</Channel>
    <Computer>QTS-MBX1-1.global.local</Computer>
    <Security />
  </System>
  <EventData>
    <Data>8672</Data>
    <Data>8672</Data>
    <Data>salt-minion</Data>
  </EventData>
</Event>
Log Name:      Application
Source:        nssm
Date:          4/17/2014 5:17:46 PM
Event ID:      1014
Task Category: None
Level:         Information
Keywords:      Classic
User:          N/A
Computer:      QTS-MBX1-1.global.local
Description:
Service salt-minion action for exit code 1 is Restart. Attempting to restart c:\salt\salt-minion.exe.
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name="nssm" />
    <EventID Qualifiers="16384">1014</EventID>
    <Level>4</Level>
    <Task>0</Task>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2014-04-17T17:17:46.000Z" />
    <EventRecordID>304248339</EventRecordID>
    <Channel>Application</Channel>
    <Computer>QTS-MBX1-1.global.local</Computer>
    <Security />
  </System>
  <EventData>
    <Data>salt-minion</Data>
    <Data>1</Data>
    <Data>Restart</Data>
    <Data>c:\salt\salt-minion.exe</Data>
  </EventData>
</Event>
Log Name:      Application
Source:        nssm
Date:          4/17/2014 5:17:47 PM
Event ID:      1008
Task Category: None
Level:         Information
Keywords:      Classic
User:          N/A
Computer:      QTS-MBX1-1.global.local
Description:
Started c:\salt\salt-minion.exe -c c:\salt\conf -l quiet for service salt-minion in c:\salt.
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name="nssm" />
    <EventID Qualifiers="16384">1008</EventID>
    <Level>4</Level>
    <Task>0</Task>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2014-04-17T17:17:47.000Z" />
    <EventRecordID>304248340</EventRecordID>
    <Channel>Application</Channel>
    <Computer>QTS-MBX1-1.global.local</Computer>
    <Security />
  </System>
  <EventData>
    <Data>c:\salt\salt-minion.exe</Data>
    <Data>-c c:\salt\conf -l quiet</Data>
    <Data>salt-minion</Data>
    <Data>c:\salt</Data>
  </EventData>
</Event>

leonhedding avatar Apr 17 '14 19:04 leonhedding

Very strange. @UtahDave have you seen anything like this recently?

basepi avatar Apr 18 '14 19:04 basepi

I haven't seen this yet. Could you test on a newer version of Salt, @leonhedding ?

UtahDave avatar Apr 18 '14 20:04 UtahDave

I think I am using the latest Windows release. At least the newest one available with an installer.

Cheers,

Leon Hedding

From: David Boucha [mailto:[email protected]] Sent: 18 April 2014 21:23 To: saltstack/salt Cc: Leon Hedding (ICT) Subject: Re: [salt] salt-minion in restart loop (#12086)

I haven't seen this yet. Could you test on a newer version of Salt, @leonheddinghttps://github.com/leonhedding ?

— Reply to this email directly or view it on GitHubhttps://github.com/saltstack/salt/issues/12086#issuecomment-40841146.


OM International Services (Carlisle) Ltd - Unit B Clifford Court, Cooper Way - Carlisle CA3 0JG - United Kingdom Charity reg no: 1112655 - Company reg no: 5649412 (England and Wales)

leonhedding avatar Apr 19 '14 07:04 leonhedding

Well, I'm sad to say that I have the exact same problem on random machine running windows 7 Pro also.

It is really random because sometimes, the machine works fine, and other times is keeps hanging and I have to do a hard reset of the computer...

I have been able to start the minion in debug mode and see this error:

[ERROR ] An un-handled exception was caught by salt's global exception handler : ExtraData: unpack(b) received extra data. Traceback (most recent call last): File "", line 6, in File "main.py", line 726, in File "main.py", line 332, in bootstrap File "main.py", line 359, in chainload File "main.py", line 715, in _chainload File "main.py", line 128, in File "main__salt-minion.py", line 17, in File "salt/scripts.py", line 35, in salt_minion File "salt/init.py", line 221, in start File "salt/init.py", line 209, in prepare File "salt/minion.py", line 559, in init File "salt/utils/schedule.py", line 75, in init File "salt/utils/schedule.py", line 282, in clean_proc_dir File "salt/payload.py", line 108, in load File "salt/payload.py", line 95, in loads File "msgpack/fallback.py", line 97, in unpackb ExtraData: unpack(b) received extra data. Traceback (most recent call last): File "", line 6, in File "main.py", line 726, in File "main.py", line 332, in bootstrap File "main.py", line 359, in chainload File "main.py", line 715, in _chainload File "main.py", line 128, in File "main__salt-minion.py", line 17, in File "salt/scripts.py", line 35, in salt_minion File "salt/init.py", line 221, in start File "salt/init.py", line 209, in prepare File "salt/minion.py", line 559, in init File "salt/utils/schedule.py", line 75, in init File "salt/utils/schedule.py", line 282, in clean_proc_dir File "salt/payload.py", line 108, in load File "salt/payload.py", line 95, in loads File "msgpack/fallback.py", line 97, in unpackb raise ExtraData(ret, unpacker._fb_get_extradata()) msgpack.exceptions.ExtraData: unpack(b) received extra data.

Which makes me think that this error happenened sometimes, and the system try to restart the service in loop but failed , which causes the system to hang and freeze...

For now, I disable the minion and the system runs fine, but I'am really sad to do this... What is driving me crazy is the fact that it is completly random... A machine could be running ok for hours, and suddenly it freezes completly.

I have tried to reinstall the minion on a machine, and I will check the results during the week. I also tried to delete the key on the same computer. I will keep you in touch.

patcardin avatar Jun 02 '14 15:06 patcardin

I have found that Salt Minion 2014.1.3 is running stable in our Windows environment now. I am now updating to 2014.1.4 and hope that I don't see these same errors.

leonhedding avatar Jun 02 '14 15:06 leonhedding

Well... This is interesting. I am already with Salt Minion 2014.1.4 on all my windows 7 pro machines and the problem is still there...

patcardin avatar Jun 02 '14 15:06 patcardin

@patcardin are you running a non-english version of Windows?

UtahDave avatar Jun 02 '14 20:06 UtahDave

We've updated nssm here as well: https://github.com/saltstack/salt/pull/12486 the updated version of nssm will be in the next full feature release.

You might try updating nssm to the latest version http://nssm.cc/download

UtahDave avatar Jun 02 '14 20:06 UtahDave

I have tried to roll out the new nssm.exe because I was seeing errors for it in the event viewer on our 2012 r2 server out but I get this error when I run the command: cp.get_file salt://nssm.exe 'c:\salt\nssm.exe'

    The minion function caused an exception: Traceback (most recent call last):
      File "salt/minion.py", line 793, in _thread_return
      File "salt/modules/cp.py", line 166, in get_file
      File "salt/fileclient.py", line 927, in get_file
      File "salt/utils/__init__.py", line 1068, in fopen
    IOError: [Errno 13] Permission denied: 'c:\\salt\\nssm.exe'

leonhedding avatar Jun 02 '14 21:06 leonhedding

As I think more about replacing this file, it would appear that it can't be done while the salt-minion is running since the nssm process is running and locks that file. How do you suggest replacing this file then?

leonhedding avatar Jun 02 '14 21:06 leonhedding

No , all my fleaky minions are english. i have about 1% french of win7, but no problem on them yet with the minions..

Le 2014-06-02 16:07, "David Boucha" [email protected] a écrit :

@patcardin are you running a non-english version of Windows?

— Reply to this email directly or view it on GitHub.

patcardin avatar Jun 02 '14 22:06 patcardin

This is what I have written to replace the nssm.exe file. It seems to have worked.

salt -C 'G@os:Windows' cp.get_file salt://nssm.exe c:\salt\nssm.exe.new

salt -C 'G@os:Windows' cmd.script salt://nssmfix.ps1 shell='powershell'

contents of the powershell script

Schtasks /Create /RU "NT AUTHORITY\SYSTEM" /TN "Stop salt-minion" /TR "cmd /c 'net stop salt-minion'" /SC Once /ST (Get-Date).AddMinutes(1).ToString("HH:mm") /F /V1 /Z
Schtasks /Create /RU "NT AUTHORITY\SYSTEM" /TN "copy file" /TR "cmd /c 'copy c:\salt\nssm.exe.new c:\salt\nssm.exe'" /SC Once /ST (Get-Date).AddMinutes(2).ToString("HH:mm") /F /V1 /Z
Schtasks /Create /RU "NT AUTHORITY\SYSTEM" /TN "Start salt-minion" /TR "cmd /c 'net start salt-minion'" /SC Once /ST (Get-Date).AddMinutes(3).ToString("HH:mm") /F /V1 /Z```

leonhedding avatar Jun 03 '14 19:06 leonhedding

OK, so the updated nssm seems to fix this issue?

UtahDave avatar Jun 04 '14 16:06 UtahDave

No. I actually had to disable the salt-minion on my windows servers because I had 3 lock up during and even after rolling out the nssm fix.

leonhedding avatar Jun 04 '14 16:06 leonhedding

@leonhedding, did the entire windows server lock up? Is there anything in the Windows event viewer about this? Or in the Salt minion logs?

UtahDave avatar Jun 04 '14 17:06 UtahDave

The server locked up. I could not login through the console. I had to force a reboot of the server (it is virtualised.) I have yet to review the event viewer and a default install on Windows I don't think it creates any useful log files?

leonhedding avatar Jun 04 '14 17:06 leonhedding

@leonhedding and the servers don't lock up if the salt-minion service is disabled?

Do your servers lock up just by having the salt-minion running, or do you have to run a Salt command to get it to lock up?

UtahDave avatar Jun 04 '14 20:06 UtahDave

I am not certain. In the past they have locked up just by having the minion running. This last time obviously I was replacing nssm.exe and it locked up then. So it might have locked up anyway.

leonhedding avatar Jun 04 '14 21:06 leonhedding

Definitely locking up without running any salt commands against it. This is what I have in the event viewer repeatedly: http://pastebin.com/6sWbK0aF. There was nothing else in the event viewer indicating the problem apart from the fact that the server that locked up could not connect to a remote MS SQL server during the outage.

I could not login through the console or get remote network connections to the server while it was unresponsive.

No log file generated as I had thought for the salt-minion.

leonhedding avatar Jun 05 '14 11:06 leonhedding

Disabling the salt-minion service in my windows keeps them away from any bug or lag... Or, stopping the master and all my minion with the service running didn't produce any bug... So it looks like the communication between the master and minions sometimes create hang that is exactly the same as leaonhedding has. Without running any commands on minion... Le 2014-06-05 07:19, "leonhedding" [email protected] a écrit :

Definitely locking up without running any salt commands against it. This is what I have in the event viewer repeatedly: http://pastebin.com/6sWbK0aF. There was nothing else in the event viewer indicating the problem apart from the fact that the server that locked up could not connect to a remote MS SQL server during the outage.

I could not login through the console or get remote network connections to the server while it was unresponsive.

No log file generated as I had thought for the salt-minion.

— Reply to this email directly or view it on GitHub https://github.com/saltstack/salt/issues/12086#issuecomment-45207482.

patcardin avatar Jun 13 '14 20:06 patcardin