Java process spawned when Pub/Sub emulator runs is not cleaned up
When you start the Pub/Sub emulator (e.g.
gcloud beta emulators pubsub start --project=myprog) there is also a java process which is spawned. I am assuming it contains a jetty process or similar.
When you stop the Pub/Sub emulator (ctrl + c) this process remains. This causes issues in many ways. Some I have run into:
- The port in use is now locked while the java process remains. Starting Pub/Sub emulator again starts it on a new port.
- If there was an http push error, and the Pub/Sub emulator is continuously resending the message, it will continue to do so even AFTER the Pub/Sub emulator (Python) process is stopped.
As a work-around for now I manually stop the java process after stopping PubSub emulator (e.g. on macOS:
The Pub/Sub emulator should be cleaning up it's own processes when it is terminated.