dapr / cli

Command-line tools for Dapr.
Apache License 2.0
317 stars 199 forks source link

daprd crashes if port already in use, breaking dapr cli #1441

Open withinboredom opened 1 month ago

withinboredom commented 1 month ago

In what area(s)?

/area runtime

/area operator

/area placement

/area docs

/area test-and-release

What version of Dapr?

latest

Expected Behavior

dapr cli to gracefully exit or restart

Actual Behavior

dapr run -- ./cli
ℹ️  The scheduler is only compatible with dapr runtime 1.14 onwards.
ℹ️  Starting Dapr with id hisserplume-hyena. HTTP Port: 60807. gRPC Port: 60725
ℹ️  Checking if Dapr sidecar is listening on HTTP port 60807
Flag --components-path has been deprecated, use --resources-path
INFO[0000] Starting Dapr Runtime -- version 1.13.5 -- commit e490e58f62110ecdc430d2f39d57428729a487ea  app_id=hisserplume-hyena instance=Legion scope=dapr.runtime type=log ver=1.13.5
INFO[0000] Log level set to: info                        app_id=hisserplume-hyena instance=Legion scope=dapr.runtime type=log ver=1.13.5
WARN[0000] mTLS is disabled. Skipping certificate request and tls validation  app_id=hisserplume-hyena instance=Legion scope=dapr.runtime.security type=log ver=1.13.5
WARN[0000] The default value for 'spec.metric.http.increasedCardinality' will change to 'false' in Dapr 1.14  app_id=hisserplume-hyena instance=Legion scope=dapr.runtime type=log ver=1.13.5
INFO[0000] metrics server started on :60761/             app_id=hisserplume-hyena instance=Legion scope=dapr.runtime type=log ver=1.13.5
INFO[0000] standalone mode configured                    app_id=hisserplume-hyena instance=Legion scope=dapr.runtime type=log ver=1.13.5
INFO[0000] app id: hisserplume-hyena                     app_id=hisserplume-hyena instance=Legion scope=dapr.runtime type=log ver=1.13.5
INFO[0000] Dapr trace sampler initialized: DaprTraceSampler(P=1.000000)  app_id=hisserplume-hyena instance=Legion scope=dapr.runtime type=log ver=1.13.5
INFO[0000] local service entry announced: hisserplume-hyena -> 192.168.50.104:60725  app_id=hisserplume-hyena component="nr (mdns/v1)" instance=Legion scope=dapr.contrib type=log ver=1.13.5
INFO[0000] Initialized name resolution to mdns           app_id=hisserplume-hyena instance=Legion scope=dapr.runtime type=log ver=1.13.5
INFO[0000] Loading components…                           app_id=hisserplume-hyena instance=Legion scope=dapr.runtime type=log ver=1.13.5
INFO[0000] Component loaded: pubsub (pubsub.redis/v1)    app_id=hisserplume-hyena instance=Legion scope=dapr.runtime.processor type=log ver=1.13.5
INFO[0000] Waiting for all outstanding components to be processed…  app_id=hisserplume-hyena instance=Legion scope=dapr.runtime type=log ver=1.13.5
INFO[0000] Using 'statestore' as actor state store       app_id=hisserplume-hyena instance=Legion scope=dapr.runtime.processor.state type=log ver=1.13.5
INFO[0000] Component loaded: statestore (state.redis/v1)  app_id=hisserplume-hyena instance=Legion scope=dapr.runtime.processor type=log ver=1.13.5
INFO[0000] All outstanding components processed          app_id=hisserplume-hyena instance=Legion scope=dapr.runtime type=log ver=1.13.5
INFO[0000] Loading endpoints…                            app_id=hisserplume-hyena instance=Legion scope=dapr.runtime type=log ver=1.13.5
INFO[0000] Waiting for all outstanding http endpoints to be processed…  app_id=hisserplume-hyena instance=Legion scope=dapr.runtime type=log ver=1.13.5
INFO[0000] All outstanding http endpoints processed      app_id=hisserplume-hyena instance=Legion scope=dapr.runtime type=log ver=1.13.5
WARN[0000] App channel is not initialized. Did you configure an app-port?  app_id=hisserplume-hyena instance=Legion scope=dapr.runtime.channels type=log ver=1.13.5
INFO[0000] gRPC server listening on TCP address: :60725  app_id=hisserplume-hyena instance=Legion scope=dapr.runtime.grpc.api type=log ver=1.13.5
INFO[0000] Enabled gRPC tracing middleware               app_id=hisserplume-hyena instance=Legion scope=dapr.runtime.grpc.api type=log ver=1.13.5
INFO[0000] Enabled gRPC metrics middleware               app_id=hisserplume-hyena instance=Legion scope=dapr.runtime.grpc.api type=log ver=1.13.5
INFO[0000] Registering workflow engine for gRPC endpoint: [::]:60725  app_id=hisserplume-hyena instance=Legion scope=dapr.runtime.grpc.api type=log ver=1.13.5
INFO[0000] API gRPC server is running on port 60725      app_id=hisserplume-hyena instance=Legion scope=dapr.runtime type=log ver=1.13.5
INFO[0000] Enabled max body size HTTP middleware with size 4 MB  app_id=hisserplume-hyena instance=Legion scope=dapr.runtime.http type=log ver=1.13.5
INFO[0000] Enabled tracing HTTP middleware               app_id=hisserplume-hyena instance=Legion scope=dapr.runtime.http type=log ver=1.13.5
INFO[0000] Enabled metrics HTTP middleware               app_id=hisserplume-hyena instance=Legion scope=dapr.runtime.http type=log ver=1.13.5
INFO[0000] HTTP server listening on TCP address: :60807  app_id=hisserplume-hyena instance=Legion scope=dapr.runtime.http type=log ver=1.13.5
INFO[0000] HTTP server is running on port 60807          app_id=hisserplume-hyena instance=Legion scope=dapr.runtime type=log ver=1.13.5
INFO[0000] The request body size parameter is: 4         app_id=hisserplume-hyena instance=Legion scope=dapr.runtime type=log ver=1.13.5
ERRO[0000] Failed to listen for gRPC server on TCP address :60725 with error: listen tcp :60725: bind: address already in use  app_id=hisserplume-hyena instance=Legion scope=dapr.runtime.grpc.internal type=log ver=1.13.5
INFO[0000] Dapr is shutting down                         app_id=hisserplume-hyena instance=Legion scope=dapr.runtime type=log ver=1.13.5
INFO[0000] Shutting down component statestore (state.redis/v1)  app_id=hisserplume-hyena instance=Legion scope=dapr.runtime type=log ver=1.13.5
INFO[0000] Shutting down component pubsub (pubsub.redis/v1)  app_id=hisserplume-hyena instance=Legion scope=dapr.runtime type=log ver=1.13.5
INFO[0000] stopping mDNS server for app id: hisserplume-hyena  app_id=hisserplume-hyena component="nr (mdns/v1)" instance=Legion scope=dapr.contrib type=log ver=1.13.5
INFO[0000] Shutting down workflow engine                 app_id=hisserplume-hyena instance=Legion scope=dapr.runtime type=log ver=1.13.5
INFO[0000] Dapr runtime stopped                          app_id=hisserplume-hyena instance=Legion scope=dapr.runtime type=log ver=1.13.5
INFO[0000] Closing HTTP server [::]:60807…               app_id=hisserplume-hyena instance=Legion scope=dapr.runtime.http type=log ver=1.13.5
FATA[0000] Fatal error from runtime: failed to start internal gRPC server: could not listen on any endpoint  app_id=hisserplume-hyena instance=Legion scope=dapr.runtime type=log ver=1.13.5
❌  The daprd process exited with error code: exit status 1

HANG for several minutes

Dapr sidecar is not listening on HTTP port: dial tcp 127.0.0.1:60807: connect: connection refused
ℹ️  Checking if Dapr sidecar is listening on GRPC port 60725
⚠  Dapr sidecar is not listening on GRPC port: dial tcp 127.0.0.1:60725: connect: connection refused
⚠  Dapr sidecar might not be responding.
❌  The App process exited with error code: exit status 1
⚠  Could not update sidecar metadata for cliPID: PUT http://127.0.0.1:60807/v1.0/metadata/cliPID giving up after 5 attempt(s): Put "http://127.0.0.1:60807/v1.0/metadata/cliPID": dial tcp 127.0.0.1:60807: connect: connection refused
ℹ️  Updating metadata for appPID: 27462
⚠  Could not update sidecar metadata for appPID: PUT http://127.0.0.1:60807/v1.0/metadata/appPID giving up after 5 attempt(s): Put "http://127.0.0.1:60807/v1.0/metadata/appPID": dial tcp 127.0.0.1:60807: connect: connection refused
ℹ️  Updating metadata for app command: ./cli
⚠  Could not update sidecar metadata for appCommand: PUT http://127.0.0.1:60807/v1.0/metadata/appCommand giving up after 5 attempt(s): Put "http://127.0.0.1:60807/v1.0/metadata/appCommand": dial tcp 127.0.0.1:60807: connect: connection refused

Steps to Reproduce the Problem

Have daprd accidentally pick an in-use port.

Release Note

RELEASE NOTE:

deepak04112002 commented 1 month ago

We can use proxy server here

yaron2 commented 1 month ago

Moved to the CLI repo

dapr-bot commented 1 day ago

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged (pinned, good first issue, help wanted or triaged/resolved) or other activity occurs. Thank you for your contributions.