1

I am following up on:

I have a CloudRun service which is doing some while cycles which currently seem not to end after the CloudRun revision is replaced. I guess the CloudRun manager is waiting for the revision to gracefully end, which unfortunately does not happen.

I tried adding:

Runtime.getRuntime().addShutdownHook()

And end the loops with this listener. Unfortunately there are two issues:

  1. It is not possible to subscribe more shutdownHooks (each for one running loop) - getting errors of Hook already running. This is an implementation issue and I wonder if there is a different way to do this.
  2. When I send the SIGTERM or SIGINT to locally running service, it ends immediately and the shutdownHook is never called. This is a logical issue and I am not sure if this is the way CloudRun ends the revisions - it seems not, otherwise the loops would be immediately ended like on my localhost.
Vojtěch
  • 11,312
  • 31
  • 103
  • 173

0 Answers0