kitconcept / kitconcept.recipe.solr

Buildout recipe for Solr
1 stars 0 forks source link

Stop the solr subprocess (in foreground mode) #7

Closed gforcada closed 5 years ago

gforcada commented 5 years ago

When running solr in foreground mode, one needs to keep track of the process that gets started, otherwise process control software like Supervisor will kill the kitconcept.recipe.solr process but not the solr one if asked to stop.

This fixes #3

tisto commented 5 years ago

@gforcada do you have pointers for me why we have to create the pid file manually?

gforcada commented 5 years ago

subprocess.call was blocking, so as soon as the kitconcept.recipe.solr process is terminated/killed, the solr process lives on as the termination/kill signal is not passed down to the solr subprocess.

With these changes, we use subprocess.Popen which does not block, and then we can do some bookkeeping to ensure that whenever our process is terminated/killed we can send the signal down to the solr process as well.

As for the pidfile itself, now I see that there is a file parts/solr/bin/solr-PORT.pid that already has the pid on it. I will refactor the code to use that file then.

Does that answer your question? :thinking:

gforcada commented 5 years ago

Thanks!