Service resource on windows returning error: An instance of the service is already running

Hello Chefs,

I feel as though I am mistaking something here. The basic idea of chef resources, as explained to me, is that they describe the desired state of a system. To that end, when I call:
service “My_Service” do
action :confounded:tart
end

My expectation is that it will:
Start the service if My_Service is stopped
Bail out with an error if My_Service doesn’t exist, or is in an “un-startable” state
Do nothing if My_Service is already started, as the service is already in the desired state

Unfortunately on the latter, it is throwing an error, that an instance of the service is already running.

Is this a limitation/bug in the way that chef for windows processes services, or a bug in my expectations of the functionality?

Many thanks in advance!
Dan-Joe Lopez

Sent from Windows Mail

most likely a bug. im dont have windows machine. but if you can share
stacktrace and platform/service provider detail, someone from list will be
able to help

On Tue, Jul 7, 2015 at 3:06 PM, Dan-Joe Lopez DJL@pezius.net wrote:

Hello Chefs,

I feel as though I am mistaking something here. The basic idea of chef
resources, as explained to me, is that they describe the desired state of a
system. To that end, when I call:
service “My_Service” do

action :confounded:tart

end

My expectation is that it will:

Start the service if My_Service is stopped
Bail out with an error if My_Service doesn’t exist, or is in
an “un-startable” state
Do nothing if My_Service is already started, as the service is
already in the desired state

Unfortunately on the latter, it is throwing an error, that an instance
of the service is already running.

Is this a limitation/bug in the way that chef for windows processes
services, or a bug in my expectations of the functionality?

Many thanks in advance!
Dan-Joe Lopez

Sent from Windows Mail

Here is the stacktrace:

Generated at 2015-07-07 21:42:39 +0000
SystemCallError: service[Apache2.2] (GA-apache-config::default line 26) had an error: SystemCallError: An instance of the service is already running. - StartService: An instance of the service is already running.
c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/win32-service-0.8.2/lib/win32/windows/helper.rb:36:in raise_windows_error' c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/win32-service-0.8.2/lib/win32/service.rb:723:instart’
c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.18.6-x86-mingw32/lib/chef/provider/service/windows.rb:74:in block in start_service' c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.18.6-x86-mingw32/lib/chef/provider/service/windows.rb:187:inblock in spawn_command_thread’
c:/opscode/chef/embedded/lib/ruby/1.9.1/win32ole.rb:13:in call' c:/opscode/chef/embedded/lib/ruby/1.9.1/win32ole.rb:13:inblock in initialize’

This occurred on Windows Server 2012 R2 Standard

Sent from Windows Mail

From: Dan-Joe Lopezmailto:DJL@Pezius.net
Sent: ?Tuesday?, ?July? ?7?, ?2015 ?3?:?06? ?PM
To: chef@lists.opscode.commailto:chef@lists.opscode.com

Hello Chefs,

I feel as though I am mistaking something here. The basic idea of chef resources, as explained to me, is that they describe the desired state of a system. To that end, when I call:
service “My_Service” do
action ?tart
end

My expectation is that it will:
Start the service if My_Service is stopped
Bail out with an error if My_Service doesn’t exist, or is in an “un-startable” state
Do nothing if My_Service is already started, as the service is already in the desired state

Unfortunately on the latter, it is throwing an error, that an instance of the service is already running.

Is this a limitation/bug in the way that chef for windows processes services, or a bug in my expectations of the functionality?

Many thanks in advance!
Dan-Joe Lopez

Sent from Windows Mail

i think the status check is failing. chef service providers generally uses
status checks to understand if a service is already running or not. im
looking at this code :

may be start with irb and then require that gem and execute the same code
there, to see whats wrong.

On Tue, Jul 7, 2015 at 3:18 PM, Dan-Joe Lopez DJL@pezius.net wrote:

Here is the stacktrace:

Generated at 2015-07-07 21:42:39 +0000
SystemCallError: service[Apache2.2] (GA-apache-config::default line 26)
had an error: SystemCallError: An instance of the service is already
running. - StartService: An instance of the service is already running.
c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/win32-service-0.8.2/lib/win32/windows/helper.rb:36:in
raise_windows_error' c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/win32-service-0.8.2/lib/win32/service.rb:723:in start'
c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.18.6-x86-mingw32/lib/chef/provider/service/windows.rb:74:in
block in start_service' c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.18.6-x86-mingw32/lib/chef/provider/service/windows.rb:187:in block in spawn_command_thread'
c:/opscode/chef/embedded/lib/ruby/1.9.1/win32ole.rb:13:in call' c:/opscode/chef/embedded/lib/ruby/1.9.1/win32ole.rb:13:in block in
initialize'

This occurred on Windows Server 2012 R2 Standard

Sent from Windows Mail

From: Dan-Joe Lopez DJL@Pezius.net
Sent: ‎Tuesday‎, ‎July‎ ‎7‎, ‎2015 ‎3‎:‎06‎ ‎PM
To: chef@lists.opscode.com

Hello Chefs,

I feel as though I am mistaking something here. The basic idea of chef
resources, as explained to me, is that they describe the desired state of a
system. To that end, when I call:
service “My_Service” do

action :confounded:tart

end

My expectation is that it will:

Start the service if My_Service is stopped
Bail out with an error if My_Service doesn’t exist, or is in
an “un-startable” state
Do nothing if My_Service is already started, as the service is
already in the desired state

Unfortunately on the latter, it is throwing an error, that an instance
of the service is already running.

Is this a limitation/bug in the way that chef for windows processes
services, or a bug in my expectations of the functionality?

Many thanks in advance!
Dan-Joe Lopez

Sent from Windows Mail

It sounds like the Apache service doesn’t respond well to receiving a “start” message. Most services I’ve tested and worked with can deal with receiving an extraneous start message from the service control manager.

I don’t have apache installed on any windows boxes ATM, but might be able to test tomorrow.

Steve

Steven Murawski
Community Software Development Engineer @ Chef
Microsoft MVP - PowerShell
http://stevenmurawski.com [http://stevenmurawski.com/]
On 7/7/2015 5:18:55 PM, Dan-Joe Lopez djl@pezius.net wrote:
Here is the stacktrace:

Generated at 2015-07-07 21:42:39 +0000
SystemCallError: service[Apache2.2] (GA-apache-config::default line 26) had an error: SystemCallError: An instance of the service is already running. - StartService: An instance of the service is already running.
c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/win32-service-0.8.2/lib/win32/windows/helper.rb:36:in raise_windows_error' c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/win32-service-0.8.2/lib/win32/service.rb:723:instart’
c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.18.6-x86-mingw32/lib/chef/provider/service/windows.rb:74:in block in start_service' c:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.18.6-x86-mingw32/lib/chef/provider/service/windows.rb:187:inblock in spawn_command_thread’
c:/opscode/chef/embedded/lib/ruby/1.9.1/win32ole.rb:13:in call' c:/opscode/chef/embedded/lib/ruby/1.9.1/win32ole.rb:13:inblock in initialize’

This occurred on Windows Server 2012 R2 Standard

Sent from Windows Mail

From: Dan-Joe Lopez [mailto:DJL@Pezius.net]
Sent: ‎Tuesday‎, ‎July‎ ‎7‎, ‎2015 ‎3‎:‎06‎ ‎PM
To: chef@lists.opscode.com [mailto:chef@lists.opscode.com]

Hello Chefs,

I feel as though I am mistaking something here. The basic idea of chef resources, as explained to me, is that they describe the desired state of a system. To that end, when I call:
service “My_Service” do
action :confounded:tart
end

My expectation is that it will:
Start the service if My_Service is stopped
Bail out with an error if My_Service doesn’t exist, or is in an “un-startable” state
Do nothing if My_Service is already started, as the service is already in the desired state

Unfortunately on the latter, it is throwing an error, that an instance of the service is already running.

Is this a limitation/bug in the way that chef for windows processes services, or a bug in my expectations of the functionality?

Many thanks in advance!
Dan-Joe Lopez

Sent from Windows Mail