Skip to content

No graceful exit using NPM Scripts #2507

@kellyjandrews

Description

@kellyjandrews

[REQUIRED] Environment info

firebase-tools: 8.6.0

Platform: macOS

[REQUIRED] Test case

Setup a firebase project that uses the emulators.

[REQUIRED] Steps to reproduce

Start the emulators through npm start. I'm currently using hosting, functions and firestore.

    "start": "GOOGLE_APPLICATION_CREDENTIALS=/google-creds.json firebase emulators:start --import=./data --export-on-exit"

Stop emulators using CTRL-C

[REQUIRED] Expected behavior

A graceful exit.

i  emulators: Received SIGINT (Ctrl-C) for the first time. Starting a clean shutdown.
i  emulators: Please wait for a clean shutdown or send the SIGINT (Ctrl-C) signal again to stop right now.
i  Automatically exporting data using --export-on-exit "./data" please wait for the export to finish...
i  Found running emulator hub for project emulator-test at http://localhost:4400
i  Deleting directory /emulator-test/functions/data/firestore_export
i  Exporting data to: /emulator-test/functions/data
i  emulators: Received export request. Exporting data to /emulator-test/functions/data.
✔  emulators: Export complete.
✔  Export complete
i  emulators: Shutting down emulators.
i  hub: Stopping emulator hub
i  ui: Stopping Emulator UI
i  logging: Stopping Logging Emulator
i  functions: Stopping Functions Emulator
i  firestore: Stopping Firestore Emulator
i  hosting: Stopping Hosting Emulator

[REQUIRED] Actual behavior

i  emulators: Received SIGINT (Ctrl-C) for the first time. Starting a clean shutdown.
i  emulators: Please wait for a clean shutdown or send the SIGINT (Ctrl-C) signal again to stop right now.
i  Automatically exporting data using --export-on-exit "./data" please wait for the export to finish...
 
⚠  emulators: Received SIGINT (Ctrl-C) 2 times. You have forced the Emulator Suite to exit without waiting for 2 subprocesses to finish. These processes may still be running on your machine: 

┌────────────────────┬────────────────┬──────┐
│ Emulator           │ Host:Port      │ PID  │
├────────────────────┼────────────────┼──────┤
│ Emulator UI        │ localhost:4003 │ 1818 │
├────────────────────┼────────────────┼──────┤
│ Firestore Emulator │ localhost:4001 │ 1818 │
└────────────────────┴────────────────┴──────┘

To force them to exit run:

kill 1818 1818

Ironically, with --debug it does not fail.

i  emulators: Received SIGINT (Ctrl-C) for the first time. Starting a clean shutdown. 
i  emulators: Please wait for a clean shutdown or send the SIGINT (Ctrl-C) signal again to stop right now. 
i  Automatically exporting data using --export-on-exit "./data" please wait for the export to finish... 
[2020-07-30T13:06:48.536Z] >>> HTTP REQUEST GET http://localhost:4400/  
 
[2020-07-30T13:06:48.540Z] [worker-~diagnostic~-9bb61cf1-df1d-41d7-9e2a-fba05b969819]: exited {"metadata":{"emulator":{"name":"functions"},"message":"[worker-~diagnostic~-9bb61cf1-df1d-41d7-9e2a-fba05b969819]: exited"}}
[2020-07-30T13:06:48.541Z] [worker-~diagnostic~-9bb61cf1-df1d-41d7-9e2a-fba05b969819]: FINISHED {"metadata":{"emulator":{"name":"functions"},"message":"[worker-~diagnostic~-9bb61cf1-df1d-41d7-9e2a-fba05b969819]: FINISHED"}}
[2020-07-30T13:06:48.546Z] <<< HTTP RESPONSE 200 {"x-powered-by":"Express","content-type":"application/json; charset=utf-8","content-length":"50","etag":"W/\"32-awxJiFDOu9uUeUgx8zcVKrDfcNg\"","date":"Thu, 30 Jul 2020 13:06:48 GMT","connection":"keep-alive"}
i  Found running emulator hub for project kja-emulator-example at http://localhost:4400 
i  Deleting directory /Users/kellyjandrews/Google Drive/Apps/emulator-test/functions/data/firestore_export 
i  Exporting data to: /Users/kellyjandrews/Google Drive/Apps/emulator-test/functions/data 
[2020-07-30T13:06:48.555Z] >>> HTTP REQUEST POST http://localhost:4400/_admin/export  
 {"path":"/Users/kellyjandrews/Google Drive/Apps/emulator-test/functions/data"}
i  emulators: Received export request. Exporting data to /Users/kellyjandrews/Google Drive/Apps/emulator-test/functions/data. 
[2020-07-30T13:06:48.579Z] >>> HTTP REQUEST POST http://localhost:4001/emulator/v1/projects/kja-emulator-example:export  
 {"database":"projects/kja-emulator-example/databases/(default)","export_directory":"/Users/kellyjandrews/Google Drive/Apps/emulator-test/functions/data","export_name":"firestore_export"}
[2020-07-30T13:06:48.695Z] Jul 30, 2020 9:06:48 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
INFO: Detected non-HTTP/2 connection.
 {"metadata":{"emulator":{"name":"firestore"},"message":"Jul 30, 2020 9:06:48 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead\nINFO: Detected non-HTTP/2 connection.\n"}}
[2020-07-30T13:06:48.729Z] Jul 30, 2020 9:06:48 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
INFO: Detected HTTP/2 connection.
 {"metadata":{"emulator":{"name":"firestore"},"message":"Jul 30, 2020 9:06:48 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead\nINFO: Detected HTTP/2 connection.\n"}}
[2020-07-30T13:06:48.834Z] Jul 30, 2020 9:06:48 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
INFO: Detected non-HTTP/2 connection.
 {"metadata":{"emulator":{"name":"firestore"},"message":"Jul 30, 2020 9:06:48 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead\nINFO: Detected non-HTTP/2 connection.\n"}}
[2020-07-30T13:06:50.151Z] <<< HTTP RESPONSE 200 {"content-type":"application/json","content-length":"4"}
✔  emulators: Export complete. 
[2020-07-30T13:06:50.154Z] <<< HTTP RESPONSE 200 {"x-powered-by":"Express","content-type":"application/json; charset=utf-8","content-length":"16","etag":"W/\"10-MxB4y4MLcx6QDsp8b8vgp7iFMFo\"","date":"Thu, 30 Jul 2020 13:06:50 GMT","connection":"keep-alive"}
✔  Export complete 
i  emulators: Shutting down emulators. {"metadata":{"emulator":{"name":"hub"},"message":"Shutting down emulators."}}
i  hub: Stopping emulator hub {"metadata":{"emulator":{"name":"hub"},"message":"Stopping emulator hub"}}
i  ui: Stopping Emulator UI {"metadata":{"emulator":{"name":"ui"},"message":"Stopping Emulator UI"}}
i  logging: Stopping Logging Emulator {"metadata":{"emulator":{"name":"logging"},"message":"Stopping Logging Emulator"}}
i  functions: Stopping Functions Emulator {"metadata":{"emulator":{"name":"functions"},"message":"Stopping Functions Emulator"}}
i  firestore: Stopping Firestore Emulator {"metadata":{"emulator":{"name":"firestore"},"message":"Stopping Firestore Emulator"}}
i  hosting: Stopping Hosting Emulator {"metadata":{"emulator":{"name":"hosting"},"message":"Stopping Hosting Emulator"}}
[2020-07-30T13:06:50.166Z] *** shutting down gRPC server since JVM is shutting down
 {"metadata":{"emulator":{"name":"firestore"},"message":"*** shutting down gRPC server since JVM is shutting down\n"}}
⚠  Emulator UI has exited upon receiving signal: SIGINT 
[2020-07-30T13:06:50.169Z] *** server shut down
 {"metadata":{"emulator":{"name":"firestore"},"message":"*** server shut down\n"}}
[2020-07-30T13:06:50.224Z] File /Users/kellyjandrews/Google Drive/Apps/emulator-test/functions/data/firebase-export-metadata.json changed, reloading triggers {"metadata":{"emulator":{"name":"functions"},"message":"File /Users/kellyjandrews/Google Drive/Apps/emulator-test/functions/data/firebase-export-metadata.json changed, reloading triggers"}}

Not sure why it's getting the second SIGINT, or if there is any way to prevent it from happening. Let me know if there is something I can change on my end to fix it directly as well. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions