Trouble reloading a service


#1

I am restarting a service with chef 0.10.4 along these lines:

template ‘/etc/logfmon.conf’ do
notifies :restart, ‘service[logfmon]’

end

service ‘logfmon’ do
action [:enable, :start]
supports :reload => true, :restart => true, :status => false
end

and this works just fine:

** [out :: s2.leadkarma.com] [Fri, 20 Jul 2012 23:13:39 +0000] INFO: template[/etc/logfmon.conf] sending restart action to service[logfmon] (delayed)
** [out :: s2.leadkarma.com] [Fri, 20 Jul 2012 23:13:39 +0000] INFO: Processing service[logfmon] action restart (logfmon::default line 61)
** [out :: s2.leadkarma.com] [Fri, 20 Jul 2012 23:13:39 +0000] DEBUG: service[logfmon] supports status, running
** [out :: s2.leadkarma.com] [Fri, 20 Jul 2012 23:13:40 +0000] INFO: service[logfmon] restarted

and my service is being called:

status
status
start
status
restart

It is weird that “supports … :status => false” is not honored, but more trouble is that
changing the notifies :restart to :reload means that only these commands are issued to
my init script (i.e. not reload):

status
status
start
status

Any ideas?

/Allan

Allan Wind
Life Integrity, LLC
http://lifeintegrity.com


#2

What platform? I think the Redhat service provider has supports
:status forced to ‘true’ always or something dumb like that.

Can you show the full -l debug stack trace regarding your provider
taking action?

–AJ

On 21 July 2012 11:20, Allan Wind allan_wind@lifeintegrity.com wrote:

I am restarting a service with chef 0.10.4 along these lines:

template ‘/etc/logfmon.conf’ do
notifies :restart, ‘service[logfmon]’

end

service ‘logfmon’ do
action [:enable, :start]
supports :reload => true, :restart => true, :status => false
end

and this works just fine:

** [out :: s2.leadkarma.com] [Fri, 20 Jul 2012 23:13:39 +0000] INFO: template[/etc/logfmon.conf] sending restart action to service[logfmon] (delayed)
** [out :: s2.leadkarma.com] [Fri, 20 Jul 2012 23:13:39 +0000] INFO: Processing service[logfmon] action restart (logfmon::default line 61)
** [out :: s2.leadkarma.com] [Fri, 20 Jul 2012 23:13:39 +0000] DEBUG: service[logfmon] supports status, running
** [out :: s2.leadkarma.com] [Fri, 20 Jul 2012 23:13:40 +0000] INFO: service[logfmon] restarted

and my service is being called:

status
status
start
status
restart

It is weird that “supports … :status => false” is not honored, but more trouble is that
changing the notifies :restart to :reload means that only these commands are issued to
my init script (i.e. not reload):

status
status
start
status

Any ideas?

/Allan

Allan Wind
Life Integrity, LLC
http://lifeintegrity.com


#3

On 2012-07-21 11:23:55, AJ Christensen wrote:

Can you show the full -l debug stack trace regarding your provider
taking action?

I generated this trace centos with chef 0.10.10 but seeing the
same issue: http://pastebin.com/xCTdhXNY.

/Allan

Allan Wind
Life Integrity, LLC
http://lifeintegrity.com


#4

On Fri, Jul 20, 2012 at 4:23 PM, AJ Christensen aj@junglist.gen.nz wrote:

What platform? I think the Redhat service provider has supports
:status forced to ‘true’ always or something dumb like that.

Yep, see http://tickets.opscode.com/browse/CHEF-2345

You must use the status_command param to give it something that will
work (i.e. ‘pgrep foo’) or else fix your init script. I think I have
an idea of how to fix this but I haven’t had time yet. Because of
passing between resource and provider, the solution is a bit more
complex than it first appears.

KC


#5

On 2012-07-21 14:21:29, KC Braunschweig wrote:

On Fri, Jul 20, 2012 at 4:23 PM, AJ Christensen aj@junglist.gen.nz wrote:

What platform? I think the Redhat service provider has supports
:status forced to ‘true’ always or something dumb like that.

Yep, see http://tickets.opscode.com/browse/CHEF-2345

This explains why the chef ignores supports :status => false, but
I am afraid that I do not follow why that would cause chef to not
call reload on the init script.

/Allan

Allan Wind
Life Integrity, LLC
http://lifeintegrity.com


#6

The reload_service action more than likely has logic in it to prevent
it from firing if the application isn’t actually running… soo, a bad
status check => the service not running => service does not get
reloaded

HTH

–AJ

On 22 July 2012 09:33, Allan Wind allan_wind@lifeintegrity.com wrote:

On 2012-07-21 14:21:29, KC Braunschweig wrote:

On Fri, Jul 20, 2012 at 4:23 PM, AJ Christensen aj@junglist.gen.nz wrote:

What platform? I think the Redhat service provider has supports
:status forced to ‘true’ always or something dumb like that.

Yep, see http://tickets.opscode.com/browse/CHEF-2345

This explains why the chef ignores supports :status => false, but
I am afraid that I do not follow why that would cause chef to not
call reload on the init script.

/Allan

Allan Wind
Life Integrity, LLC
http://lifeintegrity.com


#7

On 2012-07-22 10:51:14, AJ Christensen wrote:

The reload_service action more than likely has logic in it to prevent
it from firing if the application isn’t actually running… soo, a bad
status check => the service not running => service does not get
reloaded

You are right fixing the status resolved the issue. Thanks a lot
for your help.

Recipe ask to reload a service. chef does no less than 3 status
calls which all fail with 127 in this case. chef then decides
that you reload does not make sense anyways. There are no logs
indicating any problems.

chef does the same 3 status checks for restart but decides to
restart the service anyways.

The inconsistency is strange to me, and the lack of log output
is a defect, no?

/Allan

Allan Wind
Life Integrity, LLC
http://lifeintegrity.com


#8

It does appear that some logging is missing from your pastebin, yes.
The service debug logging is much more than that :wink: usually
indicates, service supports status, running status. I’m not sure why
you aren’t seeing that.

Can you test the latest version of (pre-release?) Chef 10.14?

I’ll do the same

–AJ

On 22 July 2012 11:23, Allan Wind allan_wind@lifeintegrity.com wrote:

On 2012-07-22 10:51:14, AJ Christensen wrote:

The reload_service action more than likely has logic in it to prevent
it from firing if the application isn’t actually running… soo, a bad
status check => the service not running => service does not get
reloaded

You are right fixing the status resolved the issue. Thanks a lot
for your help.

Recipe ask to reload a service. chef does no less than 3 status
calls which all fail with 127 in this case. chef then decides
that you reload does not make sense anyways. There are no logs
indicating any problems.

chef does the same 3 status checks for restart but decides to
restart the service anyways.

The inconsistency is strange to me, and the lack of log output
is a defect, no?

/Allan

Allan Wind
Life Integrity, LLC
http://lifeintegrity.com


#9

On 2012-07-22 12:34:08, AJ Christensen wrote:

Can you test the latest version of (pre-release?) Chef 10.14?

I added status to my init script, forced an update of my config
file to trigger reload (which now works):

http://pastebin.com/2QnY6ShK

Was there another scenario you would like me to test?

/Allan

Allan Wind
Life Integrity, LLC
http://lifeintegrity.com