windows multiprocessing exception can't pickle salt.loaded.int.module.grains.filter_by
Hi,
i want to restart my salt-minion on windows.
I found out that therefor the multiprocessing: False flag in the config file must be set to True.
So i changed it, restarted the minion locally and then tried to restart the minion with sudo salt 'Win*' service.restart salt-minion but on the minion the service will only be stopped but never be restarted.
I saw in the log file of the minion that a exception occured after starting the minion.
Here the log file:
2014-02-06 14:55:02,807 [salt ][INFO ] Setting up the Salt Minion "Win_Server_2012_R2"
2014-02-06 14:55:02,807 [salt.utils.process][DEBUG ] Created pidfile: c:\salt\var\run\salt-minion.pid
2014-02-06 14:55:02,807 [salt.config ][DEBUG ] Reading configuration from c:\salt\conf\minion
2014-02-06 14:55:02,838 [salt.loader ][DEBUG ] loading grain in ['c:\\salt\\var\\cache\\salt\\minion\\extmods\\grains', 'c:\\salt\\salt-0.17.4-77-g45acf6a.win-amd64\\salt-0.17.4_77_g45acf6a-py2.7.egg\\salt\\grains']
2014-02-06 14:55:02,838 [salt.loader ][DEBUG ] Skipping c:\salt\var\cache\salt\minion\extmods\grains, it is not a directory
2014-02-06 14:55:03,463 [salt.minion ][DEBUG ] Attempting to authenticate with the Salt Master at 10.40.25.231
2014-02-06 14:55:03,463 [salt.crypt ][DEBUG ] Loaded minion key: c:\salt\conf\pki\minion\minion.pem
2014-02-06 14:55:04,166 [salt.crypt ][DEBUG ] Loaded minion key: c:\salt\conf\pki\minion\minion.pem
2014-02-06 14:55:04,479 [salt.crypt ][DEBUG ] Decrypting the current master AES key
2014-02-06 14:55:04,494 [salt.crypt ][DEBUG ] Loaded minion key: c:\salt\conf\pki\minion\minion.pem
2014-02-06 14:55:04,572 [salt.minion ][INFO ] Authentication with master successful!
2014-02-06 14:55:04,587 [salt.crypt ][DEBUG ] Loaded minion key: c:\salt\conf\pki\minion\minion.pem
2014-02-06 14:55:04,854 [salt.crypt ][DEBUG ] Decrypting the current master AES key
2014-02-06 14:55:04,854 [salt.crypt ][DEBUG ] Loaded minion key: c:\salt\conf\pki\minion\minion.pem
2014-02-06 14:55:05,260 [salt.crypt ][DEBUG ] Loaded minion key: c:\salt\conf\pki\minion\minion.pem
2014-02-06 14:55:05,322 [salt.config ][DEBUG ] Reading configuration from c:\salt\conf\minion
2014-02-06 14:55:05,354 [salt.loader ][DEBUG ] loading grain in ['c:\\salt\\var\\cache\\salt\\minion\\extmods\\grains', 'c:\\salt\\salt-0.17.4-77-g45acf6a.win-amd64\\salt-0.17.4_77_g45acf6a-py2.7.egg\\salt\\grains']
2014-02-06 14:55:05,354 [salt.loader ][DEBUG ] Skipping c:\salt\var\cache\salt\minion\extmods\grains, it is not a directory
2014-02-06 14:55:05,807 [salt.loader ][DEBUG ] loading module in ['c:\\salt\\var\\cache\\salt\\minion\\extmods\\modules', 'c:\\salt\\salt-0.17.4-77-g45acf6a.win-amd64\\salt-0.17.4_77_g45acf6a-py2.7.egg\\salt\\modules']
2014-02-06 14:55:05,807 [salt.loader ][DEBUG ] Skipping c:\salt\var\cache\salt\minion\extmods\modules, it is not a directory
2014-02-06 14:55:05,807 [salt.loader ][DEBUG ] Skipping win_pkg.pyc_save, it does not end with an expected extension
2014-02-06 14:55:05,947 [salt.loader ][DEBUG ] Loaded win_shadow as virtual shadow
2014-02-06 14:55:05,963 [salt.loader ][DEBUG ] Loaded win_disk as virtual disk
2014-02-06 14:55:05,963 [salt.loader ][DEBUG ] Loaded win_status as virtual status
2014-02-06 14:55:05,978 [salt.loader ][DEBUG ] Loaded win_network as virtual network
2014-02-06 14:55:05,978 [salt.loader ][DEBUG ] Loaded sysmod as virtual sys
2014-02-06 14:55:06,010 [salt.loader ][DEBUG ] Loaded win_autoruns as virtual autoruns
2014-02-06 14:55:06,010 [salt.loader ][DEBUG ] Loaded win_system as virtual system
2014-02-06 14:55:06,010 [salt.loader ][DEBUG ] Loaded win_firewall as virtual firewall
2014-02-06 14:55:06,025 [salt.loader ][DEBUG ] Loaded win_pkg as virtual pkg
2014-02-06 14:55:06,041 [salt.loader ][DEBUG ] Loaded cmdmod as virtual cmd
2014-02-06 14:55:06,041 [salt.loader ][DEBUG ] Loaded win_file as virtual file
2014-02-06 14:55:06,057 [salt.loader ][DEBUG ] Loaded virtualenv_mod as virtual virtualenv
2014-02-06 14:55:06,057 [salt.loader ][DEBUG ] Loaded djangomod as virtual django
2014-02-06 14:55:06,057 [salt.loader ][DEBUG ] Loaded win_service as virtual service
2014-02-06 14:55:06,072 [salt.loader ][DEBUG ] Loaded win_useradd as virtual user
2014-02-06 14:55:06,072 [salt.loader ][DEBUG ] Loaded win_timezone as virtual timezone
2014-02-06 14:55:06,072 [salt.loader ][DEBUG ] Loaded win_repo as virtual winrepo
2014-02-06 14:55:06,072 [salt.loader ][DEBUG ] Loaded win_groupadd as virtual group
2014-02-06 14:55:06,088 [salt.loader ][DEBUG ] loading returner in ['c:\\salt\\var\\cache\\salt\\minion\\extmods\\returners', 'c:\\salt\\salt-0.17.4-77-g45acf6a.win-amd64\\salt-0.17.4_77_g45acf6a-py2.7.egg\\salt\\returners']
2014-02-06 14:55:06,088 [salt.loader ][DEBUG ] Skipping c:\salt\var\cache\salt\minion\extmods\returners, it is not a directory
2014-02-06 14:55:06,104 [salt.loader ][DEBUG ] Loaded couchdb_return as virtual couchdb
2014-02-06 14:55:06,104 [salt.loader ][DEBUG ] Loaded carbon_return as virtual carbon
2014-02-06 14:55:06,104 [salt.minion ][INFO ] Minion is starting as user 'WIN-KU2V9NP5EVJ$'
2014-02-06 14:55:06,104 [salt.minion ][DEBUG ] Minion "Win_Server_2012_R2" trying to tune in
2014-02-06 14:55:06,104 [salt.minion ][DEBUG ] Minion PUB socket URI: tcp://127.0.0.1:4510
2014-02-06 14:55:06,104 [salt.minion ][DEBUG ] Minion PULL socket URI: tcp://127.0.0.1:4511
2014-02-06 14:55:06,104 [salt.minion ][DEBUG ] Setting zmq_reconnect_ivl to '100ms'
2014-02-06 14:55:06,104 [salt.minion ][DEBUG ] Setting zmq_reconnect_ivl_max to '5100ms'
2014-02-06 14:55:06,635 [salt.utils.schedule][DEBUG ] Running scheduled job: __mine_interval
2014-02-06 14:55:06,635 [salt.utils.schedule][DEBUG ] schedule: This job was scheduled with jid_include, adding to cache (jid_include defaults to True)
2014-02-06 14:55:06,635 [salt.utils.schedule][DEBUG ] schedule: This job was scheduled with a max number of 2
2014-02-06 14:55:06,635 [salt.minion ][ERROR ] Exception Can't pickle <function filter_by at 0x0000000002A83CF8>: it's not found as salt.loaded.int.module.grains.filter_by occurred in scheduled job
After reading a lot of issues regarding windows service self restart i found a lot of old and closed issues so i thought it must be possible to restart the salt-minion.
On my ubuntu machines i can restart the service remotely!
ups. i forgot the part of the log file after executing sudo salt 'Win*' service.restart salt-minion
2014-02-06 15:55:05,626 [salt.minion ][INFO ] User sudo_test Executing command service.restart with jid 20140206155505258036
2014-02-06 15:55:05,626 [salt.minion ][DEBUG ] Command details {'tgt_type': 'glob', 'jid': '20140206155505258036', 'tgt': 'Win*12*2', 'ret': '', 'user': 'sudo_test', 'arg': ('salt-minion',), 'fun': 'service.restart'}
after that, the service stops and do not restart.
Multiprocessing is currently broken in Windows due to a bug in the multiprocessing library. I think that's what's causing your issue. I'm closing this as a duplicate of #4598.