NorfairKing / feedback

Declarative feedback loop manager
https://cs-syd.eu/posts/2022-11-14-automate-your-feedback-loops-using-feedback
GNU General Public License v3.0
64 stars 10 forks source link

kill signal for server process in `loop` #31

Open peterbecich opened 8 months ago

peterbecich commented 8 months ago

Thanks for this great program.

I have a feedback.yaml, and have defined a loop: https://github.com/peterbecich/halogen-chess/blob/8ec3f53991e529b44b5bfd78889e0fa91f4b6a93/feedback.yaml#L15

It runs a program halogen-chess which binds to port 8080.

The loop runs once successfully. When the loop restarts, I see an error:

halogen-chess: Network.Socket.bind: resource busy (Address already in use)

The issue is solved by exiting feedback, which kills the halogen-chess process bound to port 8080.

Could feedback send a different kill signal to the process, when the loop is repeated, to solve this issue?

An alternative solution may be a before-all hook, such as:

    hooks:
      before-all:
        kill -9 $(lsof -t -i:8080 -sTCP:LISTEN);
NorfairKing commented 8 months ago

@peterbecich Feedback was never really intended for long-running processes in the loop, but now I see that that's actually a really cool use-case.

I think your before-all hook would not really solve the issue at hand.

Feedback "just" needs to wait for the process to exit correctly, but I'm surprised that it doesn't because I thought I had implemented that :(

Any digging would be welcome because I'm currently at an airport.

NorfairKing commented 7 months ago

@peterbecich any news?

peterbecich commented 5 months ago

@NorfairKing , no, sorry, I've been unable to put any time into this issue

NorfairKing commented 5 months ago

@peterbecich have you tried with latest master? It might be fixed now. I added some smartness about killing the loop process.