# Logstash with NSSM never ending when stop service

**URL:** https://discuss.elastic.co/t/logstash-with-nssm-never-ending-when-stop-service/98882
**Category:** Logstash
**Created:** [August 30, 2017, 3:43pm UTC](https://discuss.elastic.co/t/logstash-with-nssm-never-ending-when-stop-service/98882 "2017-08-30T15:43:05Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![APR](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@APR](https://discuss.elastic.co/u/APR)
#### Post date: [August 30, 2017, 3:43pm UTC](https://discuss.elastic.co/t/logstash-with-nssm-never-ending-when-stop-service/98882/1 "2017-08-30T15:43:05Z")

</div>

Hello,

I use NSSM for create a Windows Service to start/stop Logstash. I follow the instruction you can find here [https://github.com/verbosemode/public-notes/blob/master/logstash-windows.md](https://github.com/verbosemode/public-notes/blob/master/logstash-windows.md)

The Windows Service is create correctly and i haven't any trooble to start Logstash.

When I stop the service, Logstash is steel parsing information from jdbc input. I can find in logfile the SQL statement is still running and in task management I have a java.exe running with logstash parameters.

I try to start logstash with the option pipeline.unsafe\_shutdown: true in logstash.yml but I have always this problem.

You can find my jdbc parameters I use in logstash-parser.conf :

```
    jdbc {
		jdbc_driver_library => "${ELK_JDBC_LIB}"
		jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
		jdbc_connection_string => "jdbc:${ELK_JDBC_CHAINE}"
		jdbc_user => "${ELK_JDBC_USER}"
		jdbc_password => "${ELK_JDBC_PWD}"

		statement_filepath => "${ELK_JDBC_QUERY}"
		schedule => "*/2 * * * *"
		type => esb_bdd

	}

```

Have you any idea to solve that, pls ?

---

<div class="post-metadata">

### Author: ![APR](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@APR](https://discuss.elastic.co/u/APR)
#### Post date: [August 30, 2017, 3:55pm UTC](https://discuss.elastic.co/t/logstash-with-nssm-never-ending-when-stop-service/98882/2 "2017-08-30T15:55:09Z")

</div>

To be complet, logs when I stop Logstash service

Terminer le programme de commandes (O/N) ? 17:51:23.963 [SIGINT handler] WARN logstash.runner - SIGINT received. Shutting down the agent.  
17:51:24.010 [LogStash::Runner] WARN logstash.agent - stopping pipeline {:id=\>"main"}  
17:51:28.963 [Ruby-0-Thread-39: E:/ELK/logstash-5.4.0/logstash-core/lib/logstash/runner.rb:409] WARN logstash.runner - Received shutdown signal, but pipeline is still waiting for in-flight events  
to be processed. Sending another ^C will force quit Logstash, but this may cause  
data loss.  
17:51:29.245 [Ruby-0-Thread-40: E:/ELK/logstash-5.4.0/logstash-core/lib/logstash/shutdown\_watcher.rb:31] WARN logstash.shutdownwatcher - {"inflight\_count"=\>0, "stalling\_thread\_info"=\>{"other"=\>[{"thread\_id"=\>36, "name"=\>"[main]\<stdin", "current\_call"=\>"[...]/vendor/bundle/jruby/1.9/gems/logstash-input-stdin-3.2.2/lib/logstash/inputs/stdin.rb:77:in `read'"}, {"thread_id"=>37, "name"=>"[main]<file", "current_call"=>"[...]/vendor/bundle/jruby/1.9/gems/filewatch-0.9.0/lib/filewatch/watch.rb:288:in`sleep'"}, {"thread\_id"=\>38, "name"=\>"[main]\<file", "current\_call"=\>"[...]/vendor/bundle/jruby/1.9/gems/filewatch-0.9.0/lib/filewatch/watch.rb:288:in `sleep'"}, {"thread_id"=>39, "name"=>"[main]<file", "current_call"=>"[...]/vendor/bundle/jruby/1.9/gems/filewatch-0.9.0/lib/filewatch/watch.rb:288:in`sleep'"}, {"thread\_id"=\>40, "name"=\>"[main]\<file", "current\_call"=\>"[...]/vendor/bundle/jruby/1.9/gems/filewatch-0.9.0/lib/filewatch/watched\_file.rb:142:in `initialize'"}, {"thread_id"=>41, "name"=>"[main]<file", "current_call"=>"[...]/vendor/bundle/jruby/1.9/gems/filewatch-0.9.0/lib/filewatch/watch.rb:288:in`sleep'"}, {"thread\_id"=\>42, "name"=\>"[main]\<file", "current\_call"=\>"[...]/vendor/bundle/jruby/1.9/gems/filewatch-0.9.0/lib/filewatch/watch.rb:288:in `sleep'"}, {"thread_id"=>43, "name"=>"[main]<jdbc", "current_call"=>"[...]/vendor/bundle/jruby/1.9/gems/rufus-scheduler-3.0.9/lib/rufus/scheduler.rb:170:in`join'"}], ["LogStash::Filters::Mutate", {"replace"=\>{"type"=\>"%{new\_type}"}, "remove\_field"=\>"new\_type", "id"=\>"8e89a1c61f91ae7e37c255fcec3d6bc02d7f2c94-29"}]=\>[{"thread\_id"=\>35, "name"=\>"[main]\>worker0", "current\_call"=\>"[...]/logstash-core/lib/logstash/util/wrapped\_synchronous\_queue.rb:136:in `synchronize'"}]}} 17:51:29.245 [Ruby-0-Thread-40: E:/ELK/logstash-5.4.0/logstash-core/lib/logstash/shutdown_watcher.rb:31] ERROR logstash.shutdownwatcher - The shutdown process appears to be stalled due to busy or blocked plugins. Check the logs for more information. 17:51:34.057 [Ruby-0-Thread-40: E:/ELK/logstash-5.4.0/logstash-core/lib/logstash/shutdown_watcher.rb:31] WARN logstash.shutdownwatcher - {"inflight_count"=>0, "stalling_thread_info"=>{"other"=>[{"thread_id"=>36, "name"=>"[main]<stdin", "current_call"=>"[...]/vendor/bundle/jruby/1.9/gems/logstash-input-stdin-3.2.2/lib/logstash/inputs/stdin.rb:77:in`read'"}, {"thread\_id"=\>37, "name"=\>"[main]\<file", "current\_call"=\>"[...]/vendor/bundle/jruby/1.9/gems/filewatch-0.9.0/lib/filewatch/watch.rb:288:in `sleep'"}, {"thread_id"=>38, "name"=>"[main]<file", "current_call"=>"[...]/vendor/bundle/jruby/1.9/gems/filewatch-0.9.0/lib/filewatch/watch.rb:288:in`sleep'"}, {"thread\_id"=\>39, "name"=\>"[main]\<file", "current\_call"=\>"[...]/vendor/bundle/jruby/1.9/gems/filewatch-0.9.0/lib/filewatch/watch.rb:288:in `sleep'"}, {"thread_id"=>40, "name"=>"[main]<file", "current_call"=>"[...]/vendor/bundle/jruby/1.9/gems/filewatch-0.9.0/lib/filewatch/watch.rb:288:in`sleep'"}, {"thread\_id"=\>41, "name"=\>"[main]\<file", "current\_call"=\>"[...]/vendor/bundle/jruby/1.9/gems/filewatch-0.9.0/lib/filewatch/watch.rb:288:in `sleep'"}, {"thread_id"=>42, "name"=>"[main]<file", "current_call"=>"[...]/vendor/bundle/jruby/1.9/gems/filewatch-0.9.0/lib/filewatch/watch.rb:288:in`sleep'"}, {"thread\_id"=\>43, "name"=\>"[main]\<jdbc", "current\_call"=\>"[...]/vendor/bundle/jruby/1.9/gems/rufus-scheduler-3.0.9/lib/rufus/scheduler.rb:170:in `join'"}], ["LogStash::Filters::Mutate", {"replace"=>{"type"=>"%{new_type}"}, "remove_field"=>"new_type", "id"=>"8e89a1c61f91ae7e37c255fcec3d6bc02d7f2c94-29"}]=>[{"thread_id"=>35, "name"=>"[main]>worker0", "current_call"=>"[...]/logstash-core/lib/logstash/util/wrapped_synchronous_queue.rb:136:in`synchronize'"}]}}  
17:51:39.213 [Ruby-0-Thread-40: E:/ELK/logstash-5.4.0/logstash-core/lib/logstash/shutdown\_watcher.rb:31] WARN logstash.shutdownwatcher - {"inflight\_count"=\>0, "stalling\_thread\_info"=\>{"other"=\>[{"thread\_id"=\>36, "name"=\>"[main]\<stdin", "current\_call"=\>"[...]/vendor/bundle/jruby/1.9/gems/logstash-input-stdin-3.2.2/lib/logstash/inputs/stdin.rb:77:in `read'"}, {"thread_id"=>37, "name"=>"[main]<file", "current_call"=>"[...]/vendor/bundle/jruby/1.9/gems/filewatch-0.9.0/lib/filewatch/watch.rb:288:in`sleep'"}, {"thread\_id"=\>38, "name"=\>"[main]\<file", "current\_call"=\>"[...]/vendor/bundle/jruby/1.9/gems/filewatch-0.9.0/lib/filewatch/watch.rb:288:in `sleep'"}, {"thread_id"=>39, "name"=>"[main]<file", "current_call"=>"[...]/vendor/bundle/jruby/1.9/gems/filewatch-0.9.0/lib/filewatch/watch.rb:288:in`sleep'"}, {"thread\_id"=\>40, "name"=\>"[main]\<file", "current\_call"=\>"[...]/vendor/bundle/jruby/1.9/gems/filewatch-0.9.0/lib/filewatch/watch.rb:288:in `sleep'"}, {"thread_id"=>41, "name"=>"[main]<file", "current_call"=>"[...]/vendor/bundle/jruby/1.9/gems/filewatch-0.9.0/lib/filewatch/watch.rb:288:in`sleep'"}, {"thread\_id"=\>42, "name"=\>"[main]\<file", "current\_call"=\>"[...]/vendor/bundle/jruby/1.9/gems/filewatch-0.9.0/lib/filewatch/watch.rb:288:in `sleep'"}, {"thread_id"=>43, "name"=>"[main]<jdbc", "current_call"=>"[...]/vendor/bundle/jruby/1.9/gems/rufus-scheduler-3.0.9/lib/rufus/scheduler.rb:170:in`join'"}], ["LogStash::Filters::Mutate", {"replace"=\>{"type"=\>"%{new\_type}"}, "remove\_field"=\>"new\_type", "id"=\>"8e89a1c61f91ae7e37c255fcec3d6bc02d7f2c94-29"}]=\>[{"thread\_id"=\>35, "name"=\>"[main]\>worker0", "current\_call"=\>"[...]/logstash-core/lib/logstash/util/wrapped\_synchronous\_queue.rb:136:in `synchronize'"}]}}  
17:51:39.213 [Ruby-0-Thread-40: E:/ELK/logstash-5.4.0/logstash-core/lib/logstash/shutdown\_watcher.rb:31] FATAL logstash.shutdownwatcher - Forcefully quitting logstash..

After that, at 17:52 I have a new line whith my SQL Statement

17:52:00.104 [Ruby-0-Thread-38: E:/ELK/logstash-5.4.0/vendor/bundle/jruby/1.9/gems/rufus-scheduler-3.0.9/lib/rufus/scheduler/jobs.rb:283] INFO logstash.inputs.jdbc - (0.000000s) select inst.id\_instance\_flux as idInstanceFlux, fc.id\_projet\_flux as idProjetFlux, f.code as codeFlux, c.code as codeClient, a.code as codeAppli, re.libelle as libelleErreur  
, inst.timestamp\_debut, inst.timestamp\_fin, inst.statut, inst.declenchement\_flux, convert(varchar,timestamp\_debut,121) as timestamp\_elk  
from instance\_flux inst....

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [October 4, 2017, 7:54am UTC](https://discuss.elastic.co/t/logstash-with-nssm-never-ending-when-stop-service/98882/4 "2017-10-04T07:54:47Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
