cli
cli copied to clipboard
Can't Ctrl-C Early on `dapr run` w/o Necessary Component, Forced to Wait After Seeing Initial Err
Expected Behavior
I would like to think I should be able to ctrl-c to kill the dapr run
process once I see an err. I don't really care to see it err more after I know what is wrong after seeing 1 err.
Actual Behavior
I am unable to ctrl-c and end the dapr run
early. I am forced to wait about 1 minute for the command to finish failing. It looks like it did receive my signal to cancel: terminated signal received: shutting down
, but I feel as though there is room for improvement here, as to a user it looks like it never accepted my ^C^C^C^C^C^C^C
.
Steps to Reproduce the Problem
Follow the README here, and do not create the statestore.
Run the query state example with this command without having a mongo-statestore:
dapr run --components-path ./components/state --app-id query-state-example -H 3600 -- java -Ddapr.api.protocol=HTTP -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.querystate.QuerySavedState
It will take its time, and even if you ctrl-c, it will still fail slowly for a while after you try to cancel. See output of running the above command below:
Flag --components-path has been deprecated, This flag is deprecated and will be removed in the future releases. Use "resources-path" flag instead
ℹ️ Starting Dapr with id query-state-example. HTTP Port: 3600. gRPC Port: 57846
ℹ️ Checking if Dapr sidecar is listening on HTTP port 3600
INFO[0000] starting Dapr Runtime -- version 1.11.3 -- commit 9f99c6adca78dfc04b8063974f27b3a7534ae798 app_id=query-state-example instance=Cassandras-MacBook-Pro.local scope=dapr.runtime type=log ver=1.11.3
INFO[0000] log level set to: info app_id=query-state-example instance=Cassandras-MacBook-Pro.local scope=dapr.runtime type=log ver=1.11.3
INFO[0000] metrics server started on :57847/ app_id=query-state-example instance=Cassandras-MacBook-Pro.local scope=dapr.metrics type=log ver=1.11.3
INFO[0000] Resiliency configuration loaded app_id=query-state-example instance=Cassandras-MacBook-Pro.local scope=dapr.runtime type=log ver=1.11.3
INFO[0000] standalone mode configured app_id=query-state-example instance=Cassandras-MacBook-Pro.local scope=dapr.runtime type=log ver=1.11.3
INFO[0000] app id: query-state-example app_id=query-state-example instance=Cassandras-MacBook-Pro.local scope=dapr.runtime type=log ver=1.11.3
INFO[0000] mTLS is disabled. Skipping certificate request and tls validation app_id=query-state-example instance=Cassandras-MacBook-Pro.local scope=dapr.runtime type=log ver=1.11.3
INFO[0000] Dapr trace sampler initialized: DaprTraceSampler(P=1.000000) app_id=query-state-example instance=Cassandras-MacBook-Pro.local scope=dapr.runtime type=log ver=1.11.3
INFO[0000] local service entry announced: query-state-example -> 192.168.0.2:57848 app_id=query-state-example component="mdns (nameResolution/v1)" instance=Cassandras-MacBook-Pro.local scope=dapr.contrib type=log ver=1.11.3
INFO[0000] Initialized name resolution to mdns app_id=query-state-example instance=Cassandras-MacBook-Pro.local scope=dapr.runtime type=log ver=1.11.3
INFO[0000] Loading components… app_id=query-state-example instance=Cassandras-MacBook-Pro.local scope=dapr.runtime type=log ver=1.11.3
WARN[0005] Error processing component, daprd process will exit gracefully app_id=query-state-example instance=Cassandras-MacBook-Pro.local scope=dapr.runtime type=log ver=1.11.3
FATA[0005] process component mongo-statestore error: [INIT_COMPONENT_FAILURE]: initialization error occurred for mongo-statestore (state.mongodb/v1): init timeout for component mongo-statestore exceeded after 5s app_id=query-state-example instance=Cassandras-MacBook-Pro.local scope=dapr.runtime type=log ver=1.11.3
❌ The daprd process exited with error code: exit status 1
^C^C^C^C^C^C^C
⚠ Dapr sidecar is not listening on HTTP port: dial tcp 127.0.0.1:3600: connect: connection refused
ℹ️ Checking if Dapr sidecar is listening on GRPC port 57846
⚠ Dapr sidecar is not listening on GRPC port: dial tcp 127.0.0.1:57846: connect: connection refused
⚠ Dapr sidecar might not be responding.
== APP == 08:25:19.899 [main] WARN io.dapr.client.DaprClientBuilder - HTTP client protocol is deprecated and will be removed in Dapr's Java SDK version 1.10.
== APP == Waiting for Dapr sidecar ...
== APP == 08:25:20.076 [main] DEBUG reactor.util.Loggers - Using Slf4j logging framework
== APP == Exception in thread "main" java.lang.reflect.InvocationTargetException
== APP == at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
== APP == at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
== APP == at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
== APP == at java.base/java.lang.reflect.Method.invoke(Method.java:566)
== APP == at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
== APP == at org.springframework.boot.loader.Launcher.launch(Launcher.java:108)
== APP == at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
== APP == at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:65)
== APP == Caused by: java.lang.reflect.InvocationTargetException
== APP == at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
== APP == at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
== APP == at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
== APP == at java.base/java.lang.reflect.Method.invoke(Method.java:566)
== APP == at io.dapr.examples.DaprMainApplication.main(DaprMainApplication.java:37)
== APP == ... 8 more
== APP == Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection refused (Connection refused)
== APP == at io.dapr.utils.NetworkUtils.lambda$waitForSocket$0(NetworkUtils.java:53)
== APP == at io.dapr.utils.NetworkUtils.callWithRetry(NetworkUtils.java:89)
== APP == at io.dapr.utils.NetworkUtils.waitForSocket(NetworkUtils.java:44)
== APP == at io.dapr.client.DaprClientHttp.lambda$waitForSidecar$0(DaprClientHttp.java:141)
== APP == at reactor.core.publisher.MonoRunnable.block(MonoRunnable.java:66)
== APP == at io.dapr.examples.querystate.QuerySavedState.main(QuerySavedState.java:53)
== APP == ... 13 more
== APP == Caused by: java.net.ConnectException: Connection refused (Connection refused)
== APP == at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
== APP == at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:412)
== APP == at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:255)
== APP == at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:237)
== APP == at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
== APP == at java.base/java.net.Socket.connect(Socket.java:609)
== APP == at io.dapr.utils.NetworkUtils.lambda$waitForSocket$0(NetworkUtils.java:50)
== APP == ... 18 more
❌ The App process exited with error code: exit status 1
⚠ Could not update sidecar metadata for cliPID: PUT http://127.0.0.1:3600/v1.0/metadata/cliPID giving up after 5 attempt(s): Put "http://127.0.0.1:3600/v1.0/metadata/cliPID": dial tcp 127.0.0.1:3600: connect: connection refused
ℹ️ Updating metadata for appPID: 84095
⚠ Could not update sidecar metadata for appPID: PUT http://127.0.0.1:3600/v1.0/metadata/appPID giving up after 5 attempt(s): Put "http://127.0.0.1:3600/v1.0/metadata/appPID": dial tcp 127.0.0.1:3600: connect: connection refused
ℹ️ Updating metadata for app command: java -Ddapr.api.protocol=HTTP -jar target/dapr-java-sdk-examples-exec.jar io.dapr.examples.querystate.QuerySavedState
⚠ Could not update sidecar metadata for appCommand: PUT http://127.0.0.1:3600/v1.0/metadata/appCommand giving up after 5 attempt(s): Put "http://127.0.0.1:3600/v1.0/metadata/appCommand": dial tcp 127.0.0.1:3600: connect: connection refused
ℹ️
terminated signal received: shutting down
❌ Error exiting Dapr: exit status 1
❌ Error exiting App: exit status 1
related issue https://github.com/dapr/cli/issues/327
/assign