vinanrra / Docker-Satisfactory

Satisfactory server using LinuxGSM script in Docker
40 stars 7 forks source link

Safe Container Termination #8

Closed mitchellmaler closed 2 years ago

mitchellmaler commented 2 years ago

Hello,

I am looking to use this container and it is awesome you have put it together.

The first thing I ran into is it will not stop cleanly if sent the sigterm signal. It seems that signal doesn't make it to the lgsm process and the container has to be forced stopped/killed. Running in a Kubernetes environment forces it to always hit the termination timeout and then it is forced killed. It would be nice if we can find a way to send the term signal down to the process so it can exit cleanly instead of having to be killed each time.

vinanrra commented 2 years ago

Hi, I don't know why isn't working the trap signal, I need help to fix that, if you know how to do it create a pull request, I will read more documentation, but I haven't been able to solve the problem, I have same problem in my other Docker image.

I hope I can find the solution soon, because it's a big issue.

mitchellmaler commented 2 years ago

For now my workaround in Kubernetes is to setup a preStop action to call the shutdown command:

lifecycle:
  preStop:
    exec:
      command:
        - /bin/su
        - -c
        - '/home/sfserver/sfserver stop'
        - sfserver

If I have time over the weekend ill see if I can understand why it is failing to receive the signal.

vinanrra commented 2 years ago

For now my workaround in Kubernetes is to setup a preStop action to call the shutdown command:

lifecycle:
  preStop:
    exec:
      command:
        - /bin/su
        - -c
        - '/home/sfserver/sfserver stop'
        - sfserver

If I have time over the weekend ill see if I can understand why it is failing to receive the signal.

Thanks, I'm finishing another project and will research again about it and try to fix it

vinanrra commented 2 years ago

@mitchellmaler

Fixed in #15