Skip to content

Pubsub emulator does not cleanly shutdown on Windows #8007

Closed as not planned
Closed as not planned

Description

@lawther

[REQUIRED] Environment info

firebase-tools:
13.27.0

Platform:
Windows 11

[REQUIRED] Test case

No test code needed - see repro steps

[REQUIRED] Steps to reproduce

Start the pubsub emulator with

firebase emulators:start --only pubsub

Press Ctrl-C to shut the emulator down

Try to start the emulator again

[REQUIRED] Expected behavior

I should be able to start the emulator again after shutting it down.

[REQUIRED] Actual behavior

The emulator can't start because the old process is still running and the port is in use.

The log seems to say the emulator was shut down "[warn] ! Pub/Sub Emulator has exited upon receiving signal: SIGINT".

If I manually kill the emulator (either close the cmd window or kill the java process) then I can successfully restart the emulator.

[debug] [2024-11-29T00:07:43.772Z] ----------------------------------------------------------------------
[debug] [2024-11-29T00:07:43.774Z] Command:       C:\Program Files\nodejs\node.exe C:\Users\XXXXXX\AppData\Roaming\npm\node_modules\firebase-tools\lib\bin\firebase.js emulators:start --only pubsub --debug
[debug] [2024-11-29T00:07:43.775Z] CLI Version:   13.27.0
[debug] [2024-11-29T00:07:43.775Z] Platform:      win32
[debug] [2024-11-29T00:07:43.775Z] Node Version:  v20.12.2
[debug] [2024-11-29T00:07:43.775Z] Time:          Fri Nov 29 2024 11:07:43 GMT+1100 (Australian Eastern Daylight Time)
[debug] [2024-11-29T00:07:43.775Z] ----------------------------------------------------------------------
[debug]
[debug] [2024-11-29T00:07:43.904Z] Object "" in "firebase.json" has unknown property: {"additionalProperty":"flutter"}
[debug] [2024-11-29T00:07:43.912Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[debug] [2024-11-29T00:07:43.913Z] > authorizing via signed-in user ([email protected])
[info] i  emulators: Starting emulators: pubsub {"metadata":{"emulator":{"name":"hub"},"message":"Starting emulators: pubsub"}}
[debug] [2024-11-29T00:07:43.923Z] [logging] Logging Emulator only supports listening on one address (127.0.0.1). Not listening on ::1
[debug] [2024-11-29T00:07:43.923Z] [pubsub] Pub/Sub Emulator only supports listening on one address (127.0.0.1). Not listening on ::1
[debug] [2024-11-29T00:07:43.924Z] assigned listening specs for emulators {"user":{"hub":[{"address":"127.0.0.1","family":"IPv4","port":4400},{"address":"::1","family":"IPv6","port":4400}],"logging":[{"address":"127.0.0.1","family":"IPv4","port":4500}],"pubsub":[{"address":"127.0.0.1","family":"IPv4","port":8085}]},"metadata":{"message":"assigned listening specs for emulators"}}
[debug] [2024-11-29T00:07:43.929Z] [hub] writing locator at C:\Users\XXXXXX\AppData\Local\Temp\hub-XXXXXX.json
[debug] [2024-11-29T00:07:43.954Z] Checked if tokens are valid: true, expires at: 1732842182819
[debug] [2024-11-29T00:07:43.954Z] Checked if tokens are valid: true, expires at: 1732842182819
[debug] [2024-11-29T00:07:43.956Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/XXXXXX [none]
[debug] [2024-11-29T00:07:44.690Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/XXXXXX 200
[debug] [2024-11-29T00:07:44.691Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/XXXXXX {"projectId":"XXXXXX","projectNumber":"751502879957","displayName":"XXXXXX","name":"projects/XXXXXX","resources":{"hostingSite":"XXXXXX"},"state":"ACTIVE","etag":"XXXXXX"}
[debug] [2024-11-29T00:07:44.694Z] Ignoring unsupported arg: projectId {"metadata":{"emulator":{"name":"pubsub"},"message":"Ignoring unsupported arg: projectId"}}
[debug] [2024-11-29T00:07:44.694Z] Ignoring unsupported arg: auto_download {"metadata":{"emulator":{"name":"pubsub"},"message":"Ignoring unsupported arg: auto_download"}}
[debug] [2024-11-29T00:07:44.695Z] Starting Pub/Sub Emulator with command {"binary":"C:\\Users\\XXXXXX\\.cache\\firebase\\emulators\\pubsub-emulator-0.8.14\\pubsub-emulator\\bin\\cloud-pubsub-emulator.bat","args":["--host=127.0.0.1","--port=8085"],"optionalArgs":["port","host"],"joinArgs":true,"shell":true,"port":8085} {"metadata":{"emulator":{"name":"pubsub"},"message":"Starting Pub/Sub Emulator with command {\"binary\":\"C:\\\\Users\\\\XXXXXX\\\\.cache\\\\firebase\\\\emulators\\\\pubsub-emulator-0.8.14\\\\pubsub-emulator\\\\bin\\\\cloud-pubsub-emulator.bat\",\"args\":[\"--host=127.0.0.1\",\"--port=8085\"],\"optionalArgs\":[\"port\",\"host\"],\"joinArgs\":true,\"shell\":true,\"port\":8085}"}}
[info] i  pubsub: Pub/Sub Emulator logging to pubsub-debug.log {"metadata":{"emulator":{"name":"pubsub"},"message":"Pub/Sub Emulator logging to \u001b[1mpubsub-debug.log\u001b[22m"}}
[debug] [2024-11-29T00:07:44.712Z]
C:\Users\XXXXXX\github\XXXXXX>if "Windows_NT" == "Windows_NT" setlocal
 {"metadata":{"emulator":{"name":"pubsub"},"message":"\r\nC:\\Users\\XXXXXX\\github\\XXXXXX>if \"Windows_NT\" == \"Windows_NT\" setlocal\r\n"}}
[debug] [2024-11-29T00:07:44.712Z]
C:\Users\XXXXXX\github\XXXXXX>set DIRNAME=C:\Users\XXXXXX\.cache\firebase\emulators\pubsub-emulator-0.8.14\pubsub-emulator\bin\
 {"metadata":{"emulator":{"name":"pubsub"},"message":"\r\nC:\\Users\\XXXXXX\\github\\XXXXXX>set DIRNAME=C:\\Users\\XXXXXX\\.cache\\firebase\\emulators\\pubsub-emulator-0.8.14\\pubsub-emulator\\bin\\ \r\n"}}
[debug] [2024-11-29T00:07:44.713Z]
C:\Users\XXXXXX\github\XXXXXX>if "C:\Users\XXXXXX\.cache\firebase\emulators\pubsub-emulator-0.8.14\pubsub-emulator\bin\" == "" set DIRNAME=.
 {"metadata":{"emulator":{"name":"pubsub"},"message":"\r\nC:\\Users\\XXXXXX\\github\\XXXXXX>if \"C:\\Users\\XXXXXX\\.cache\\firebase\\emulators\\pubsub-emulator-0.8.14\\pubsub-emulator\\bin\\\" == \"\" set DIRNAME=. \r\n"}}
[debug] [2024-11-29T00:07:44.714Z]
C:\Users\XXXXXX\github\XXXXXX>set APP_BASE_NAME=cloud-pubsub-emulator

C:\Users\XXXXXX\github\XXXXXX>set APP_HOME=C:\Users\XXXXXX\.cache\firebase\emulators\pubsub-emulator-0.8.14\pubsub-emulator\bin\..
 {"metadata":{"emulator":{"name":"pubsub"},"message":"\r\nC:\\Users\\XXXXXX\\github\\XXXXXX>set APP_BASE_NAME=cloud-pubsub-emulator \r\n\r\nC:\\Users\\XXXXXX\\github\\XXXXXX>set APP_HOME=C:\\Users\\XXXXXX\\.cache\\firebase\\emulators\\pubsub-emulator-0.8.14\\pubsub-emulator\\bin\\.. \r\n"}}
[debug] [2024-11-29T00:07:44.715Z]
C:\Users\XXXXXX\github\XXXXXX>set DEFAULT_JVM_OPTS=

C:\Users\XXXXXX\github\XXXXXX>if defined JAVA_HOME goto findJavaFromJavaHome

C:\Users\XXXXXX\github\XXXXXX>set JAVA_EXE=java.exe
 {"metadata":{"emulator":{"name":"pubsub"},"message":"\r\nC:\\Users\\XXXXXX\\github\\XXXXXX>set DEFAULT_JVM_OPTS= \r\n\r\nC:\\Users\\XXXXXX\\github\\XXXXXX>if defined JAVA_HOME goto findJavaFromJavaHome \r\n\r\nC:\\Users\\XXXXXX\\github\\XXXXXX>set JAVA_EXE=java.exe \r\n"}}
[debug] [2024-11-29T00:07:44.716Z]
C:\Users\XXXXXX\github\XXXXXX>java.exe -version  1>NUL 2>&1
 {"metadata":{"emulator":{"name":"pubsub"},"message":"\r\nC:\\Users\\XXXXXX\\github\\XXXXXX>java.exe -version  1>NUL 2>&1 \r\n"}}
[debug] [2024-11-29T00:07:45.131Z]
C:\Users\XXXXXX\github\XXXXXX>if "0" == "0" goto init
 {"metadata":{"emulator":{"name":"pubsub"},"message":"\r\nC:\\Users\\XXXXXX\\github\\XXXXXX>if \"0\" == \"0\" goto init \r\n"}}
[debug] [2024-11-29T00:07:45.132Z]
C:\Users\XXXXXX\github\XXXXXX>if not "Windows_NT" == "Windows_NT" goto win9xME_args

C:\Users\XXXXXX\github\XXXXXX>set CMD_LINE_ARGS=

C:\Users\XXXXXX\github\XXXXXX>set _SKIP=2

C:\Users\XXXXXX\github\XXXXXX>if "x--host" == "x" goto execute
 {"metadata":{"emulator":{"name":"pubsub"},"message":"\r\nC:\\Users\\XXXXXX\\github\\XXXXXX>if not \"Windows_NT\" == \"Windows_NT\" goto win9xME_args \r\n\r\nC:\\Users\\XXXXXX\\github\\XXXXXX>set CMD_LINE_ARGS= \r\n\r\nC:\\Users\\XXXXXX\\github\\XXXXXX>set _SKIP=2 \r\n\r\nC:\\Users\\XXXXXX\\github\\XXXXXX>if \"x--host\" == \"x\" goto execute \r\n"}}
[debug] [2024-11-29T00:07:45.136Z]
C:\Users\XXXXXX\github\XXXXXX>set CMD_LINE_ARGS=--host=127.0.0.1 --port=8085

C:\Users\XXXXXX\github\XXXXXX>set CLASSPATH=C:\Users\XXXXXX\.cache\firebase\emulators\pubsub-emulator-0.8.14\pubsub-emulator\bin\..\lib\cloud-pubsub-emulator-0.8.14-all.jar

C:\Users\XXXXXX\github\XXXXXX>"java.exe"     -jar "C:\Users\XXXXXX\.cache\firebase\emulators\pubsub-emulator-0.8.14\pubsub-emulator\bin\..\lib\cloud-pubsub-emulator-0.8.14-all.jar" --host=127.0.0.1 --port=8085
 {"metadata":{"emulator":{"name":"pubsub"},"message":"\r\nC:\\Users\\XXXXXX\\github\\XXXXXX>set CMD_LINE_ARGS=--host=127.0.0.1 --port=8085 \r\n\r\nC:\\Users\\XXXXXX\\github\\XXXXXX>set CLASSPATH=C:\\Users\\XXXXXX\\.cache\\firebase\\emulators\\pubsub-emulator-0.8.14\\pubsub-emulator\\bin\\..\\lib\\cloud-pubsub-emulator-0.8.14-all.jar \r\n\r\nC:\\Users\\XXXXXX\\github\\XXXXXX>\"java.exe\"     -jar \"C:\\Users\\XXXXXX\\.cache\\firebase\\emulators\\pubsub-emulator-0.8.14\\pubsub-emulator\\bin\\..\\lib\\cloud-pubsub-emulator-0.8.14-all.jar\" --host=127.0.0.1 --port=8085 \r\n"}}
[warn] !  emulators: The Emulator UI is not starting, either because none of the running emulators have a UI component or the Emulator UI cannot determine the Project ID. Pass the --project flag to specify a project. {"metadata":{"emulator":{"name":"hub"},"message":"The Emulator UI is not starting, either because none of the running emulators have a UI component or the Emulator UI cannot determine the Project ID. Pass the --project flag to specify a project."}}
[debug] [2024-11-29T00:07:46.578Z] Could not find VSCode notification endpoint: FetchError: request to http://localhost:40001/vscode/notify failed, reason: . If you are not running the Firebase Data Connect VSCode extension, this is expected and not an issue.
[info]
┌─────────────────────────────────────────────────────────────┐
│ ✔  All emulators ready! It is now safe to connect your app. │
└─────────────────────────────────────────────────────────────┘

┌──────────┬────────────────┐
│ Emulator │ Host:Port      │
├──────────┼────────────────┤
│ Pub/Sub  │ 127.0.0.1:8085 │
└──────────┴────────────────┘
  Emulator Hub running at 127.0.0.1:4400
  Other reserved ports: 4500

Issues? Report them at https://github.com/firebase/firebase-tools/issues and attach the *-debug.log files.

[debug] [2024-11-29T00:07:54.826Z] Received signal SIGINT (Ctrl-C) 1
[info]
[info] i  emulators: Received SIGINT (Ctrl-C) for the first time. Starting a clean shutdown.
[info] i  emulators: Please wait for a clean shutdown or send the SIGINT (Ctrl-C) signal again to stop right now.
[info] i  emulators: Shutting down emulators. {"metadata":{"emulator":{"name":"hub"},"message":"Shutting down emulators."}}
[info] i  pubsub: Stopping Pub/Sub Emulator {"metadata":{"emulator":{"name":"pubsub"},"message":"Stopping Pub/Sub Emulator"}}
[warn] !  Pub/Sub Emulator has exited upon receiving signal: SIGINT
[info] i  hub: Stopping emulator hub {"metadata":{"emulator":{"name":"hub"},"message":"Stopping emulator hub"}}
[info] i  logging: Stopping Logging Emulator {"metadata":{"emulator":{"name":"logging"},"message":"Stopping Logging Emulator"}}
[debug] [2024-11-29T00:07:54.835Z] Could not find VSCode notification endpoint: FetchError: request to http://localhost:40001/vscode/notify failed, reason: . If you are not running the Firebase Data Connect VSCode extension, this is expected and not an issue.
[debug] [2024-11-29T00:08:02.673Z] ----------------------------------------------------------------------
[debug] [2024-11-29T00:08:02.677Z] Command:       C:\Program Files\nodejs\node.exe C:\Users\XXXXXX\AppData\Roaming\npm\node_modules\firebase-tools\lib\bin\firebase.js emulators:start --only pubsub --debug
[debug] [2024-11-29T00:08:02.677Z] CLI Version:   13.27.0
[debug] [2024-11-29T00:08:02.677Z] Platform:      win32
[debug] [2024-11-29T00:08:02.677Z] Node Version:  v20.12.2
[debug] [2024-11-29T00:08:02.678Z] Time:          Fri Nov 29 2024 11:08:02 GMT+1100 (Australian Eastern Daylight Time)
[debug] [2024-11-29T00:08:02.678Z] ----------------------------------------------------------------------
[debug]
[debug] [2024-11-29T00:08:02.817Z] Object "" in "firebase.json" has unknown property: {"additionalProperty":"flutter"}
[debug] [2024-11-29T00:08:02.827Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[debug] [2024-11-29T00:08:02.828Z] > authorizing via signed-in user ([email protected])
[info] i  emulators: Starting emulators: pubsub {"metadata":{"emulator":{"name":"hub"},"message":"Starting emulators: pubsub"}}
[warn] !  pubsub: Port 8085 is not open on localhost (127.0.0.1), could not start Pub/Sub Emulator. {"metadata":{"emulator":{"name":"pubsub"},"message":"Port 8085 is not open on localhost (127.0.0.1), could not start Pub/Sub Emulator."}}
[warn] !  pubsub: To select a different host/port, specify that host/port in a firebase.json config file:
      {
        // ...
        "emulators": {
          "pubsub": {
            "host": "HOST",
            "port": "PORT"
          }
        }
      } {"metadata":{"emulator":{"name":"pubsub"},"message":"To select a different host/port, specify that host/port in a firebase.json config file:\n      {\n        // ...\n        \"emulators\": {\n          \"pubsub\": {\n            \"host\": \"\u001b[33mHOST\u001b[39m\",\n            \"port\": \"\u001b[33mPORT\u001b[39m\"\n          }\n        }\n      }"}}
[debug] [2024-11-29T00:08:02.841Z] [logging] Logging Emulator only supports listening on one address (127.0.0.1). Not listening on ::1
[debug] [2024-11-29T00:08:02.856Z] Could not find VSCode notification endpoint: FetchError: request to http://localhost:40001/vscode/notify failed, reason: . If you are not running the Firebase Data Connect VSCode extension, this is expected and not an issue.
[info] i  emulators: Shutting down emulators. {"metadata":{"emulator":{"name":"hub"},"message":"Shutting down emulators."}}
[debug] [2024-11-29T00:08:02.859Z] Could not find VSCode notification endpoint: FetchError: request to http://localhost:40001/vscode/notify failed, reason: . If you are not running the Firebase Data Connect VSCode extension, this is expected and not an issue.
[error]
[error] Error: Could not start Pub/Sub Emulator, port taken.

Activity

  1. aalej commented on Nov 29, 2024

    @aalej
    Contributor

    Hey @lawther, thanks for the report. It looks like this is a similar issue to #3506. Could you please leave a comment or a thumbs up on the other issue? This helps us monitor and prioritize development efforts. That said, I’ll mark this as a duplicate.

  2. lawther commented on Nov 30, 2024

    @lawther
    Author

    Will do, sorry for the dupe!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions