googleapis / google-cloud-datastore

Low-level, Protobuf-based Java and Python client libraries for Cloud Datastore. Check out google-cloud-java and google-cloud-python first!
https://cloud.google.com/datastore
Apache License 2.0
215 stars 133 forks source link

Datastore Emulator not shutting down on CTRL-C on macOS #316

Closed remko closed 1 year ago

remko commented 1 year ago

When I run Datastore Emulator as a child of another process, terminating the parent process with CTRL-C leaves the datastore emulator running or doesn't do anything at all. Here are some examples where this happens. This is all on macOS, and has been like this for more than 4 years at the time of writing (so it's not a new issue). I'm not excluding it has something to do with my setup, but I have had this issue for years on many different of my own machines, and only the datastore emulator has this problem it seems.

Example 1: Using npm run / yarn run

I have the following package.json:

{
  "scripts": {
    "start-emulator": "gcloud --project=myproject beta emulators datastore start"
   }
}

When I run npm run start-emulator, and then hit CTRL-C, the datastore emulator java process is still there. I don't have this problem with any other server I start in an NPM script.

Example 2: Using make

I have the following Makefile:

start-emulator: 
    gcloud --project=myproject beta emulators datastore start

When I run make start-emulator, the emulator starts; when I then hit CTRL-C, nothing happens: the emulator just keeps on running.

meredithslota commented 1 year ago

Hi @remko — thank you for filing this issue! I agree, it's a problem, and it's been reported by other folks too. There's an existing public issue tracked here: https://issuetracker.google.com/253358676 and I've added your report as a reference, but I'm going to close it here so that it can be followed on the main issue.

remko commented 1 year ago

Hi @meredithslota Thanks. However, that issue looks like something else. That's a feature request for stopping the emulator outside of the process, which is not something I want. The suggested fix of that issue is using CTRL+C, but I just reported that this doesn't always work.