New java.exe process starts everytime I stop and run logstash


Everytime I run logstash new jrube.exe and java.exe processes are starting up.
when I stop logstsah, jrube.exe process finishes but java.exe stays. And upon starting logstash again another java process spawns. So java.exe process don't go away unless killed manually. Is it normal? What would be a recommended way stop this behavior or to kill java process.


PS: I am using nssm to run logstash as a service.
This is the script I am using to install logstash service:

IF "%~1"=="" GOTO End
set nssmPath=%~1
start /wait cmd /C "bin\plugin install logstash-input-couchdb_changes"

mkdir bin\seq_files

set ABS_PATH=%~dp0
set "APP_DIR=%ABS_PATH%\bin"
echo ABS_PATH:
echo nssmPath: %nssmPath%
"%nssmPath%" install logstash %ABS_PATH%\bin\logstash.bat
"%nssmPath%" set logstash AppParameters agent --log %ABS_PATH%\bin\logstash_log.txt --config %ABS_PATH%\bin\logstash.config
"%nssmPath%" set logstash AppDirectory "%APP_DIR%"

"%nssmPath%" set logstash AppStdout %ABS_PATH%\logstashStdout.log
"%nssmPath%" set logstash AppStderr %ABS_PATH%\logstashStderr.log
REM Replace stdout and stderr files
"%nssmPath%" set logstash AppStdoutCreationDisposition 2
"%nssmPath%" set logstash AppStderrCreationDisposition 2
REM Disable WM_CLOSE, WM_QUIT in the Shutdown options. Without it, NSSM can't stop Logstash properly
"%nssmPath%" set logstash AppStopMethodSkip 6
REM Let's start Logstash. I assume a correct configuration is already in place

Any help on this please?

I tried --allow-unsafe-shutdown flag but it still needs two cntrl+C commands to shut it down completely. When running logstash as a service and stopping the service, how can we make it to shutdown completely.

I think the problem mainly is that the pipeline that receives messages is not closed when shutting down logstash first time.

Here is my logstash command:

 logstash agent --allow-unsafe-shutdown --config logstash.config

Still waiting for a solution for this, any help will be appreciated, thanks!

I need to find a solution for this, any help will be appreciated.