Simultaneous chef run handling on linux/windows

Here I am, back with more windows questions…

We have just started to run chef in daemon mode. Previously we had only
been running it on demand.

Our deployment scripts trigger chef runs, and can be fired off at any time.

On Linux, if the chef-client daemon is running, you get a warning message:
[2013-08-16T14:28:27-04:00] WARN: Chef client is running, will wait for it
to finish and then run.

And things go along happily from there.

On Windows, you get:
[2013-08-16T14:23:44-04:00] FATAL: Errno::EACCES: Permission denied -
C:/chef/cache/chef-client-running.pid

Is there a setting in client.rb / something I can do to prevent these
errors on Windows?

Brian

Brian Anderson | Operations Engineer
Phone 781.696.1304

www.affectiva.com
http://www.facebook.com/affectiva https://twitter.com/Affectiva
http://www.youtube.com/user/affectiva
http://www.affectiva.com/blog/ http://www.linkedin.com/company/affectiva_2
https://plus.google.com/b/115885368219797754125/115885368219797754125/posts

Thanks for reporting this one as well Brian…

http://tickets.opscode.com/browse/CHEF-4470

My suspicion is that here (https://github.com/opscode/chef/blob/master/lib/chef/run_lock.rb#L61) FD_CLOEXEC is creating some issues on windows.

You can work around this by setting splay to 0 and instead of running “chef-client” during deployment you can run “net stop chef-client && net start chef-client”.

Thanks,
Serdar


From: Brian Anderson brian.anderson@affectiva.com
Sent: Friday, August 16, 2013 9:32 PM
To: chef@lists.opscode.com
Subject: [chef] Simultaneous chef run handling on linux/windows

Here I am, back with more windows questions…

We have just started to run chef in daemon mode. Previously we had only been running it on demand.

Our deployment scripts trigger chef runs, and can be fired off at any time.

On Linux, if the chef-client daemon is running, you get a warning message:
[2013-08-16T14:28:27-04:00] WARN: Chef client is running, will wait for it to finish and then run.

And things go along happily from there.

On Windows, you get:
[2013-08-16T14:23:44-04:00] FATAL: Errno::EACCES: Permission denied - C:/chef/cache/chef-client-running.pid

Is there a setting in client.rb / something I can do to prevent these errors on Windows?

Brian

Brian Anderson | Operations Engineer
Phone 781.696.1304
[http://www.finsmes.com/wp-content/uploads/2011/07/Affectiva_logo_JPG.jpg]
www.affectiva.comhttp://www.affectiva.com/
[http://www.snoitulosten.com/wp-content/uploads/2010/01/facebook-small.jpg]http://www.facebook.com/affectiva [http://www.snoitulosten.com/wp-content/uploads/2010/01/twitter-small.jpg] https://twitter.com/Affectiva [http://images4.wikia.nocookie.net/__cb20101115140837/finalfantasy/images/9/93/Youtube_icon_logo.gif] http://www.youtube.com/user/affectiva [http://brendanmitchell.files.wordpress.com/2009/03/blog-icon-200.png] http://www.affectiva.com/blog/ [http://www.itprosphilly.com/wp-content/uploads/2011/08/linkedin-icon-small.png] http://www.linkedin.com/company/affectiva_2 [http://www.thesimplerweb.com/wp-content/uploads/2012/08/google-plus-icon.jpg?cda6c1] https://plus.google.com/b/115885368219797754125/115885368219797754125/posts

I'm glad to see that it was reproducible!

I'll have to add some additional handling in our scripts to do the
stop/start of the client when the target is windows.

Brian

On Fri, Aug 16, 2013 at 5:04 PM, Serdar Sutay serdar@opscode.com wrote:

Thanks for reporting this one as well Brian...

http://tickets.opscode.com/browse/CHEF-4470

My suspicion is that here (
chef/lib/chef/run_lock.rb at main · chef/chef · GitHub) FD_CLOEXEC
is creating some issues on windows.

You can work around this by setting splay to 0 and instead of running
"chef-client" during deployment you can run "net stop chef-client && net
start chef-client".

Thanks,
Serdar

From: Brian Anderson brian.anderson@affectiva.com
Sent: Friday, August 16, 2013 9:32 PM
To: chef@lists.opscode.com
Subject: [chef] Simultaneous chef run handling on linux/windows

Here I am, back with more windows questions...

We have just started to run chef in daemon mode. Previously we had only
been running it on demand.

Our deployment scripts trigger chef runs, and can be fired off at any
time.

On Linux, if the chef-client daemon is running, you get a warning
message:
[2013-08-16T14:28:27-04:00] WARN: Chef client is running, will wait for
it to finish and then run.

And things go along happily from there.

On Windows, you get:
[2013-08-16T14:23:44-04:00] FATAL: Errno::EACCES: Permission denied -
C:/chef/cache/chef-client-running.pid

Is there a setting in client.rb / something I can do to prevent these
errors on Windows?

Brian

Brian Anderson | Operations Engineer
Phone 781.696.1304

www.affectiva.com
http://www.facebook.com/affectiva https://twitter.com/Affectiva http://www.youtube.com/user/affectiva
http://www.affectiva.com/blog/ http://www.linkedin.com/company/affectiva_2
https://plus.google.com/b/115885368219797754125/115885368219797754125/posts

--
Brian Anderson | Operations Engineer
Phone 781.696.1304

http://www.facebook.com/affectiva https://twitter.com/Affectiva
http://www.youtube.com/user/affectiva
http://www.affectiva.com/blog/ http://www.linkedin.com/company/affectiva_2
https://plus.google.com/b/115885368219797754125/115885368219797754125/posts