Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dapr ignore schedule-host-address #1503

Open
HenrixG opened this issue Mar 13, 2025 · 4 comments
Open

Dapr ignore schedule-host-address #1503

HenrixG opened this issue Mar 13, 2025 · 4 comments
Labels
kind/bug Something isn't working

Comments

@HenrixG
Copy link

HenrixG commented Mar 13, 2025

Expected Behavior

If I specify the parameter --scheduler-host-address "empty", the sidecar should not periodically query the scheduler.
Second problem:
if I specify --scheduler-host-address localhost:50007, it should connect to IP 127.0.0.1 and not to the DockerImage IP.

Actual Behavior

For a specific sideCar I can't turn off the scheduler (I don't use actors, jobs, workflow) even if I give the parameter
--scheduler-host-address "empty"
--scheduler-host-address ' ' -> (fisrt image)
it always says in the log that it's trying to connect to the scheduler.

second problem:
and when I write localhost:50006 it says in the log the IP of the dockerImage where the scheduler runs. so I can't connect to the sidecar that runs outside of docker.
(second image)

Steps to Reproduce the Problem

in VisualStudio use this launchSettings.json
"Dapr": {
"commandName": "Executable",
"workingDirectory": "$(ProjectDir)",
"executablePath": "dapr",
"commandLineArgs": "run --app-id XXX --dapr-http-port 3500 --dapr-grpc-port 50001 --metrics-port 20000 --app-protocol https --placement-host-address localhost:50000 --scheduler-host-address ' ' --resources-path ../components/ --log-level debug --app-port 12000 --enable-api-logging -- dotnet run ."
}

Release Note

Dapr CLI 1.15.0
Windows 11
DockerDesktop 4.39

RELEASE NOTE:

I discussed this with @WhitWaldo(Innovian) on Discord.

Image

Image

@HenrixG HenrixG added the kind/bug Something isn't working label Mar 13, 2025
@yaron2
Copy link
Member

yaron2 commented Mar 13, 2025

@antontroshin

@mikeee
Copy link
Member

mikeee commented Mar 13, 2025

The scheduler-host-address argument accepts "" however will be rewritten to localhost which is why it cannot be disabled at present when running in self-hosted mode unless you kick-off daprd without any scheduler-host-address(es)

https://github.com/dapr/cli/blob/16cc1d1b59e5864d6eb31111e702add52b646f39/cmd/run.go#L673:L681

This should be changed to match the annotation logic and documented

@antontroshin
Copy link
Contributor

@HenrixG Following the Discord conversation and investigation, linking this here for documentation purposes. Discord link

The first issue seems to be caused by a special case of Powershell parsing empty strings in a special way, which is different from the standard Command Prompt.
The solution to that would be to wrap the double quotes empty string with single quotes or use = to set the value in Powershell.
Example command:

dapr run --scheduler-host-address '""' --app-port 5000 -- go run ./app.go
# or
dapr run --scheduler-host-address="" --app-port 5000 -- go run ./app.go
# or
dapr run --scheduler-host-address='' --app-port 5000 -- go run ./app.go

For the Command Prompt, using empty double quotes works as expected.

dapr run --scheduler-host-address "" --app-port 5000 -- go run ./app.go

Here's the small table of what works as empty string in each Windows shell

Empty Value PS CMD
"" N Y
'' N N
'""' Y N
="" Y Y
='' Y N
=$null Y N

The second issue, where the dapr runtime tries to connect to the scheduler using docker's address, is happening when running dapr in standalone mode, after dapr runtime connects to the scheduler, scheduler discovers it's internal address and reports it back to the runtime on which it can start watching the jobs. To handle this special case for docker, the new parameter was added to the scheduler to override the address and report back as localhost:<port>
This is handled automatically when using dapr init command.
In your case, I've noticed in Discord conversation that the scheduler is being instantiated via docker compose.
For this case, you might want to add another parameter to the ./scheduler binary, to handle this manually.

--override-broadcast-host-port=localhost:50007

@antontroshin
Copy link
Contributor

Another note for Visual Studio users.
I tried the configuration from the launchSettings.json in Visual Studio, and escaping the quotes with \ worked.
Example --scheduler-host-address \"\" or --scheduler-host-address=\"\"

 "Dapr": {
     "commandName": "Executable",
     "workingDirectory": "$(ProjectDir)",
     "executablePath": "dapr",
     "commandLineArgs": "run --app-id XXX --dapr-http-port 3500 --dapr-grpc-port 50001 --metrics-port 20000 --app-protocol https --placement-host-address localhost:50000 --scheduler-host-address \"\" --resources-path ../components/ --log-level debug --app-port 32769 --enable-api-logging -- dotnet run ."
 }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants