# Sensu service start on windows fails

**URL:** <https://discourse.sensu.io/t/sensu-service-start-on-windows-fails/317>\
**Category:** Sensu Classic (EOL)\
**Created:** [December 1, 2014, 12:09pm UTC](https://discourse.sensu.io/t/sensu-service-start-on-windows-fails/317 "2014-12-01T12:09:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oded\_Gold](https://avatars.discourse-cdn.com/v4/letter/o/f07891/32.png) [@Oded\_Gold](https://discourse.sensu.io/u/Oded_Gold)\
**Post date:** [December 1, 2014, 12:09pm UTC](https://discourse.sensu.io/t/sensu-service-start-on-windows-fails/317/1 "2014-12-01T12:09:10Z")

</div>

Hi All

I am looking for some help with my sensu service on windows. I have installed sensu and created the service but when I try to start the service I get the following error

“ **Error 1067: the process terminated unexpectedly** ”

When I go to the logs I get the following:

C:/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3-x86-mingw32/lib/eventmachine.rb:859:in `open\_udp\_socket’: no datagram socket (RuntimeError)

```
from C:/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3-x86-mingw32/lib/eventmachine.rb:859:in `open_datagram_socket'

from C:/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-0.12.6/lib/sensu/client.rb:257:in `setup_sockets'

from C:/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-0.12.6/lib/sensu/client.rb:293:in `start'

from C:/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-0.12.6/lib/sensu/client.rb:13:in `block in run'

from C:/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3-x86-mingw32/lib/eventmachine.rb:187:in `call'

from C:/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3-x86-mingw32/lib/eventmachine.rb:187:in `run_machine'

from C:/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3-x86-mingw32/lib/eventmachine.rb:187:in `run'

from C:/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-0.12.6/lib/sensu/client.rb:12:in `run'

from C:/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-0.12.6/bin/sensu-client:10:in `<top (required)>'

from C:/opt/sensu/embedded/bin/sensu-client:23:in `load'

from C:/opt/sensu/embedded/bin/sensu-client:23:in `<main>'

```

The service was working before this is since I tried to add new service on the machine to monitor and even if I roll back to the previous state the service wont start and gives the same error.

I thought it might be a permissions issue I tried creating a new user with admin privileges and using the admin user but none seemed to work.

Does anyone know what could be causing this issue?

Thank you

---

<div class="post-metadata">

**Author:** ![Kyle\_Anderson](https://avatars.discourse-cdn.com/v4/letter/k/e5b9ba/32.png) [@Kyle\_Anderson](https://discourse.sensu.io/u/Kyle_Anderson)\
**Post date:** [December 1, 2014, 3:15pm UTC](https://discourse.sensu.io/t/sensu-service-start-on-windows-fails/317/2 "2014-12-01T15:15:58Z")

</div>

> <https://github.com/sensu/sensu/issues/759>
>
> After restarting sensu-client on all of our Windows boxes, it crashed and never …started back up again. The error it spits out is as follows:
> 
> \`\`\`
> {"timestamp":"2014-07-10T17:30:10.686906+0000","level":"warn","message":"config file applied changes","config\_file":"C:/etc/sensu/conf.d/checks/service\_check.json","changes":{"checks":{"service\_check":\[null,{"command":"C:\\\\etc\\\\sensu/plugins/http/check-http.rb -h localhost -p /api/version","handlers":\["default"\],"standalone":true,"interval":60}\]}}}
> {"timestamp":"2014-07-10T17:30:10.686906+0000","level":"warn","message":"config file applied changes","config\_file":"C:/etc/sensu/conf.d/client.json","changes":{"client":\[null,{"name":"win-compare-prod02","address":"XXXXXXX","subscriptions":\["all"\]}\]}}
> {"timestamp":"2014-07-10T17:30:10.686906+0000","level":"info","message":"loaded extension","type":"mutator","name":"only\_check\_output","description":"returns check output"}
> {"timestamp":"2014-07-10T17:30:10.686906+0000","level":"info","message":"loaded extension","type":"handler","name":"debug","description":"outputs json event data"}
> C:/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3-x86-mingw32/lib/eventmachine.rb:859:in \`open\_udp\_socket': no datagram socket (RuntimeError)
> from C:/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3-x86-mingw32/lib/eventmachine.rb:859:in \`open\_datagram\_socket'
> from C:/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-0.12.6/lib/sensu/client.rb:257:in \`setup\_sockets'
> from C:/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-0.12.6/lib/sensu/client.rb:293:in \`start'
> from C:/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-0.12.6/lib/sensu/client.rb:13:in \`block in run'
> from C:/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3-x86-mingw32/lib/eventmachine.rb:187:in \`call'
> from C:/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3-x86-mingw32/lib/eventmachine.rb:187:in \`run\_machine'
> from C:/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3-x86-mingw32/lib/eventmachine.rb:187:in \`run'
> from C:/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-0.12.6/lib/sensu/client.rb:12:in \`run'
> from C:/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-0.12.6/bin/sensu-client:10:in \`\<top (required)\>'
> from C:/opt/sensu/embedded/bin/sensu-client:23:in \`load'
> from C:/opt/sensu/embedded/bin/sensu-client:23:in \`\<main\>'
> \`\`\`
> 
> sensu-client version: 0.12.6-4
> Windows version: 2008 R2
> 
> Configuration is very simple and was working fine until we restarted the client :-)
> 
> config.json:
> 
> \`\`\`
> {
> "rabbitmq": {
> "host": "XXXXX",
> "port": 5671,
> "vhost": "/sensu",
> "user": "sensu",
> "password": "XXXXXX",
> "ssl": {
> "cert\_chain\_file": "C:\\\\etc\\\\sensu\\\\ssl\\\\cert.pem",
> "private\_key\_file": "C:\\\\etc\\\\sensu\\\\ssl\\\\key.pem"
> }
> },
> "redis": {
> "host": "XXXXX",
> "port": 6379
> },
> "api": {
> "host": "XXXXX",
> "bind": "0.0.0.0",
> "port": 4567
> }
> }
> \`\`\`
> 
> client.json:
> 
> \`\`\`
> {
> "client": {
> "name": "win-prod02",
> "address": "XXXXX",
> "subscriptions": \[
> "all"
> \]
> }
> }
> \`\`\`
> 
> The way we came across this was when we tried to simulate the crash of the host. We stopped sensu-client like this:
> 
> \`\`\`
> net stop sensu-client
> \`\`\`
> 
> The alert was raised properly but we were never able to bring the service back up.

Also

> <https://github.com/sensu/sensu/issues/611>
>
> Guys, Hi. I have recently faced some serious issues/blockers with the Windows po…rt of the SENSU client, latest version. Here is the story. In short, following a crash or a a graceful shutdown, checks being executed may not receive or interpret the termination signal from the parent PID and get stuck, running as “orphans”. The very unfortunate side-effect of this is that somehow the two TCP and UDP sockets, port 3030, that SENSU is allocating at start-up are not released and remain bound to a generic “system” process, without any PID reference to it. As a consequence, in the circumstances described above, the client couldn’t be started again without changing the port numbers. (i.e.: or a reboot; the sockets cannot be closed with TCPView or Cports, etc…)
> 
> To be more specific, SENSU is relying on the EVENTMACHINE module... The latter is by default using SO\_REUSEADDR socket option for TCP. This is for some reasons not the case for UDP. It is where the exception was triggered. Having said that, a proper clean-up has to happen. The contrary is not really negotiable, at least to me.
> 
> What I currently have to do is working around this situation with changes to the "sensu-client.xml": whenever the service is stopped it has to “terminate” all of its children and whenever it is started it should clean-up potential “zombies”. 
> 
> It was tested with the "sensu-0.9.12-2" and "sensu-0.10.2-1" MSI(s) on "Windows 2008 R2 standard edition".
> 
> I would like to raise that as a bug. 
> 
> Regards, Andrei

> **···**
>
> On Mon, Dec 1, 2014 at 4:09 AM, Oded Gold \<oded.gold@signalsgroup.com\> wrote:
> 
> > Hi All
> > 
> > I am looking for some help with my sensu service on windows. I have  
> > installed sensu and created the service but when I try to start the service  
> > I get the following error
> > 
> > "Error 1067: the process terminated unexpectedly"
> > 
> > When I go to the logs I get the following:
> > 
> > C:/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3-x86-mingw32/lib/eventmachine.rb:859:in  
> > `open\_udp\_socket': no datagram socket (RuntimeError)  
> > from  
> > C:/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3-x86-mingw32/lib/eventmachine.rb:859:in  
> > `open\_datagram\_socket'  
> > from  
> > C:/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-0.12.6/lib/sensu/client.rb:257:in  
> > `setup\_sockets'  
> > from  
> > C:/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-0.12.6/lib/sensu/client.rb:293:in  
> > `start'  
> > from  
> > C:/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-0.12.6/lib/sensu/client.rb:13:in  
> > `block in run'  
> > from  
> > C:/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3-x86-mingw32/lib/eventmachine.rb:187:in  
> > `call'  
> > from  
> > C:/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3-x86-mingw32/lib/eventmachine.rb:187:in  
> > `run\_machine'  
> > from  
> > C:/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3-x86-mingw32/lib/eventmachine.rb:187:in  
> > `run'  
> > from  
> > C:/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-0.12.6/lib/sensu/client.rb:12:in  
> > `run'  
> > from  
> > C:/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-0.12.6/bin/sensu-client:10:in  
> > `\<top (required)\>'  
> > from C:/opt/sensu/embedded/bin/sensu-client:23:in `load'  
> > from C:/opt/sensu/embedded/bin/sensu-client:23:in `\<main\>'
> > 
> > The service was working before this is since I tried to add new service on  
> > the machine to monitor and even if I roll back to the previous state the  
> > service wont start and gives the same error.
> > 
> > I thought it might be a permissions issue I tried creating a new user with  
> > admin privileges and using the admin user but none seemed to work.
> > 
> > Does anyone know what could be causing this issue?
> > 
> > Thank you
