<p>In c-lightning, we give time to the plugin to shutdown, and after some time (30 seconds) if the plugin doesn't answer to shutdown we kill it.</p>
<p>However, some type of plugin can keep going because they can be run by a bash script or something else, and c-lighting kills only the bash script process and not the real project.</p>
<p>This happens with plugins written in Java or Kotlin, with the library <a href="https://github.com/clightning4j/JRPClightning" rel="nofollow noreferrer">clightning4j</a>.</p>
<p>In conclusion, some of these plugins make a fake closing, in particular, if the plugin answer to the shutdown notification, c-lighting could not kill it, but assume that the plugin kills itself (with simple an exit(0)), this can be a use case where the plugin is badly written, but for sure have an example can help to debug the use case</p>
<p>This is the procedure that makes the trick <a href="https://github.com/SimonVrouwe/lightning/blob/81325097eddde6dfff911331c09963d5a316a6cc/lightningd/plugin.c#L2090" rel="nofollow noreferrer">https://github.com/SimonVrouwe/lightning/blob/81325097eddde6dfff911331c09963d5a316a6cc/lightningd/plugin.c#L2090</a></p>

CC BY-SA 4.0
2022-01-27T20:17:07.247Z
2022-01-27T20:25:20.777Z
2022-01-27T20:25:20.777Z
vincenzopalazzo
<p>This is a draft answer from answers on Telegram. Alternative more detailed answers are welcome.</p>
<p>Plugins are subprocesses that are started by the main lightningd daemon. They work in cooperation with lightningd.</p>
<p>The plugin should stop when stdin is closed. The default behavior is that the plugin closes with normal signals.</p>

CC BY-SA 4.0
2021-08-30T13:59:58.617Z
2021-08-30T13:59:58.617Z
Michael Folkson
<p>Is it normal if a plugin that I've written doesn't shut down (ie the Python process is still running) after I've called <code>stop_ln</code> (in the <code>startup_regtest</code>, <code>start_ln</code> setup)? Is the plugin opened as a subprocess? Should it handle a particular signal?</p>
<p>This was asked on Telegram.</p>

<core-lightning><plugins>
Is it normal or acceptable behavior for a c-lightning plugin not to shut down after lightningd is stopped?
Michael Folkson
# Is it normal or acceptable behavior for a c-lightning plugin not to shut down after lightningd is stopped?

(Asked by: username_0 on 2021-08-30)

Is it normal if a plugin that I've written doesn't shut down (ie the Python process is still running) after I've called `stop_ln` (in the `startup_regtest`, `start_ln` setup)? Is the plugin opened as a subprocess? Should it handle a particular signal?

This was asked on Telegram.

**Tags:** core-lightning, plugins


---

## 2 answers

### Answer by username_1 on 2022-01-27. Score: 1 | Accepted answer

In c-lightning, we give time to the plugin to shutdown, and after some time (30 seconds) if the plugin doesn't answer to shutdown we kill it.

However, some type of plugin can keep going because they can be run by a bash script or something else, and c-lighting kills only the bash script process and not the real project.

This happens with plugins written in Java or Kotlin, with the library [clightning4j](https://github.com/clightning4j/JRPClightning).

In conclusion, some of these plugins make a fake closing, in particular, if the plugin answer to the shutdown notification, c-lighting could not kill it, but assume that the plugin kills itself (with simple an exit(0)), this can be a use case where the plugin is badly written, but for sure have an example can help to debug the use case

This is the procedure that makes the trick <https://github.com/SimonVrouwe/lightning/blob/81325097eddde6dfff911331c09963d5a316a6cc/lightningd/plugin.c#L2090>


---

### Answer by username_0 on 2021-08-30. Score: 0

This is a draft answer from answers on Telegram. Alternative more detailed answers are welcome.

Plugins are subprocesses that are started by the main lightningd daemon. They work in cooperation with lightningd.

The plugin should stop when stdin is closed. The default behavior is that the plugin closes with normal signals.


---

